diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2022-11-21 15:09:07 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2022-11-21 15:09:07 +0300 |
commit | fbc1f4ffc29ae99f438b07872c3c00fbe7651caa (patch) | |
tree | 8d82cc8f4037880ebd6fedee1952b48784a634ee /rubocop | |
parent | ff2606426b46aa3c5ea9fb18a6d0ce7c38aed183 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'rubocop')
-rw-r--r-- | rubocop/cop/migration/add_column_with_default.rb | 23 | ||||
-rw-r--r-- | rubocop/cop/migration/safer_boolean_column.rb | 4 | ||||
-rw-r--r-- | rubocop/migration_helpers.rb | 2 |
3 files changed, 3 insertions, 26 deletions
diff --git a/rubocop/cop/migration/add_column_with_default.rb b/rubocop/cop/migration/add_column_with_default.rb deleted file mode 100644 index 36603e09263..00000000000 --- a/rubocop/cop/migration/add_column_with_default.rb +++ /dev/null @@ -1,23 +0,0 @@ -# frozen_string_literal: true - -require_relative '../../migration_helpers' - -module RuboCop - module Cop - module Migration - class AddColumnWithDefault < RuboCop::Cop::Base - include MigrationHelpers - - MSG = '`add_column_with_default` is deprecated, use `add_column` instead' - - def on_send(node) - return unless in_migration?(node) - - name = node.children[1] - - add_offense(node.loc.selector) if name == :add_column_with_default - end - end - end - end -end diff --git a/rubocop/cop/migration/safer_boolean_column.rb b/rubocop/cop/migration/safer_boolean_column.rb index d3d77b16357..c5df21dc94a 100644 --- a/rubocop/cop/migration/safer_boolean_column.rb +++ b/rubocop/cop/migration/safer_boolean_column.rb @@ -21,9 +21,9 @@ module RuboCop class SaferBooleanColumn < RuboCop::Cop::Base include MigrationHelpers - DEFAULT_OFFENSE = 'Boolean columns on the `%s` table should have a default. You may wish to use `add_column_with_default`.' + DEFAULT_OFFENSE = 'Boolean columns on the `%s` table should have a default.' NULL_OFFENSE = 'Boolean columns on the `%s` table should disallow nulls.' - DEFAULT_AND_NULL_OFFENSE = 'Boolean columns on the `%s` table should have a default and should disallow nulls. You may wish to use `add_column_with_default`.' + DEFAULT_AND_NULL_OFFENSE = 'Boolean columns on the `%s` table should have a default and should disallow nulls.' def_node_matcher :add_column?, <<~PATTERN (send nil? :add_column $...) diff --git a/rubocop/migration_helpers.rb b/rubocop/migration_helpers.rb index 22f3931be73..89728183367 100644 --- a/rubocop/migration_helpers.rb +++ b/rubocop/migration_helpers.rb @@ -19,7 +19,7 @@ module RuboCop # List of helpers that add new columns, either directly (ADD_COLUMN_METHODS) # or through a create/alter table (TABLE_METHODS) - ADD_COLUMN_METHODS = %i(add_column add_column_with_default change_column_type_concurrently).freeze + ADD_COLUMN_METHODS = %i(add_column change_column_type_concurrently).freeze TABLE_METHODS = %i(create_table create_table_if_not_exists change_table create_table_with_constraints).freeze |