Method argument_in_method_call
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def argument_in_method_call(node, kind) # rubocop:todo Metrics/CyclomaticComplexity
node.each_ancestor(:send, :block).find do |a|
# If the node is inside a block, it makes no difference if that block
# is an argument in a method call. It doesn't count.
break false if a.block_type?
- 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 part_of_assignment_rhs
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def part_of_assignment_rhs(node, candidate)
rhs_node = node.each_ancestor.find do |ancestor|
break if disqualified_rhs?(candidate, ancestor)
valid_rhs?(candidate, ancestor)
- 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 kw_node_with_special_indentation
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def kw_node_with_special_indentation(node)
keyword_node =
node.each_ancestor(*KEYWORD_ANCESTOR_TYPES).find do |ancestor|
next if ancestor.if_type? && ancestor.ternary?
- 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"