Skip to content

Commit

Permalink
Refactor. Remove excessive call of example_group?(node)
Browse files Browse the repository at this point in the history
  • Loading branch information
andrykonchin committed Jul 1, 2020
1 parent 5475110 commit 128e0a0
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions lib/rubocop/cop/rspec/nested_groups.rb
Expand Up @@ -110,9 +110,10 @@ def on_top_level_describe(node, _args)
private

def find_nested_example_groups(node, nesting: 1, &block)
yield node, nesting if example_group?(node) && nesting > max_nesting
example_group = example_group?(node)
yield node, nesting if example_group && nesting > max_nesting

next_nesting = example_group?(node) ? nesting + 1 : nesting
next_nesting = example_group ? nesting + 1 : nesting

node.each_child_node do |child|
find_nested_example_groups(child, nesting: next_nesting, &block)
Expand Down

0 comments on commit 128e0a0

Please sign in to comment.