Method before
has a Cognitive Complexity of 31 (exceeds 5 allowed). Consider refactoring. Open
def before(complete = true, index = 0, &block)
unless @before_run
while callback = machine.callbacks[:before][index]
index += 1
- 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
Class Transition
has 30 methods (exceeds 20 allowed). Consider refactoring. Open
class Transition
# The object being transitioned
attr_reader :object
# The state machine for which this transition is defined
Method after
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def after
unless @after_run
# First resume previously paused callbacks
if resume
catch(:halt) do
- 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
Avoid deeply nested control flow statements. Open
throw :cancel, true unless @success
Method initialize
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def initialize(object, machine, event, from_name, to_name, read_state = true) #:nodoc:
Avoid deeply nested control flow statements. Open
pause if @success && !complete
Method pause
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def pause
raise ArgumentError, 'around_transition callbacks cannot be called in multiple execution contexts in java implementations of Ruby. Use before/after_transitions instead.' unless self.class.pause_supported?
unless @resume_block
require 'continuation' unless defined?(callcc)
- 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 pausable
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def pausable
begin
halted = !catch(:halt) { yield; true }
rescue => error
raise unless @resume_block
- 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"