summaryrefslogtreecommitdiff
path: root/rubocop/cop/gitlab/finder_with_find_by.rb
diff options
context:
space:
mode:
Diffstat (limited to 'rubocop/cop/gitlab/finder_with_find_by.rb')
-rw-r--r--rubocop/cop/gitlab/finder_with_find_by.rb4
1 files changed, 2 insertions, 2 deletions
diff --git a/rubocop/cop/gitlab/finder_with_find_by.rb b/rubocop/cop/gitlab/finder_with_find_by.rb
index f45a37ddc06..764a5073143 100644
--- a/rubocop/cop/gitlab/finder_with_find_by.rb
+++ b/rubocop/cop/gitlab/finder_with_find_by.rb
@@ -2,7 +2,7 @@ module RuboCop
module Cop
module Gitlab
class FinderWithFindBy < RuboCop::Cop::Cop
- FIND_PATTERN = /\Afind(_by\!?)?\z/
+ FIND_PATTERN = /\Afind(_by\!?)?\z/.freeze
ALLOWED_MODULES = ['FinderMethods'].freeze
def message(used_method)
@@ -36,7 +36,7 @@ module RuboCop
def find_on_execute?(node)
chained_on_node = node.descendants.first
node.method_name.to_s =~ FIND_PATTERN &&
- chained_on_node&.method_name == :execute
+ chained_on_node.is_a?(RuboCop::AST::SendNode) && chained_on_node.method_name == :execute
end
def allowed_module?(node)