bbatsov/rubocop

View on GitHub

Showing 687 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|
Severity: Minor
Found in lib/rubocop/cop/style/super_arguments.rb - About 2 hrs to fix

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')

Severity: Minor
Found in lib/rubocop/config_loader.rb - About 2 hrs to fix

    Class Next has 23 methods (exceeds 20 allowed). Consider refactoring.
    Open

          class Next < Base
            include ConfigurableEnforcedStyle
            include MinBodyLength
            include RangeHelp
            extend AutoCorrector
    Severity: Minor
    Found in lib/rubocop/cop/style/next.rb - About 2 hrs to fix

      Class MultilineMethodCallIndentation has 23 methods (exceeds 20 allowed). Consider refactoring.
      Open

            class MultilineMethodCallIndentation < Base
              include ConfigurableEnforcedStyle
              include Alignment
              include MultilineExpressionIndentation
              extend AutoCorrector
      Severity: Minor
      Found in lib/rubocop/cop/layout/multiline_method_call_indentation.rb - About 2 hrs to fix

        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"
        Severity: Minor
        Found in lib/rubocop/directive_comment.rb - About 2 hrs to fix

          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|
          Severity: Minor
          Found in lib/rubocop/config_loader_resolver.rb - About 2 hrs to fix

            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.'
            Severity: Minor
            Found in lib/rubocop/cop/style/trivial_accessors.rb - About 2 hrs to fix

              Class ArgumentsForwarding has 22 methods (exceeds 20 allowed). Consider refactoring.
              Open

                    class ArgumentsForwarding < Base
                      include RangeHelp
                      extend AutoCorrector
                      extend TargetRubyVersion
              
              
              Severity: Minor
              Found in lib/rubocop/cop/style/arguments_forwarding.rb - About 2 hrs to fix

                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)
                Severity: Minor
                Found in lib/rubocop/cop/style/redundant_self.rb - About 2 hrs to fix

                  Class HashAlignment has 22 methods (exceeds 20 allowed). Consider refactoring.
                  Open

                        class HashAlignment < Base
                          include HashAlignmentStyles
                          include RangeHelp
                          extend AutoCorrector
                  
                  
                  Severity: Minor
                  Found in lib/rubocop/cop/layout/hash_alignment.rb - About 2 hrs to fix

                    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)
                    Severity: Minor
                    Found in lib/rubocop/cop/naming/rescued_exceptions_variable_name.rb - About 2 hrs to fix

                    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
                    
                    
                    Severity: Minor
                    Found in lib/rubocop/cop/variable_force/variable.rb - About 2 hrs to fix

                    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
                    
                    
                    Severity: Minor
                    Found in lib/rubocop/cop/cop.rb - About 2 hrs to fix

                      Class CaseLikeIf has 21 methods (exceeds 20 allowed). Consider refactoring.
                      Open

                            class CaseLikeIf < Base
                              include RangeHelp
                              include MinBranchesCount
                              extend AutoCorrector
                      
                      
                      Severity: Minor
                      Found in lib/rubocop/cop/style/case_like_if.rb - About 2 hrs to fix

                        Class TernaryParentheses has 21 methods (exceeds 20 allowed). Consider refactoring.
                        Open

                              class TernaryParentheses < Base
                                include SafeAssignment
                                include ConfigurableEnforcedStyle
                                include SurroundingSpace
                                extend AutoCorrector
                        Severity: Minor
                        Found in lib/rubocop/cop/style/ternary_parentheses.rb - About 2 hrs to fix

                          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.'
                          Severity: Minor
                          Found in lib/rubocop/options.rb - About 2 hrs to fix

                            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|
                            Severity: Minor
                            Found in lib/rubocop/cop/variable_force/branch.rb - About 2 hrs to fix

                              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
                              Severity: Minor
                              Found in lib/rubocop/cop/metrics/utils/code_length_calculator.rb - About 2 hrs to fix

                                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
                                Severity: Minor
                                Found in lib/rubocop/cop/offense.rb - About 2 hrs to fix

                                  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
                                  Severity: Minor
                                  Found in lib/rubocop/cop/lint/shadowed_argument.rb - About 2 hrs to fix

                                  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

                                  Severity
                                  Category
                                  Status
                                  Source
                                  Language