Showing 687 of 687 total issues
Method load
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def load
# Don't use `::Kernel.require(target)` to prevent the following error:
# https://github.com/rubocop/rubocop/issues/10893
require(target)
rescue ::LoadError => e
- 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 mark_assignments_as_referenced_in_loop
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def mark_assignments_as_referenced_in_loop(node)
referenced_variable_names_in_loop, assignment_nodes_in_loop = find_variables_in_loop(node)
referenced_variable_names_in_loop.each do |name|
variable = variable_table.find_variable(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_and
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def on_and(node)
all_operands = collect_operands(node, [])
operand_groups = all_operands.group_by { |operand| receiver_name_as_key(operand, +'') }
operand_groups.each_value do |grouped_operands|
- 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 process_multiple_assignment
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def process_multiple_assignment(masgn_node)
masgn_node.assignments.each_with_index do |lhs_node, index|
next unless ASSIGNMENT_TYPES.include?(lhs_node.type)
if masgn_node.rhs.array_type? && (rhs_node = masgn_node.rhs.children[index])
- 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_var
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def check_var(node)
return unless node.variable? || node.const_type?
if node.const_type?
template = node.special_keyword? ? VAR_MSG : CONST_MSG
- 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 register_offense
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def register_offense(node, scope_exiting_keyword, conditional_keyword, guard = nil)
condition, = node.node_parts
example = [scope_exiting_keyword, conditional_keyword, condition.source].join(' ')
if too_long_for_single_line?(node, example)
return if trivial?(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 on_new_investigation
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def on_new_investigation
processed_source.diagnostics.each do |diagnostic|
next unless diagnostic.reason == :ambiguous_prefix
offense_node = find_offense_node_by(diagnostic)
- 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 8 (exceeds 5 allowed). Consider refactoring. Open
def on_send(node)
return unless (receiver = node.receiver)
return unless receiver.receiver&.const_type? && receiver.receiver.short_name == :Dir
return unless GLOB_METHODS.include?(receiver.method_name)
return if multiple_argument?(receiver)
- 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 8 (exceeds 5 allowed). Consider refactoring. Open
def on_send(node)
return unless (regexp_node = node.first_argument)
return unless regexp_node.regexp_type?
return if !regexp_node.regopt.children.empty? || regexp_node.content == ' '
return unless determinist_regexp?(regexp_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 on_send
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def on_send(node)
read, write, excepts, timeout = *io_select(node)
return if excepts && !excepts.children.empty?
return unless scheduler_compatible?(read, write) || scheduler_compatible?(write, read)
- 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_block_pass
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def on_block_pass(node)
return if target_ruby_version >= 3.0
return unless method_require?(node)
return unless unsorted_dir_pass?(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 on_if
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def on_if(node)
traverse_node(node.condition) do |asgn_node|
next unless asgn_node.loc.operator
rhs = asgn_node.rhs
- 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_percent_literal
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def on_percent_literal(node)
return unless contains_quotes_or_commas?(node)
add_offense(node) do |corrector|
node.each_value do |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 on_dstr
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def on_dstr(node)
each_bad_cons(node) do |lhs_node, rhs_node|
range = lhs_node.source_range.join(rhs_node.source_range)
message = format(MSG, lhs: display_str(lhs_node), rhs: display_str(rhs_node))
if node.parent&.array_type?
- 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 handle_conversion_method
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def handle_conversion_method(node)
to_method(node) do |receiver, to_method|
next if receiver.nil? || allow_receiver?(receiver)
message = format(
- 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 8 (exceeds 5 allowed). Consider refactoring. Open
def on_send(node)
return unless node.receiver
expression = single_argument_dig?(node)
return unless 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 autocorrect
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def autocorrect(corrector, node, condition, replacement, guard)
corrector.replace(node.loc.keyword.join(condition.source_range), replacement)
if_branch = node.if_branch
else_branch = node.else_branch
- 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_csend
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def on_csend(node)
unless assume_receiver_instance_exists?(node.receiver)
return unless check?(node) && allowed_method?(node.method_name)
return if respond_to_nil_specific_method?(node)
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 on_send
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def on_send(node)
erb_new_with_non_keyword_arguments(node) do |arguments|
return if arguments.empty? || correct_arguments?(arguments)
arguments[1..3].each_with_index do |argument, i|
- 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_block
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def on_block(node)
return if target_ruby_version >= 3.0
return unless node.body
return unless unsorted_dir_loop?(node.send_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"