bbatsov/rubocop

View on GitHub
lib/rubocop/formatter/disabled_config_formatter.rb

Summary

Maintainability
B
5 hrs
Test Coverage

Class DisabledConfigFormatter has 28 methods (exceeds 20 allowed). Consider refactoring.
Open

    class DisabledConfigFormatter < BaseFormatter
      include PathUtil

      HEADING = <<~COMMENTS
        # This configuration was generated by
Severity: Minor
Found in lib/rubocop/formatter/disabled_config_formatter.rb - About 3 hrs to fix

    Method command has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
    Open

          def command
            command = 'rubocop --auto-gen-config'
    
            command += ' --auto-gen-only-exclude' if @options[:auto_gen_only_exclude]
    
    
    Severity: Minor
    Found in lib/rubocop/formatter/disabled_config_formatter.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 output_cop_param_comments has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

          def output_cop_param_comments(output_buffer, params, default_cfg)
            config_params = params.reject { |p| p.start_with?('Supported') }
            output_buffer.puts("# Configuration parameters: #{config_params.join(', ')}.")
    
            params.each do |param|
    Severity: Minor
    Found in lib/rubocop/formatter/disabled_config_formatter.rb - About 35 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 excludes has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

          def excludes(offending_files, cop_name, parent)
            # Exclude properties in .rubocop_todo.yml override default ones, as well as any custom
            # excludes in .rubocop.yml, so in order to retain those excludes we must copy them.
            # There can be multiple .rubocop.yml files in subdirectories, but we just look at the
            # current working directory.
    Severity: Minor
    Found in lib/rubocop/formatter/disabled_config_formatter.rb - About 35 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 output_cop_comments has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

          def output_cop_comments(output_buffer, cfg, cop_name, offense_count)
            output_buffer.puts "# Offense count: #{offense_count}" if show_offense_counts?
    
            cop_class = Cop::Registry.global.find_by_cop_name(cop_name)
            default_cfg = default_config(cop_name)
    Severity: Minor
    Found in lib/rubocop/formatter/disabled_config_formatter.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