Class: RuboCop::Cop::Legion::Extension::ActorInheritance
- Inherits:
-
Base
- Object
- Base
- RuboCop::Cop::Legion::Extension::ActorInheritance
- Defined in:
- lib/rubocop/cop/legion/extension/actor_inheritance.rb
Overview
Detects actor classes inside an ‘Actor` namespace that do not inherit from a recognized LEX actor base class. Every actor must inherit from one of: `Every`, `Once`, `Poll`, `Subscription`, `Loop`, or `Nothing`.
Constant Summary collapse
- MSG =
'Actor must inherit from a recognized base: Every, Once, Poll, Subscription, Loop, or Nothing.'- RECOGNIZED_BASES =
%i[Every Once Poll Subscription Loop Nothing].to_set.freeze
Instance Method Summary collapse
Instance Method Details
#on_class(node) ⇒ Object
34 35 36 37 38 39 40 41 |
# File 'lib/rubocop/cop/legion/extension/actor_inheritance.rb', line 34 def on_class(node) return unless inside_actor_namespace?(node) superclass = node.parent_class return if superclass && recognized_base?(superclass) add_offense(node.identifier) end |