Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'rubocop/cop/migration/add_concurrent_index.rb')
-rw-r--r--rubocop/cop/migration/add_concurrent_index.rb10
1 files changed, 3 insertions, 7 deletions
diff --git a/rubocop/cop/migration/add_concurrent_index.rb b/rubocop/cop/migration/add_concurrent_index.rb
index bfe7c15bfdf..77b8ced4778 100644
--- a/rubocop/cop/migration/add_concurrent_index.rb
+++ b/rubocop/cop/migration/add_concurrent_index.rb
@@ -7,7 +7,7 @@ module RuboCop
module Migration
# Cop that checks if `add_concurrent_index` is used with `up`/`down` methods
# and not `change`.
- class AddConcurrentIndex < RuboCop::Cop::Cop
+ class AddConcurrentIndex < RuboCop::Cop::Base
include MigrationHelpers
MSG = '`add_concurrent_index` is not reversible so you must manually define ' \
@@ -21,15 +21,11 @@ module RuboCop
return unless name == :add_concurrent_index
node.each_ancestor(:def) do |def_node|
- next unless method_name(def_node) == :change
+ next unless def_node.method_name == :change
- add_offense(def_node, location: :name)
+ add_offense(def_node.loc.name)
end
end
-
- def method_name(node)
- node.children.first
- end
end
end
end