Class: RuboCop::Cop::RSpec::NestedGroups
- Includes:
- ConfigurableMax, RSpec::TopLevelDescribe
- Defined in:
- lib/rubocop/cop/rspec/nested_groups.rb
Overview
Checks for nested example groups.
This cop is configurable using the ‘Max` option and supports `–auto-gen-config
Constant Summary collapse
- MSG =
'Maximum example group nesting exceeded [%<total>d/%<max>d].'
- DEPRECATED_MAX_KEY =
'MaxNesting'
- DEPRECATION_WARNING =
"Configuration key `#{DEPRECATED_MAX_KEY}` for #{cop_name} is " \ 'deprecated in favor of `Max`. Please use that instead.'
Constants inherited from Cop
Cop::DEFAULT_CONFIGURATION, Cop::DEFAULT_PATTERN_RE
Constants included from RSpec::Language
RSpec::Language::ALL, RSpec::Language::RSPEC
Instance Method Summary collapse
Methods included from RSpec::TopLevelDescribe
Methods inherited from Cop
Instance Method Details
#on_top_level_describe(node, _args) ⇒ Object
102 103 104 105 106 107 108 109 110 111 |
# File 'lib/rubocop/cop/rspec/nested_groups.rb', line 102 def on_top_level_describe(node, _args) find_nested_contexts(node.parent) do |context, nesting| self.max = nesting add_offense( context.send_node, location: :expression, message: (nesting) ) end end |