rubocop-hq/rubocop

View on GitHub

Showing 652 of 652 total issues

Method on_block has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
Open

        def on_block(node)
          symbol_proc?(node) do |dispatch_node, arguments_node, method_name|
            # TODO: Rails-specific handling that we should probably make
            # configurable - https://github.com/rubocop/rubocop/issues/1485
            # we should allow lambdas & procs
Severity: Minor
Found in lib/rubocop/cop/style/symbol_proc.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

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

    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|
    Severity: Minor
    Found in lib/rubocop/config_loader_resolver.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 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))'
        Severity: Minor
        Found in lib/rubocop/cop/style/arguments_forwarding.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 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 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 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 ArgumentsForwarding has 21 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 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 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

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

                          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

                          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
                          
                          
                          Severity: Minor
                          Found in lib/rubocop/cop/naming/file_name.rb - About 1 hr 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 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)
                          
                          
                          Severity: Minor
                          Found in lib/rubocop/cop/style/return_nil.rb - About 1 hr 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 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)
                          Severity: Minor
                          Found in lib/rubocop/cop/lint/non_local_exit_from_iterator.rb - About 1 hr 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 shadowing_assignment has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
                          Open

                                  def shadowing_assignment(argument)
                                    return unless argument.referenced?
                          
                                    assignment_without_argument_usage(argument) do |node, location_known|
                                      assignment_without_usage_pos = node.source_range.begin_pos
                          Severity: Minor
                          Found in lib/rubocop/cop/lint/shadowed_argument.rb - About 1 hr 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 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
                          Severity: Minor
                          Found in lib/rubocop/cop/lint/struct_new_override.rb - About 1 hr 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