Class: RuboCop::Cop::RSpec::NestedGroups
- Includes:
- 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
Constant Summary collapse
- MSG =
'Maximum example group nesting exceeded ' \ '[%<total>d/%<max>d].'.freeze
- DEPRECATED_MAX_KEY =
'MaxNesting'.freeze
- DEPRECATION_WARNING =
"Configuration key `#{DEPRECATED_MAX_KEY}` for #{cop_name} is " \ 'deprecated in favor of `Max`. Please use that instead.'.freeze
Constants inherited from Cop
Cop::DEFAULT_CONFIGURATION, Cop::DEFAULT_PATTERN_RE
Constants included from RSpec::Language
Instance Method Summary collapse
Methods included from RSpec::TopLevelDescribe
Methods inherited from Cop
Instance Method Details
#on_top_level_describe(node, _args) ⇒ Object
101 102 103 104 105 106 107 108 109 |
# File 'lib/rubocop/cop/rspec/nested_groups.rb', line 101 def on_top_level_describe(node, _args) find_nested_contexts(node.parent) do |context, nesting| add_offense( context.children.first, location: :expression, message: (nesting) ) end end |