Class: RuboCop::Cop::Legion::Extension::HookMissingRunnerClass
- Inherits:
-
Base
- Object
- Base
- RuboCop::Cop::Legion::Extension::HookMissingRunnerClass
- Defined in:
- lib/rubocop/cop/legion/extension/hook_missing_runner_class.rb
Overview
Detects hook classes inside a ‘Hooks` namespace that do not override `runner_class`. Without this override, the framework hook builder dispatches to nil, causing HTTP 500 errors.
Constant Summary collapse
- MSG =
'Hook classes must override `runner_class`. Without it, the framework dispatches to nil.'
Instance Method Summary collapse
Instance Method Details
#on_class(node) ⇒ Object
36 37 38 39 40 41 |
# File 'lib/rubocop/cop/legion/extension/hook_missing_runner_class.rb', line 36 def on_class(node) return unless inside_hooks_namespace?(node) return if defines_runner_class?(node) add_offense(node.identifier) end |