Skip to content

Commit

Permalink
Use existing node patterns
Browse files Browse the repository at this point in the history
  • Loading branch information
pirj committed Mar 19, 2020
1 parent 8d08f59 commit 72e5bca
Showing 1 changed file with 2 additions and 7 deletions.
9 changes: 2 additions & 7 deletions lib/rubocop/cop/rspec/no_let.rb
Expand Up @@ -58,13 +58,8 @@ class NoLet < Cop
MSG = 'Avoid using `%<method>s` ' \
'– use a method call or local variable instead.'

def_node_matcher :let?, <<~PATTERN
(send nil? :let ...)
PATTERN

def_node_matcher :subject?, <<~PATTERN
(send nil? :subject ...)
PATTERN
def_node_matcher :let?, Helpers::ALL.send_pattern
def_node_matcher :subject?, Subject::ALL.send_pattern

def on_send(node)
if subject?(node) && !allow_subject?
Expand Down

0 comments on commit 72e5bca

Please sign in to comment.