Showing 6 of 6 total issues
Class StateDefinition
has 24 methods (exceeds 20 allowed). Consider refactoring. Open
class StateDefinition
attr_reader :name, :type, :events, :states,
:initial_state, :terminal_state, :parent_state
def initialize name, parent_state = nil, type: :state
Method visit
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def visit state
# binding.pry if state.name == :assigned
@states << state
@initial_states << state if state.initial?
@terminal_states << state if state.terminal?
- 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 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def initialize name, from_state, to_state, conditions={}, &block
Method visit
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def visit state
@states << state
# Create the path of the parent nodes
path = []
- 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 transition
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def transition event_name
event = transitions.find { |t| t.name == event_name }
raise DeepState::Error unless event
return unless event.run?(context)
- 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 parents
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def parents include_root: false
Enumerator.new do |yielder|
# Walk up the parent states, excluding the very root state
p = parent_state
while p
- 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"