Method unclosed_tokens_in_line_range
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
def unclosed_tokens_in_line_range(line_range)
tokens = FlatMap.flat_map(line_range) do |line_number|
source.tokens_by_line_number[line_number]
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"
Further reading
Method expression_lines
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
def expression_lines
line_range = line_range_of_expression
if max_line_count && line_range.count > max_line_count
line_range = (line_range.begin)..(line_range.begin + max_line_count - 1)
- 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 expression_outmost_node?
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
def expression_outmost_node?(node)
return true unless node.parent
return false if node.type.to_s.start_with?('@')
![node, node.parent].all? do |n|
# See `Ripper::PARSER_EVENTS` for the complete list of sexp types.
- 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"