Skip to content

Commit

Permalink
Address Rubocop warnings and CodeClimate issues
Browse files Browse the repository at this point in the history
  • Loading branch information
andrykonchin committed Jun 29, 2020
1 parent 0037e88 commit 1fe0377
Showing 1 changed file with 12 additions and 7 deletions.
19 changes: 12 additions & 7 deletions lib/rubocop/cop/rspec/let_setup.rb
Expand Up @@ -51,17 +51,22 @@ def unused_let_bang(node)
end

def child_let_bang(block_node)
begin_node = nested_begin(block_node)
return unless begin_node

begin_node.each_child_node(:block) do |child|
node_with_name = let_bang(child)
yield node_with_name if node_with_name
end
end

def nested_begin(block_node)
return unless block_node.body

body = block_node.body
return unless body.begin_type?

if body.begin_type?
body.each_child_node(:block) do |child|
if result = let_bang(child)
yield result
end
end
end
body
end
end
end
Expand Down

0 comments on commit 1fe0377

Please sign in to comment.