bbatsov/rubocop

View on GitHub
lib/rubocop/config.rb

Summary

Maintainability
C
1 day
Test Coverage

Class Config has 40 methods (exceeds 20 allowed). Consider refactoring.
Open

  class Config
    include PathUtil
    include FileFinder
    extend Forwardable

Severity: Minor
Found in lib/rubocop/config.rb - About 5 hrs to fix

    Method add_excludes_from_higher_level has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
    Open

        def add_excludes_from_higher_level(highest_config)
          return unless highest_config.for_all_cops['Exclude']
    
          excludes = for_all_cops['Exclude'] ||= []
          highest_config.for_all_cops['Exclude'].each do |path|
    Severity: Minor
    Found in lib/rubocop/config.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 make_excludes_absolute has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
    Open

        def make_excludes_absolute
          each_key do |key|
            @validator.validate_section_presence(key)
            next unless self[key]['Exclude']
    
    
    Severity: Minor
    Found in lib/rubocop/config.rb - About 55 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 pending_cops has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

        def pending_cops
          keys.each_with_object([]) do |qualified_cop_name, pending_cops|
            department = department_of(qualified_cop_name)
            next if department && department['Enabled'] == false
    
    
    Severity: Minor
    Found in lib/rubocop/config.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 file_to_include? has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

        def file_to_include?(file)
          relative_file_path = path_relative_to_config(file)
    
          # Optimization to quickly decide if the given file is hidden (on the top
          # level) and cannot be matched by any pattern.
    Severity: Minor
    Found in lib/rubocop/config.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