diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2022-09-20 02:18:09 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2022-09-20 02:18:09 +0300 |
commit | 6ed4ec3e0b1340f96b7c043ef51d1b33bbe85fde (patch) | |
tree | dc4d20fe6064752c0bd323187252c77e0a89144b /rubocop/cop/migration/add_concurrent_index.rb | |
parent | 9868dae7fc0655bd7ce4a6887d4e6d487690eeed (diff) |
Add latest changes from gitlab-org/gitlab@15-4-stable-eev15.4.0-rc42
Diffstat (limited to 'rubocop/cop/migration/add_concurrent_index.rb')
-rw-r--r-- | rubocop/cop/migration/add_concurrent_index.rb | 10 |
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 |