Showing 647 of 687 total issues
Method each_argument_node
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def each_argument_node(node, type)
left_parenthesis = node.loc.begin
return unless left_parenthesis
- 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"
Further reading
Method part_of_ignored_node?
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def part_of_ignored_node?(node)
ignored_nodes.map(&:loc).any? do |ignored_loc|
next false if ignored_loc.expression.begin_pos > node.source_range.begin_pos
ignored_end_pos = if ignored_loc.respond_to?(:heredoc_body)
- 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 each_bad_alignment
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def each_bad_alignment(items, base_column)
prev_line = -1
items.each do |current|
if current.loc.line > prev_line && begins_its_line?(current.source_range)
@column_delta = base_column - display_column(current.source_range)
- 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 find_ancestor_method_dispatch_node
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def find_ancestor_method_dispatch_node(node)
return unless (ancestor = node.parent.parent)
return unless ancestor.call_type? || ancestor.super_type? || ancestor.yield_type?
return if brackets?(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 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 add_newline?
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def add_newline?(node)
# Determine if a blank line should be inserted before the new directive
# in order to spread out pattern matchers
return false if node.sibling_index&.zero?
return false unless node.parent
- 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 last_line_heredoc?
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def last_line_heredoc?(node, parent = nil)
parent ||= node
if node.respond_to?(:loc) &&
node.loc.respond_to?(:heredoc_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 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"
Further reading
Method run_command
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def run_command(server_command, detach:)
case server_command
when '--server'
Server::ClientCommand::Start.new(detach: detach).run unless Server.running?
when '--no-server'
- 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 group_comments
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def group_comments(comments)
result = []
comments.each.with_index do |comment, index|
# Grab the scope directive if it is preceded by a method directive
if comment.text.include?('@!method')
- 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_defined?
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def on_defined?(node)
arg = node.first_argument
return false unless arg.ivar_type?
method_node, method_name = find_definition(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"
Further reading
Method elements
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def elements(node)
return node.children unless node.call_type?
node.arguments.flat_map do |argument|
# For each argument, if it is a multi-line hash without braces,
- 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 list_unknown_cops
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def list_unknown_cops(invalid_cop_names)
unknown_cops = []
invalid_cop_names.each do |name|
# There could be a custom cop with this name. If so, don't warn
next if Cop::Registry.global.contains_cop_matching?([name])
- 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 extract_breakable_node
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def extract_breakable_node(node, max)
if node.send_type?
return if chained_to_heredoc?(node)
args = process_args(node.arguments)
- 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)
if (name = alias_method?(node))
return if node.ancestors.any?(&:if_type?)
return if possible_dsl?(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"
Further reading
Method check_nonmutating
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def check_nonmutating(node)
return if !node.send_type? && !node.block_type? && !node.numblock_type?
method_name = node.method_name
return unless NONMUTATING_METHODS.include?(method_name)
- 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 (required_feature = node.first_argument)
return unless required_feature.respond_to?(:value)
return unless same_file?(processed_source.file_path, required_feature.value)
- 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 find_target
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def find_target(node)
case node.type
when :begin
find_target(node.children.first)
when :or
- 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 check
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def check(node)
return unless node.else_branch
if node.else? && node.loc.else.is?('else')
check_else(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"