Showing 647 of 687 total issues
Method invertible?
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def invertible?(node) # rubocop:disable Metrics/CyclomaticComplexity
case node&.type
when :begin
invertible?(node.children.first)
when :send
- 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_regexp
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def on_regexp(node)
message = if slash_literal?(node)
MSG_USE_PERCENT_R unless allowed_slash_literal?(node)
else
MSG_USE_SLASHES unless allowed_percent_r_literal?(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 each_extra_empty_line
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def each_extra_empty_line(lines)
prev_line = 1
lines.each do |cur_line|
if exceeds_line_offset?(cur_line - prev_line)
- 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 inspect
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def inspect(node, block_argument_node, condition_node, return_value_node, range)
return unless returns_block_argument?(block_argument_node, return_value_node)
return if condition_node.parent.elsif?
method = truthy_branch?(return_value_node) ? 'select' : 'reject'
- 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 calculate
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def calculate
length = code_length(@node)
return length if @foldable_types.empty?
each_top_level_descendant(@node, @foldable_types) do |descendant|
- 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 initialize
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def initialize(severity, location, message, cop_name, # rubocop:disable Metrics/ParameterLists
status = :uncorrected, corrector = nil)
Method method_receiver_excluded?
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def method_receiver_excluded?(node)
node_receiver = node.receiver&.source&.gsub(/\s+/, '')
node_method = String(node.method_name)
allowed_methods.any? do |config|
- 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 file
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def file
return cache_path unless cache_path_expired?
request do |response|
next if response.is_a?(Net::HTTPNotModified)
- 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_additional_modes
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def add_additional_modes(opts)
section(opts, 'Additional Modes') do
option(opts, '-L', '--list-target-files')
option(opts, '--show-cops [COP1,COP2,...]') do |list|
@options[:show_cops] = list.nil? ? [] : list.split(',')
- 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 fix_include_paths
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def fix_include_paths(base_config_path, hash, path, key, value)
Method initialize
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def initialize(file, team, options, config_store, cache_root = nil)
Method move_pos
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def move_pos(src, pos, step, condition, regexp)
Method autocorrect
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def autocorrect(corrector, node, range, offending_name, preferred_name)
Method check
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def check(node, items, kind, begin_pos, end_pos)
Method move_pos_str
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def move_pos_str(src, pos, step, condition, needle)
Method space_offense
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def space_offense(node, token, side, message, command)
Method initialize
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
file_count, offense_count, correction_count, correctable_count, rainbow,
safe_autocorrect: false
Method autocorrect
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def autocorrect(corrector, node, condition, replacement, guard)
Method autocorrect_heredoc_argument
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def autocorrect_heredoc_argument(corrector, node, heredoc_branch, leave_branch, guard)
Method initialize
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def initialize(def_node, send_node, referenced_lvars, forwardable_args, **config)