Showing 623 of 665 total issues
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"
File cops_documentation_generator.rb
has 267 lines of code (exceeds 250 allowed). Consider refactoring. Open
require 'fileutils'
# Class for generating documentation of all cops departments
# @api private
class CopsDocumentationGenerator # rubocop:disable Metrics/ClassLength
Class ConfigLoaderResolver
has 22 methods (exceeds 20 allowed). Consider refactoring. Open
class ConfigLoaderResolver
def resolve_requires(path, hash)
config_dir = File.dirname(path)
hash.delete('require').tap do |loaded_features|
Array(loaded_features).each do |feature|
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 SendNodeClassifier
has 22 methods (exceeds 20 allowed). Consider refactoring. Open
class SendNodeClassifier
extend NodePattern::Macros
# @!method forwarded_rest_arg?(node, rest_name)
def_node_matcher :forwarded_rest_arg?, '(splat (lvar %1))'
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 HashAlignment
has 22 methods (exceeds 20 allowed). Consider refactoring. Open
class HashAlignment < Base
include HashAlignmentStyles
include RangeHelp
extend AutoCorrector
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 CaseLikeIf
has 21 methods (exceeds 20 allowed). Consider refactoring. Open
class CaseLikeIf < Base
include RangeHelp
include MinBranchesCount
extend AutoCorrector
Class ArgumentsForwarding
has 21 methods (exceeds 20 allowed). Consider refactoring. Open
class ArgumentsForwarding < Base
include RangeHelp
extend AutoCorrector
extend TargetRubyVersion
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
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 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.'
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"
Further reading
Method find_class_or_module
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
def find_class_or_module(node, namespace)
return nil unless node
name = namespace.pop
- 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_return
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
def on_return(node)
# Check Lint/NonLocalExitFromIterator first before this cop
node.each_ancestor(:block, :def, :defs) do |n|
break if scoped_node?(n)
- 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_return
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
def on_return(return_node)
return if return_value?(return_node)
return_node.each_ancestor(:block, :def, :defs) do |node|
break if scoped_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 14 (exceeds 5 allowed). Consider refactoring. Open
def on_send(node)
return unless struct_new(node)
node.arguments.each_with_index do |arg, index|
# Ignore if the first argument is a class 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"