lib/transpec/syntax/should_receive.rb
Method block_node_taken_by_with_method_with_no_normal_args
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
Open
def block_node_taken_by_with_method_with_no_normal_args
each_backward_chained_node(node, :child_as_second_arg) do |chained_node, child_node|
next unless chained_node.block_type?
return nil unless child_node.children[1] == :with
return nil if child_node.children[2]
- 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 block_node_followed_by_fluent_method
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
Open
def block_node_followed_by_fluent_method
each_backward_chained_node(node, :child_as_second_arg) do |chained_node, child_node|
next unless chained_node.send_type?
return child_node if child_node.block_type?
end
- 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"