bbatsov/rubocop

View on GitHub

Showing 647 of 687 total issues

File base.rb has 303 lines of code (exceeds 250 allowed). Consider refactoring.
Open

module RuboCop
  module Cop
    # A scaffold for concrete cops.
    #
    # The Cop::Base class is meant to be extended.
Severity: Minor
Found in lib/rubocop/cop/base.rb - About 3 hrs to fix

    Class IfUnlessModifier has 27 methods (exceeds 20 allowed). Consider refactoring.
    Open

          class IfUnlessModifier < Base
            include StatementModifier
            include LineLengthHelp
            include AllowedPattern
            include RangeHelp
    Severity: Minor
    Found in lib/rubocop/cop/style/if_unless_modifier.rb - About 3 hrs to fix

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

              def on_block(node)
                symbol_proc?(node) do |dispatch_node, arguments_node, method_name|
                  if active_support_extensions_enabled?
                    return if proc_node?(dispatch_node)
                    return if LAMBDA_OR_PROC.include?(dispatch_node.method_name)
      Severity: Minor
      Found in lib/rubocop/cop/style/symbol_proc.rb - About 3 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 RedundantCondition has 26 methods (exceeds 20 allowed). Consider refactoring.
      Open

            class RedundantCondition < Base
              include CommentsHelp
              include RangeHelp
              extend AutoCorrector
      
      
      Severity: Minor
      Found in lib/rubocop/cop/style/redundant_condition.rb - About 3 hrs to fix

        Class SafeNavigation has 26 methods (exceeds 20 allowed). Consider refactoring.
        Open

              class SafeNavigation < Base # rubocop:disable Metrics/ClassLength
                include NilMethods
                include RangeHelp
                extend AutoCorrector
                extend TargetRubyVersion
        Severity: Minor
        Found in lib/rubocop/cop/style/safe_navigation.rb - About 3 hrs to fix

          Class SpaceAroundOperators has 26 methods (exceeds 20 allowed). Consider refactoring.
          Open

                class SpaceAroundOperators < Base
                  include PrecedingFollowingAlignment
                  include RangeHelp
                  include RationalLiteral
                  extend AutoCorrector
          Severity: Minor
          Found in lib/rubocop/cop/layout/space_around_operators.rb - About 3 hrs to fix

            Class Team has 26 methods (exceeds 20 allowed). Consider refactoring.
            Open

                class Team
                  # @return [Team]
                  def self.new(cop_or_classes, config, options = {})
                    # Support v0 api:
                    if cop_or_classes.first.is_a?(Class)
            Severity: Minor
            Found in lib/rubocop/cop/team.rb - About 3 hrs to fix

              Class EmptyLineBetweenDefs has 26 methods (exceeds 20 allowed). Consider refactoring.
              Open

                    class EmptyLineBetweenDefs < Base
                      include RangeHelp
                      extend AutoCorrector
              
                      MSG = 'Expected %<expected>s between %<type>s definitions; found %<actual>d.'
              Severity: Minor
              Found in lib/rubocop/cop/layout/empty_line_between_defs.rb - About 3 hrs to fix

                Class TargetFinder has 26 methods (exceeds 20 allowed). Consider refactoring.
                Open

                  class TargetFinder
                    HIDDEN_PATH_SUBSTRING = "#{File::SEPARATOR}."
                
                    def initialize(config_store, options = {})
                      @config_store = config_store
                Severity: Minor
                Found in lib/rubocop/target_finder.rb - About 3 hrs to fix

                  File cops_documentation_generator.rb has 290 lines of code (exceeds 250 allowed). Consider refactoring.
                  Open

                  require 'fileutils'
                  require 'yard'
                  
                  # Class for generating documentation of all cops departments
                  # @api private
                  Severity: Minor
                  Found in lib/rubocop/cops_documentation_generator.rb - About 2 hrs to fix

                    Method find_previous_older_sibling has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
                    Open

                            def find_previous_older_sibling(node) # rubocop:disable Metrics
                              search_node(node).left_siblings.reverse.find do |sibling|
                                next unless sibling.is_a?(AST::Node)
                    
                                sibling = sibling_node(sibling)
                    Severity: Minor
                    Found in lib/rubocop/cop/style/require_order.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 LineLength has 25 methods (exceeds 20 allowed). Consider refactoring.
                    Open

                          class LineLength < Base
                            include CheckLineBreakable
                            include AllowedPattern
                            include RangeHelp
                            include LineLengthHelp
                    Severity: Minor
                    Found in lib/rubocop/cop/layout/line_length.rb - About 2 hrs to fix

                      Method on_new_investigation has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
                      Open

                              def on_new_investigation # rubocop:disable Metrics/AbcSize, Metrics/CyclomaticComplexity, Metrics/PerceivedComplexity
                                processed_source.comments.each do |comment|
                                  next unless /\A(?!#\+\+|#--)(#+[^#\s=])/.match?(comment.text)
                                  next if comment.loc.line == 1 && allowed_on_first_line?(comment)
                                  next if doxygen_comment_style?(comment)
                      Severity: Minor
                      Found in lib/rubocop/cop/layout/leading_comment_space.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 InclusiveLanguage has 24 methods (exceeds 20 allowed). Consider refactoring.
                      Open

                            class InclusiveLanguage < Base
                              include RangeHelp
                              extend AutoCorrector
                      
                              EMPTY_ARRAY = [].freeze
                      Severity: Minor
                      Found in lib/rubocop/cop/naming/inclusive_language.rb - About 2 hrs to fix

                        Class Changelog has 24 methods (exceeds 20 allowed). Consider refactoring.
                        Open

                        class Changelog
                          ENTRIES_PATH = 'changelog/'
                          FIRST_HEADER = /#{Regexp.escape("## master (unreleased)\n")}/m.freeze
                          ENTRIES_PATH_TEMPLATE = "#{ENTRIES_PATH}%<type>s_%<name>s.md"
                          TYPE_REGEXP = /#{Regexp.escape(ENTRIES_PATH)}([a-z]+)_/.freeze
                        Severity: Minor
                        Found in tasks/changelog.rb - About 2 hrs to fix

                          Class FileName has 24 methods (exceeds 20 allowed). Consider refactoring.
                          Open

                                class FileName < Base
                                  include RangeHelp
                          
                                  MSG_SNAKE_CASE = 'The name of this source file (`%<basename>s`) should use snake_case.'
                                  MSG_NO_DEFINITION = '`%<basename>s` should define a class or module called `%<namespace>s`.'
                          Severity: Minor
                          Found in lib/rubocop/cop/naming/file_name.rb - About 2 hrs to fix

                            Class SoleNestedConditional has 24 methods (exceeds 20 allowed). Consider refactoring.
                            Open

                                  class SoleNestedConditional < Base
                                    include RangeHelp
                                    extend AutoCorrector
                            
                                    MSG = 'Consider merging nested conditions into outer `%<conditional_type>s` conditions.'
                            Severity: Minor
                            Found in lib/rubocop/cop/style/sole_nested_conditional.rb - About 2 hrs to fix

                              Class SendNodeClassifier has 24 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 ConditionalAssignment has 24 methods (exceeds 20 allowed). Consider refactoring.
                                Open

                                      class ConditionalAssignment < Base
                                        include ConditionalAssignmentHelper
                                        include ConfigurableEnforcedStyle
                                        include IgnoredNode
                                        extend AutoCorrector
                                Severity: Minor
                                Found in lib/rubocop/cop/style/conditional_assignment.rb - About 2 hrs to fix

                                  Method each_already_disabled has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
                                  Open

                                          def each_already_disabled(cop, line_ranges)
                                            line_ranges.each_cons(2) do |previous_range, range|
                                              next if ignore_offense?(range)
                                              # If a cop is disabled in a range that begins on the same line as
                                              # the end of the previous range, it means that the cop was
                                  Severity: Minor
                                  Found in lib/rubocop/cop/lint/redundant_cop_disable_directive.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