Showing 8 of 8 total issues
Class Observer
has 24 methods (exceeds 20 allowed). Consider refactoring. Open
class Observer < GenericDSL
include Safety
# The current state machine
attr_reader :machine
Class StateMachine
has 24 methods (exceeds 20 allowed). Consider refactoring. Open
class StateMachine
include Threadable
include Catchable
extend Forwardable
Method process_events
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def process_events
until @dead
@mutex.synchronize do
while @queue.empty?
@not_empty.wait(@mutex)
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method call
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def call(target, *args, &block)
case object
when Symbol
target.public_send(object.to_sym, *args, &block)
when String
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method call
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def call(transitions)
StateParser.parse(transitions) do |from, to|
transition = Transition.new(@machine.env.target, @name,
@attributes.merge(states: { from => to }))
silent = @attributes.fetch(:silent, false)
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method on
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def on(hook_type, state_or_event_name = nil, async = nil, &callback)
sync_exclusive do
if state_or_event_name.nil?
state_or_event_name = HookEvent.any_state_or_event(hook_type)
end
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method trigger!
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def trigger!(event_name, *data, &block)
from = current # Save away current state
sync_exclusive do
notify HookEvent::Before, event_name, from, *data
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method initialize
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def initialize(*args, &block)
options = args.last.is_a?(::Hash) ? args.pop : {}
@initial_state = DEFAULT_STATE
@auto_methods = options.fetch(:auto_methods, true)
@subscribers = Subscribers.new
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"