Showing 647 of 687 total issues
Method arguments_identical?
has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring. Open
def arguments_identical?(def_node, def_args, super_args)
super_args = preprocess_super_args(super_args)
return false if def_args.size != super_args.size
def_args.zip(super_args).each do |def_arg, super_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
Class ConfigLoader
has 23 methods (exceeds 20 allowed). Consider refactoring. Open
class ConfigLoader
DOTFILE = ConfigFinder::DOTFILE
RUBOCOP_HOME = File.realpath(File.join(File.dirname(__FILE__), '..', '..'))
DEFAULT_FILE = File.join(RUBOCOP_HOME, 'config', 'default.yml')
Class Next
has 23 methods (exceeds 20 allowed). Consider refactoring. Open
class Next < Base
include ConfigurableEnforcedStyle
include MinBodyLength
include RangeHelp
extend AutoCorrector
Class MultilineMethodCallIndentation
has 23 methods (exceeds 20 allowed). Consider refactoring. Open
class MultilineMethodCallIndentation < Base
include ConfigurableEnforcedStyle
include Alignment
include MultilineExpressionIndentation
extend AutoCorrector
Class DirectiveComment
has 23 methods (exceeds 20 allowed). Consider refactoring. Open
class DirectiveComment
# @api private
LINT_DEPARTMENT = 'Lint'
# @api private
LINT_REDUNDANT_DIRECTIVE_COP = "#{LINT_DEPARTMENT}/RedundantCopDisableDirective"
Class ConfigLoaderResolver
has 22 methods (exceeds 20 allowed). Consider refactoring. Open
class ConfigLoaderResolver # rubocop:disable Metrics/ClassLength
def resolve_requires(path, hash)
config_dir = File.dirname(path)
hash.delete('require').tap do |loaded_features|
Array(loaded_features).each do |feature|
Class TrivialAccessors
has 22 methods (exceeds 20 allowed). Consider refactoring. Open
class TrivialAccessors < Base
include AllowedMethods
extend AutoCorrector
MSG = 'Use `attr_%<kind>s` to define trivial %<kind>s methods.'
Class ArgumentsForwarding
has 22 methods (exceeds 20 allowed). Consider refactoring. Open
class ArgumentsForwarding < Base
include RangeHelp
extend AutoCorrector
extend TargetRubyVersion
Class RedundantSelf
has 22 methods (exceeds 20 allowed). Consider refactoring. Open
class RedundantSelf < Base
extend AutoCorrector
MSG = 'Redundant `self` detected.'
KERNEL_METHODS = Kernel.methods(false)
Class HashAlignment
has 22 methods (exceeds 20 allowed). Consider refactoring. Open
class HashAlignment < Base
include HashAlignmentStyles
include RangeHelp
extend AutoCorrector
Method correct_node
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
def correct_node(corrector, node, offending_name, preferred_name)
return unless node
node.each_node(:lvar, :lvasgn, :masgn) do |child_node|
next unless variable_name_matches?(child_node, offending_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 reference!
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
def reference!(node)
reference = Reference.new(node, @scope)
@references << reference
consumed_branches = nil
- 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
Class Cop
has 21 methods (exceeds 20 allowed). Consider refactoring. Open
class Cop < Base
attr_reader :offenses
exclude_from_registry
Class CaseLikeIf
has 21 methods (exceeds 20 allowed). Consider refactoring. Open
class CaseLikeIf < Base
include RangeHelp
include MinBranchesCount
extend AutoCorrector
Class TernaryParentheses
has 21 methods (exceeds 20 allowed). Consider refactoring. Open
class TernaryParentheses < Base
include SafeAssignment
include ConfigurableEnforcedStyle
include SurroundingSpace
extend AutoCorrector
Class Options
has 21 methods (exceeds 20 allowed). Consider refactoring. Open
class Options
E_STDIN_NO_PATH = '-s/--stdin requires exactly one path, relative to the ' \
'root of the project. RuboCop will use this path to determine which ' \
'cops are enabled (via eg. Include/Exclude), and so that certain cops ' \
'like Naming/FileName can be checked.'
Class VariableForce
has 21 methods (exceeds 20 allowed). Consider refactoring. Open
class VariableForce
# Namespace for branch classes for each control structure.
module Branch
def self.of(target_node, scope: nil)
([target_node] + target_node.ancestors).each do |node|
Class CodeLengthCalculator
has 21 methods (exceeds 20 allowed). Consider refactoring. Open
class CodeLengthCalculator
extend NodePattern::Macros
include Util
FOLDABLE_TYPES = %i[array hash heredoc send csend].freeze
Class Offense
has 21 methods (exceeds 20 allowed). Consider refactoring. Open
class Offense
include Comparable
# @api private
COMPARISON_ATTRIBUTES = %i[line column cop_name message severity].freeze
Method assignment_without_argument_usage
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
def assignment_without_argument_usage(argument)
argument.assignments.reduce(true) do |location_known, assignment|
assignment_node = assignment.meta_assignment_node || assignment.node
# Shorthand assignments always use their 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"