Class: RuboCop::Cop::Legion::Extension::ActorSingularModule
- Inherits:
-
Base
- Object
- Base
- RuboCop::Cop::Legion::Extension::ActorSingularModule
- Extended by:
- AutoCorrector
- Defined in:
- lib/rubocop/cop/legion/extension/actor_singular_module.rb
Overview
Detects ‘module Actors` (plural) inside `Legion::Extensions::*` namespaces and auto-corrects it to `module Actor` (singular), which is what the LEX framework uses when discovering actor classes.
Constant Summary collapse
- MSG =
'Use `module Actor` (singular), not `module Actors`. ' \ 'The framework discovers actors inside `Actor`.'
Instance Method Summary collapse
Instance Method Details
#on_module(node) ⇒ Object
29 30 31 32 33 34 35 36 37 38 |
# File 'lib/rubocop/cop/legion/extension/actor_singular_module.rb', line 29 def on_module(node) name_node = node.identifier return unless name_node.short_name == :Actors return unless inside_legion_extensions_namespace?(node) add_offense(name_node) do |corrector| corrector.replace(name_node.loc.name, 'Actor') end end |