rubocop-hq/rubocop

View on GitHub
lib/rubocop/cop/base.rb

Summary

Maintainability
D
1 day
Test Coverage
A
97%

Class Base has 64 methods (exceeds 20 allowed). Consider refactoring.
Open

    class Base # rubocop:disable Metrics/ClassLength
      extend RuboCop::AST::Sexp
      extend NodePattern::Macros
      extend ExcludeLimit
      include RuboCop::AST::Sexp
Severity: Major
Found in lib/rubocop/cop/base.rb - About 1 day to fix

    File base.rb has 304 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

      Method target_satisfies_all_gem_version_requirements? has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

            def target_satisfies_all_gem_version_requirements?
              self.class.gem_requirements.all? do |gem_name, version_req|
                all_gem_versions_in_target = @config.gem_versions_in_target
                next false unless all_gem_versions_in_target
      
      
      Severity: Minor
      Found in lib/rubocop/cop/base.rb - About 45 mins 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 relevant_file? has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

            def relevant_file?(file)
              return false unless target_satisfies_all_gem_version_requirements?
              return true unless @config.clusivity_config_for_badge?(self.class.badge)
      
              file == RuboCop::AST::ProcessedSource::STRING_SOURCE_NAME ||
      Severity: Minor
      Found in lib/rubocop/cop/base.rb - About 25 mins 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 use_corrector has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

            def use_corrector(range, corrector)
              if autocorrect?
                attempt_correction(range, corrector)
              elsif corrector && (always_autocorrect? || (contextual_autocorrect? && !LSP.enabled?))
                :uncorrected
      Severity: Minor
      Found in lib/rubocop/cop/base.rb - About 25 mins 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

      There are no issues that match your filters.

      Category
      Status