Class: RuboCop::Cop::Legion::Extension::RunnerMustBeModule

Inherits:
Base
  • Object
show all
Defined in:
lib/rubocop/cop/legion/extension/runner_must_be_module.rb

Overview

Detects ‘class` definitions inside a `Runners` namespace. LEX runners must be modules so actors can call runner methods directly via `include` or `extend self`.

Examples:

# bad
module Runners
  class Foo
  end
end

# good
module Runners
  module Foo
  end
end

Constant Summary collapse

MSG =
'Runners must be modules, not classes. Use `module` for runner definitions.'

Instance Method Summary collapse

Instance Method Details

#on_class(node) ⇒ Object



26
27
28
29
30
# File 'lib/rubocop/cop/legion/extension/runner_must_be_module.rb', line 26

def on_class(node)
  return unless inside_runners_namespace?(node)

  add_offense(node.identifier)
end