Skip to content

Commit

Permalink
Enable RuboCop for migrations
Browse files Browse the repository at this point in the history
Migrations shouldn't fail RuboCop checks - especially lint checks, such
as the nested method check. To avoid changing code in existing
migrations, add the magic comment to the top of each of them to skip
that file.
  • Loading branch information
smcgivern committed Jun 9, 2016
1 parent 3803b38 commit 98bb435
Show file tree
Hide file tree
Showing 343 changed files with 344 additions and 1 deletion.
3 changes: 2 additions & 1 deletion .rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ AllCops:
# Exclude some GitLab files
Exclude:
- 'vendor/**/*'
- 'db/**/*'
- 'db/*'
- 'db/fixtures/**/*'
- 'tmp/**/*'
- 'bin/**/*'
- 'lib/backup/**/*'
Expand Down
1 change: 1 addition & 0 deletions db/migrate/20121220064453_init_schema.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# rubocop:disable all
class InitSchema < ActiveRecord::Migration
def up

Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# rubocop:disable all
class RenameOwnerToCreatorForProject < ActiveRecord::Migration
def change
rename_column :projects, :owner_id, :creator_id
Expand Down
1 change: 1 addition & 0 deletions db/migrate/20130110172407_add_public_to_project.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# rubocop:disable all
class AddPublicToProject < ActiveRecord::Migration
def change
add_column :projects, :public, :boolean, default: false, null: false
Expand Down
1 change: 1 addition & 0 deletions db/migrate/20130123114545_add_issues_tracker_to_project.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# rubocop:disable all
class AddIssuesTrackerToProject < ActiveRecord::Migration
def change
add_column :projects, :issues_tracker, :string, default: :gitlab, null: false
Expand Down
1 change: 1 addition & 0 deletions db/migrate/20130125090214_add_user_permissions.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# rubocop:disable all
class AddUserPermissions < ActiveRecord::Migration
def up
add_column :users, :can_create_group, :boolean, default: true, null: false
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# rubocop:disable all
class RemovePrivateFlagFromProject < ActiveRecord::Migration
def up
remove_column :projects, :private_flag
Expand Down
1 change: 1 addition & 0 deletions db/migrate/20130206084024_add_description_to_namsespace.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# rubocop:disable all
class AddDescriptionToNamsespace < ActiveRecord::Migration
def change
add_column :namespaces, :description, :string, default: '', null: false
Expand Down
1 change: 1 addition & 0 deletions db/migrate/20130207104426_add_description_to_teams.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# rubocop:disable all
class AddDescriptionToTeams < ActiveRecord::Migration
def change
add_column :user_teams, :description, :string, default: '', null: false
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# rubocop:disable all
class AddIssuesTrackerIdToProject < ActiveRecord::Migration
def change
add_column :projects, :issues_tracker_id, :string
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# rubocop:disable all
class RenameStateToMergeStatusInMilestone < ActiveRecord::Migration
def change
rename_column :merge_requests, :state, :merge_status
Expand Down
1 change: 1 addition & 0 deletions db/migrate/20130218140952_add_state_to_issue.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# rubocop:disable all
class AddStateToIssue < ActiveRecord::Migration
def change
add_column :issues, :state, :string
Expand Down
1 change: 1 addition & 0 deletions db/migrate/20130218141038_add_state_to_merge_request.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# rubocop:disable all
class AddStateToMergeRequest < ActiveRecord::Migration
def change
add_column :merge_requests, :state, :string
Expand Down
1 change: 1 addition & 0 deletions db/migrate/20130218141117_add_state_to_milestone.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# rubocop:disable all
class AddStateToMilestone < ActiveRecord::Migration
def change
add_column :milestones, :state, :string
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# rubocop:disable all
class ConvertClosedToStateInIssue < ActiveRecord::Migration
include Gitlab::Database

Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# rubocop:disable all
class ConvertClosedToStateInMergeRequest < ActiveRecord::Migration
include Gitlab::Database

Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# rubocop:disable all
class ConvertClosedToStateInMilestone < ActiveRecord::Migration
include Gitlab::Database

Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# rubocop:disable all
class RemoveMergedFromMergeRequest < ActiveRecord::Migration
def up
remove_column :merge_requests, :merged
Expand Down
1 change: 1 addition & 0 deletions db/migrate/20130218141507_remove_closed_from_issue.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# rubocop:disable all
class RemoveClosedFromIssue < ActiveRecord::Migration
def up
remove_column :issues, :closed
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# rubocop:disable all
class RemoveClosedFromMergeRequest < ActiveRecord::Migration
def up
remove_column :merge_requests, :closed
Expand Down
1 change: 1 addition & 0 deletions db/migrate/20130218141554_remove_closed_from_milestone.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# rubocop:disable all
class RemoveClosedFromMilestone < ActiveRecord::Migration
def up
remove_column :milestones, :closed
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# rubocop:disable all
class AddNewMergeStatusToMergeRequest < ActiveRecord::Migration
def change
add_column :merge_requests, :new_merge_status, :string
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# rubocop:disable all
class ConvertMergeStatusInMergeRequest < ActiveRecord::Migration
def up
execute "UPDATE #{table_name} SET new_merge_status = 'unchecked' WHERE merge_status = 1"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# rubocop:disable all
class RemoveMergeStatusFromMergeRequest < ActiveRecord::Migration
def up
remove_column :merge_requests, :merge_status
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# rubocop:disable all
class RenameNewMergeStatusToMergeStatusInMilestone < ActiveRecord::Migration
def change
rename_column :merge_requests, :new_merge_status, :merge_status
Expand Down
1 change: 1 addition & 0 deletions db/migrate/20130304104623_add_state_to_user.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# rubocop:disable all
class AddStateToUser < ActiveRecord::Migration
def change
add_column :users, :state, :string
Expand Down
1 change: 1 addition & 0 deletions db/migrate/20130304104740_convert_blocked_to_state.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# rubocop:disable all
class ConvertBlockedToState < ActiveRecord::Migration
def up
User.transaction do
Expand Down
1 change: 1 addition & 0 deletions db/migrate/20130304105317_remove_blocked_from_user.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# rubocop:disable all
class RemoveBlockedFromUser < ActiveRecord::Migration
def up
remove_column :users, :blocked
Expand Down
1 change: 1 addition & 0 deletions db/migrate/20130315124931_user_color_scheme.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# rubocop:disable all
class UserColorScheme < ActiveRecord::Migration
include Gitlab::Database

Expand Down
1 change: 1 addition & 0 deletions db/migrate/20130318212250_add_snippets_to_features.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# rubocop:disable all
class AddSnippetsToFeatures < ActiveRecord::Migration
def change
add_column :projects, :snippets_enabled, :boolean, null: false, default: true
Expand Down
1 change: 1 addition & 0 deletions db/migrate/20130319214458_create_forked_project_links.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# rubocop:disable all
class CreateForkedProjectLinks < ActiveRecord::Migration
def change
create_table :forked_project_links do |t|
Expand Down
1 change: 1 addition & 0 deletions db/migrate/20130323174317_add_private_to_snippets.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# rubocop:disable all
class AddPrivateToSnippets < ActiveRecord::Migration
def change
add_column :snippets, :private, :boolean, null: false, default: true
Expand Down
1 change: 1 addition & 0 deletions db/migrate/20130324151736_add_type_to_snippets.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# rubocop:disable all
class AddTypeToSnippets < ActiveRecord::Migration
def change
add_column :snippets, :type, :string
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# rubocop:disable all
class ChangeProjectIdToNullInSnipepts < ActiveRecord::Migration
def up
change_column :snippets, :project_id, :integer, :null => true
Expand Down
1 change: 1 addition & 0 deletions db/migrate/20130324203535_add_type_value_for_snippets.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# rubocop:disable all
class AddTypeValueForSnippets < ActiveRecord::Migration
def up
Snippet.where("project_id IS NOT NULL").update_all(type: 'ProjectSnippet')
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# rubocop:disable all
class AddNotificationLevelToUser < ActiveRecord::Migration
def change
add_column :users, :notification_level, :integer, null: false, default: 1
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# rubocop:disable all
class AddIndexToUsersAuthenticationToken < ActiveRecord::Migration
def change
add_index :users, :authentication_token, unique: true
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# rubocop:disable all
class AddLastActivityColumnIntoProject < ActiveRecord::Migration
def up
add_column :projects, :last_activity_at, :datetime
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# rubocop:disable all
class AddNotificationLevelToUserProject < ActiveRecord::Migration
def change
add_column :users_projects, :notification_level, :integer, null: false, default: 3
Expand Down
1 change: 1 addition & 0 deletions db/migrate/20130410175022_remove_wiki_table.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# rubocop:disable all
class RemoveWikiTable < ActiveRecord::Migration
def up
drop_table :wikis
Expand Down
1 change: 1 addition & 0 deletions db/migrate/20130419190306_allow_merges_for_forks.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# rubocop:disable all
class AllowMergesForForks < ActiveRecord::Migration
def self.up
add_column :merge_requests, :target_project_id, :integer, :null => true
Expand Down
1 change: 1 addition & 0 deletions db/migrate/20130506085413_add_type_to_key.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# rubocop:disable all
class AddTypeToKey < ActiveRecord::Migration
def change
add_column :keys, :type, :string
Expand Down
1 change: 1 addition & 0 deletions db/migrate/20130506090604_create_deploy_keys_projects.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# rubocop:disable all
class CreateDeployKeysProjects < ActiveRecord::Migration
def change
create_table :deploy_keys_projects do |t|
Expand Down
1 change: 1 addition & 0 deletions db/migrate/20130506095501_remove_project_id_from_key.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# rubocop:disable all
class RemoveProjectIdFromKey < ActiveRecord::Migration
def up
puts 'Migrate deploy keys: '
Expand Down
1 change: 1 addition & 0 deletions db/migrate/20130522141856_add_more_fields_to_service.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# rubocop:disable all
class AddMoreFieldsToService < ActiveRecord::Migration
def change
add_column :services, :subdomain, :string
Expand Down
1 change: 1 addition & 0 deletions db/migrate/20130528184641_add_system_to_notes.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# rubocop:disable all
class AddSystemToNotes < ActiveRecord::Migration
class Note < ActiveRecord::Base
end
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# rubocop:disable all
class IncreaseSnippetTextColumnSize < ActiveRecord::Migration
def up
# MYSQL LARGETEXT for snippet
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# rubocop:disable all
class AddPasswordExpiresAtToUsers < ActiveRecord::Migration
def change
add_column :users, :password_expires_at, :datetime
Expand Down
1 change: 1 addition & 0 deletions db/migrate/20130613173246_add_created_by_id_to_user.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# rubocop:disable all
class AddCreatedByIdToUser < ActiveRecord::Migration
def change
add_column :users, :created_by_id, :integer
Expand Down
1 change: 1 addition & 0 deletions db/migrate/20130614132337_add_improted_to_project.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# rubocop:disable all
class AddImprotedToProject < ActiveRecord::Migration
def change
add_column :projects, :imported, :boolean, default: false, null: false
Expand Down
1 change: 1 addition & 0 deletions db/migrate/20130617095603_create_users_groups.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# rubocop:disable all
class CreateUsersGroups < ActiveRecord::Migration
def change
create_table :users_groups do |t|
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# rubocop:disable all
class AddNotificationLevelToUserGroup < ActiveRecord::Migration
def change
add_column :users_groups, :notification_level, :integer, null: false, default: 3
Expand Down
1 change: 1 addition & 0 deletions db/migrate/20130622115340_add_more_db_index.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# rubocop:disable all
class AddMoreDbIndex < ActiveRecord::Migration
def change
add_index :deploy_keys_projects, :project_id
Expand Down
1 change: 1 addition & 0 deletions db/migrate/20130624162710_add_fingerprint_to_key.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# rubocop:disable all
class AddFingerprintToKey < ActiveRecord::Migration
def change
add_column :keys, :fingerprint, :string
Expand Down
1 change: 1 addition & 0 deletions db/migrate/20130711063759_create_project_group_links.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# rubocop:disable all
class CreateProjectGroupLinks < ActiveRecord::Migration
def change
create_table :project_group_links do |t|
Expand Down
1 change: 1 addition & 0 deletions db/migrate/20130804151314_add_st_diff_to_note.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# rubocop:disable all
class AddStDiffToNote < ActiveRecord::Migration
def change
add_column :notes, :st_diff, :text, :null => true
Expand Down
1 change: 1 addition & 0 deletions db/migrate/20130809124851_add_permission_check_to_user.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# rubocop:disable all
class AddPermissionCheckToUser < ActiveRecord::Migration
def change
add_column :users, :last_credential_check_at, :datetime
Expand Down
1 change: 1 addition & 0 deletions db/migrate/20130812143708_add_import_url_to_project.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# rubocop:disable all
class AddImportUrlToProject < ActiveRecord::Migration
def change
add_column :projects, :import_url, :string
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# rubocop:disable all
class AddInternalIdsToIssuesAndMr < ActiveRecord::Migration
def change
add_column :issues, :iid, :integer
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# rubocop:disable all
class AddAccessToProjectGroupLink < ActiveRecord::Migration
def change
add_column :project_group_links, :group_access, :integer, null: false, default: ProjectGroupLink.default_access
Expand Down
1 change: 1 addition & 0 deletions db/migrate/20130821090530_remove_deprecated_tables.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# rubocop:disable all
class RemoveDeprecatedTables < ActiveRecord::Migration
def up
drop_table :user_teams
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# rubocop:disable all
class AddInternalIdsToMilestones < ActiveRecord::Migration
def change
add_column :milestones, :iid, :integer
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# rubocop:disable all
class AddDescriptionToMergeRequest < ActiveRecord::Migration
def change
add_column :merge_requests, :description, :text, null: true
Expand Down
1 change: 1 addition & 0 deletions db/migrate/20130926081215_change_owner_id_for_group.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# rubocop:disable all
class ChangeOwnerIdForGroup < ActiveRecord::Migration
def up
change_column :namespaces, :owner_id, :integer, null: true
Expand Down
1 change: 1 addition & 0 deletions db/migrate/20131005191208_add_avatar_to_users.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# rubocop:disable all
class AddAvatarToUsers < ActiveRecord::Migration
def change
add_column :users, :avatar, :string
Expand Down
1 change: 1 addition & 0 deletions db/migrate/20131009115346_add_confirmable_to_users.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# rubocop:disable all
class AddConfirmableToUsers < ActiveRecord::Migration
def self.up
add_column :users, :confirmation_token, :string
Expand Down
1 change: 1 addition & 0 deletions db/migrate/20131106151520_remove_default_branch.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# rubocop:disable all
class RemoveDefaultBranch < ActiveRecord::Migration
def up
remove_column :projects, :default_branch
Expand Down
1 change: 1 addition & 0 deletions db/migrate/20131112114325_create_broadcast_messages.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# rubocop:disable all
class CreateBroadcastMessages < ActiveRecord::Migration
def change
create_table :broadcast_messages do |t|
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# rubocop:disable all
class AddVisibilityLevelToProjects < ActiveRecord::Migration
include Gitlab::Database

Expand Down
1 change: 1 addition & 0 deletions db/migrate/20131129154016_add_archived_to_projects.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# rubocop:disable all
class AddArchivedToProjects < ActiveRecord::Migration
def change
add_column :projects, :archived, :boolean, default: false, null: false
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# rubocop:disable all
class AddColorAndFontToBroadcastMessages < ActiveRecord::Migration
def change
add_column :broadcast_messages, :color, :string
Expand Down
1 change: 1 addition & 0 deletions db/migrate/20131202192556_add_event_fields_for_web_hook.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# rubocop:disable all
class AddEventFieldsForWebHook < ActiveRecord::Migration
def change
add_column :web_hooks, :push_events, :boolean, default: true, null: false
Expand Down
1 change: 1 addition & 0 deletions db/migrate/20131214224427_add_hide_no_ssh_key_to_users.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# rubocop:disable all
class AddHideNoSshKeyToUsers < ActiveRecord::Migration
def change
add_column :users, :hide_no_ssh_key, :boolean, :default => false
Expand Down
1 change: 1 addition & 0 deletions db/migrate/20131217102743_add_recipients_to_service.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# rubocop:disable all
class AddRecipientsToService < ActiveRecord::Migration
def change
add_column :services, :recipients, :text
Expand Down
1 change: 1 addition & 0 deletions db/migrate/20140116231608_add_website_url_to_users.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# rubocop:disable all
class AddWebsiteUrlToUsers < ActiveRecord::Migration
def change
add_column :users, :website_url, :string, {:null => false, :default => ''}
Expand Down
1 change: 1 addition & 0 deletions db/migrate/20140122112253_create_merge_request_diffs.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# rubocop:disable all
class CreateMergeRequestDiffs < ActiveRecord::Migration
def up
create_table :merge_request_diffs do |t|
Expand Down
1 change: 1 addition & 0 deletions db/migrate/20140122114406_migrate_mr_diffs.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# rubocop:disable all
class MigrateMrDiffs < ActiveRecord::Migration
def self.up
execute "INSERT INTO merge_request_diffs ( merge_request_id, st_commits, st_diffs ) SELECT id, st_commits, st_diffs FROM merge_requests"
Expand Down
1 change: 1 addition & 0 deletions db/migrate/20140122122549_remove_m_rdiff_fields.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# rubocop:disable all
class RemoveMRdiffFields < ActiveRecord::Migration
def up
remove_column :merge_requests, :st_commits
Expand Down
1 change: 1 addition & 0 deletions db/migrate/20140125162722_add_avatar_to_projects.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# rubocop:disable all
class AddAvatarToProjects < ActiveRecord::Migration
def change
add_column :projects, :avatar, :string
Expand Down
Loading

0 comments on commit 98bb435

Please sign in to comment.