From 6ed4ec3e0b1340f96b7c043ef51d1b33bbe85fde Mon Sep 17 00:00:00 2001 From: GitLab Bot Date: Mon, 19 Sep 2022 23:18:09 +0000 Subject: Add latest changes from gitlab-org/gitlab@15-4-stable-ee --- rubocop/cop/migration/add_concurrent_index.rb | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) (limited to 'rubocop/cop/migration/add_concurrent_index.rb') 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 -- cgit v1.2.3