Showing 687 of 687 total issues
Method gem_config_path
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def gem_config_path(gem_name, relative_config_path)
if defined?(Bundler)
begin
gem = Bundler.load.specs[gem_name].first
gem_path = gem.full_gem_path if gem
- 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 cache_root_dir_from_config
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def cache_root_dir_from_config
CacheConfig.root_dir do
# `RuboCop::ConfigStore` has heavy dependencies, this is a lightweight implementation
# so that only the necessary `CacheRootDirectory` can be obtained.
config_path = ConfigFinder.find_config_path(Dir.pwd)
- 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_excludes_from_higher_level
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def add_excludes_from_higher_level(highest_config)
return unless highest_config.for_all_cops['Exclude']
excludes = for_all_cops['Exclude'] ||= []
highest_config.for_all_cops['Exclude'].each do |path|
- 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 10 (exceeds 5 allowed). Consider refactoring. Open
def on_new_investigation
processed_source.diagnostics.each do |diagnostic|
if target_ruby_version >= 3.0
next unless diagnostic.reason == :ambiguous_regexp
else
- 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 10 (exceeds 5 allowed). Consider refactoring. Open
def on_if(node)
return unless if_else?(node)
return unless (condition = unwrap_begin_nodes(node.condition))
return if double_negation?(condition) || !negated_condition?(condition)
- 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 range_size
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def range_size(range_node)
vals = range_node.to_a
return :unknown unless vals.all? { |val| val.nil? || val.int_type? }
low, high = vals.map { |val| val.nil? ? 0 : val.children[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"
Further reading
Method preferred_method
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def preferred_method(operator, lhs, rhs, if_branch, else_branch)
if lhs == if_branch && rhs == else_branch
GRATER_OPERATORS.include?(operator) ? 'max' : 'min'
elsif lhs == else_branch && rhs == if_branch
LESS_OPERATORS.include?(operator) ? 'max' : 'min'
- 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_super
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def on_super(super_node)
def_node = super_node.ancestors.find do |node|
# When defining dynamic methods, implicitly calling `super` is not possible.
# Since there is a possibility of delegation to `define_method`,
# `super` used within the block is always allowed.
- 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 argument_newline?
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def argument_newline?(node)
node = node.to_a.last if node.assignment?
return false if node.parenthesized_call?
node = node.children.first if node.root? && node.begin_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 on_new_investigation
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def on_new_investigation
processed_source.comments.each_with_index do |comment, index|
next unless first_comment_line?(processed_source.comments, index) ||
inline_comment?(comment)
- 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 omit_parentheses
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def omit_parentheses(node) # rubocop:disable Metrics/PerceivedComplexity
return unless node.parenthesized?
return if inside_endless_method_def?(node)
return if require_parentheses_for_hash_value_omission?(node)
return if syntax_like_method_call?(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 10 (exceeds 5 allowed). Consider refactoring. Open
def on_send(node)
return unless node.receiver
style_check?(node) do
add_offense(node.loc.selector) do |corrector|
- 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_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 class_name
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def class_name(class_node, node)
if class_name_method?(node.children.first.method_name)
if (receiver = class_node.receiver) && class_name_method?(class_node.method_name)
return receiver.source
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 10 (exceeds 5 allowed). Consider refactoring. Open
def on_send(node)
return if node.arguments?
return unless (receiver = node.receiver)
return unless receiver.dstr_type?
return if uninterpolated_string?(receiver) || uninterpolated_heredoc?(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 single_argument
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def single_argument(node)
first_argument = node.first_argument
if first_argument.hash_type?
register_offense_for_hash(node, first_argument)
elsif first_argument.splat_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 on_module
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def on_module(node)
return unless node.body&.begin_type?
each_wrong_style(node.body.children) do |child_node|
add_offense(child_node) do |corrector|
- 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 10 (exceeds 5 allowed). Consider refactoring. Open
def on_block(node)
each_with_object_block_candidate?(node) do |method, args, body|
_, method_name, method_arg = *method
return if simple_method_arg?(method_arg)
- 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 10 (exceeds 5 allowed). Consider refactoring. Open
def on_send(node)
inverse_candidate?(node) do |method_call, lhs, method, rhs|
return unless inverse_methods.key?(method)
return if negated?(node) || relational_comparison_with_safe_navigation?(method_call)
return if part_of_ignored_node?(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 10 (exceeds 5 allowed). Consider refactoring. Open
def on_send(node)
map_candidate = node.children.first
if (block_argument, condition, return_value = conditional_block(map_candidate))
return unless node.method?(:compact) && node.arguments.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"