Showing 624 of 666 total issues
Avoid too many return
statements within this method. Open
return if super_call_without_arguments?(node)
Avoid too many return
statements within this method. Open
return true if delimiter?(node, escaped[0])
Avoid too many return
statements within this method. Open
return 'an interpolated expression' if interpolation?(begin_node)
Avoid too many return
statements within this method. Open
return unless begin_node.parent.nil?
Avoid too many return
statements within this method. Open
return if allowed_method_name?(dispatch_node.method_name)
Avoid too many return
statements within this method. Open
return if allow_if_method_has_argument?(node.send_node)
Avoid too many return
statements within this method. Open
return if allow_comments? && contains_comments?(node)
Avoid too many return
statements within this method. Open
return if ALLOWED_NODE_TYPES.include?(begin_node.parent&.type)
Avoid too many return
statements within this method. Open
return 'an expression'
Avoid too many return
statements within this method. Open
return if begin_node.parent&.if_type? && begin_node.parent&.ternary?
Avoid too many return
statements within this method. Open
return if node.multiline? && allow_in_multiline_conditions?
Avoid too many return
statements within this method. Open
return if begin_node.chained?
Avoid too many return
statements within this method. Open
return if node.semantic_operator? && begin_node.parent
Avoid too many return
statements within this method. Open
return if node.block_type? && destructuring_block_argument?(arguments_node)
Avoid too many return
statements within this method. Open
return if exist_argument_between_heredoc_end_and_closing_parentheses?(node)
Method summary
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def summary
if @correction_count.positive?
if @correctable_count.positive?
"#{files} inspected, #{offenses} detected, #{corrections} corrected, " \
"#{correctable}"
- 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 iterate_until_no_changes
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def iterate_until_no_changes(source, offenses_by_iteration)
# Keep track of the state of the source. If a cop modifies the source
# and another cop undoes it producing identical source we have an
# infinite loop.
@processed_sources = []
- 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_send
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def on_send(node)
return if node.receiver
return unless (argument = node.arguments[1])
return unless argument.str_type? && argument.value.empty?
- 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 move_pos_str
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def move_pos_str(src, pos, step, condition, needle)
size = needle.length
offset = step == -1 ? -size : 0
pos += size * step while condition && src[pos + offset, size] == needle
pos.negative? ? 0 : pos
- 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_send
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def on_send(node)
return unless gem_declaration?(node)
return if ignored_gem?(node)
return if commented_any_descendant?(node)
return if cop_config[CHECKED_OPTIONS_CONFIG].any? && !checked_options_present?(node)
- 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"