app/models/setup/flow_execution.rb
Method run
has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring. Open
Open
def run(message)
if (flow = agent_from_msg)
if flow.active
unless (execution_graph = message[:execution_graph])
execution_graph = message[:execution_graph] = {}
- 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 run
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
def run(message)
if (flow = agent_from_msg)
if flow.active
unless (execution_graph = message[:execution_graph])
execution_graph = message[:execution_graph] = {}
Avoid deeply nested control flow statements. Open
Open
if scheduler
notify(
message: "Detached from scheduler #{scheduler.custom_title} due to overflow cyclic executions",
type: :warning
)
Method cyclic_execution
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
Open
def cyclic_execution(execution_graph, start_id, cycle = [])
if cycle.include?(start_id)
cycle << start_id
return cycle
elsif (adjacency_list = execution_graph[start_id])
- 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"