Method next_states
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def next_states(*states)
if states.any?
if states.include? :none
@final = true
else
- 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 validate_transition
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def validate_transition
raise Control::NoAssociationToWorkflow unless is_part_of_workflow?
raise Control::WorkflowDisabled unless workflow.enabled
raise Control::InvalidTransition unless workflow_initial_state_or_valid_next_state
raise Control::FinalState if current_state_is_final?
- 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 workflow_class
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def workflow_class
unless @workflow_class
reflect_on_all_associations.each do |a|
klass = a.klass
@workflow_class = klass if klass.respond_to?(:is_workflow?) && klass.is_workflow?
- 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"