Showing 672 of 672 total issues
Method build_cipher_arguments
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def build_cipher_arguments(node, algorithm_name, no_arguments)
algorithm_parts = algorithm_name.downcase.split('-')
size_and_mode = sanitize_arguments(node.arguments).map(&:downcase)
if NO_ARG_ALGORITHM.include?(algorithm_parts.first.upcase) && no_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 useless?
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def useless?(operation, number)
if number.zero?
true if %i[+ -].include?(operation)
elsif number == 1
true if %i[* / **].include?(operation)
- 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 compare_between_object_id_by_double_equal?(node)
add_offense(node) do |corrector|
receiver = node.receiver.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 only_reraising?
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def only_reraising?(resbody_node)
return false if use_exception_variable_in_ensure?(resbody_node)
body = resbody_node.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 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 on_block
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def on_block(node) # rubocop:disable InternalAffairs/NumblockHandler
redundant_fetch_block_candidate?(node) do |send, body|
return if should_not_check?(send, body)
range = fetch_range(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"
Further reading
Method on_def
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def on_def(node)
return unless node.body
last_expr = last_expression(node.body)
return unless setter_call_to_local_variable?(last_expr)
- 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 scheduler_compatible?
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def scheduler_compatible?(io1, io2)
return false unless io1&.array_type? && io1.values.size == 1
io2&.array_type? ? io2.values.empty? : (io2.nil? || io2.nil_type?)
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 find_offense_node
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def find_offense_node(node, regexp_receiver)
return node if first_argument_is_regexp?(node) || !node.parent
if (node.parent.send_type? && node.receiver) ||
method_chain_to_regexp_receiver?(node, regexp_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 correct_inconsistent_hash_keys
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def correct_inconsistent_hash_keys(keys)
keys.each do |key|
ignore_node(key)
next if requires_quotes?(key)
- 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_argument
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def preferred_argument(regexp_node)
new_argument = replacement(regexp_node)
if new_argument.include?('"')
new_argument.gsub!("'", "\\\\'")
- 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_else
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def check_else(node)
else_branch = node.else_branch
first_else = else_branch.begin_type? ? else_branch.children.first : else_branch
return unless first_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 yielding_arguments?
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def yielding_arguments?(block_args, yield_args)
yield_args = yield_args.dup.fill(
nil,
yield_args.length, block_args.length - yield_args.length
)
- 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 condition_as_parenthesized_one_line_pattern_matching?
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def condition_as_parenthesized_one_line_pattern_matching?(condition)
return false unless condition.parenthesized_call?
return false unless (first_child = condition.children.first)
if target_ruby_version >= 3.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 wrap_condition
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def wrap_condition(corrector, condition)
# Handle `send` and `block` nodes that need to be wrapped in parens
# FIXME: autocorrection prevents syntax errors by wrapping the entire node in parens,
# but wrapping the argument list would be a more ergonomic correction.
node_to_check = condition&.block_type? ? condition.send_node : 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 collect_conditions
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def collect_conditions(node, target, conditions)
condition =
case node.type
when :begin
return collect_conditions(node.children.first, target, conditions)
- 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_nth_ref
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def on_nth_ref(node)
backref, = *node
return if @valid_ref.nil? || backref <= @valid_ref
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 6 (exceeds 5 allowed). Consider refactoring. Open
def on_send(node)
uri_escape_unescape?(node) do |top_level, obsolete_method|
replacements = if %i[escape encode].include?(obsolete_method)
ALTERNATE_METHODS_OF_URI_ESCAPE
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 correct_not
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def correct_not(node, receiver, corrector)
if node.prefix_bang?
return unless receiver.send_type?
correct_send(receiver, 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"