Class: RuboCop::Cop::RSwag::ScatteredSetup
- Inherits:
-
Base
- Object
- Base
- RuboCop::Cop::RSwag::ScatteredSetup
- Defined in:
- lib/rubocop/cop/rswag/scattered_setup.rb
Constant Summary collapse
- MSG =
'Do not define multiple hooks of the same type in the same response group.'
Instance Method Summary collapse
Instance Method Details
#on_block(node) ⇒ Object
9 10 11 12 13 14 15 16 17 18 |
# File 'lib/rubocop/cop/rswag/scattered_setup.rb', line 9 def on_block(node) return unless rswag_test?(node) hooks = analyzable_hooks(node) hooks.group_by { |hook| hook.send_node.method_name }.each_value do |group| next if group.size <= 1 group[1..].each { |hook| add_offense(hook) } end end |