Method register_semicolon
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def register_semicolon(line, column, after_expression, token_before_semicolon = nil)
range = source_range(processed_source.buffer, line, column)
add_offense(range) do |corrector|
if after_expression
- 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 on_begin
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def on_begin(node)
return if cop_config['AllowAsExpressionSeparator']
return unless node.source.include?(';')
exprs = node.children
- 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 semicolon_position
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def semicolon_position(tokens)
if tokens.last.semicolon?
-1
elsif tokens.first.semicolon?
0
- 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"