Skip to content

Commit

Permalink
Use existing node patterns
Browse files Browse the repository at this point in the history
  • Loading branch information
pirj authored and mockdeep committed Mar 20, 2020
1 parent 32433ce commit 67e1242
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 67e1242

Please sign in to comment.