Class: Rubocop::Cop::BlockNesting

Inherits:
Cop
  • Object
show all
Defined in:
lib/rubocop/cop/block_nesting.rb

Constant Summary collapse

NESTING_BLOCKS =
[:case, :if, :while, :until, :for, :resbody]

Instance Attribute Summary

Attributes inherited from Cop

#debug, #disabled_lines, #offences

Instance Method Summary collapse

Methods inherited from Cop

#add_offence, cop_name, #has_report?, #ignore_node, inherited, #initialize, #name

Constructor Details

This class inherits a constructor from Rubocop::Cop::Cop

Instance Method Details

#inspect(source, tokens, ast, comments) ⇒ Object



8
9
10
11
# File 'lib/rubocop/cop/block_nesting.rb', line 8

def inspect(source, tokens, ast, comments)
  max = BlockNesting.config['Max']
  check_nesting_level(ast, max, 0)
end