rubocop-hq/rubocop

View on GitHub
lib/rubocop/cli.rb

Summary

Maintainability
A
3 hrs
Test Coverage
A
96%

Method run has 29 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    def run(args = ARGV)
      @options, paths = Options.new.parse(args)
      @env = Environment.new(@options, @config_store, paths)

      profile_if_needed do
Severity: Minor
Found in lib/rubocop/cli.rb - About 1 hr to fix

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

        def profile_if_needed
          return yield unless @options[:profile]
    
          return STATUS_ERROR unless require_gem('stackprof')
    
    
    Severity: Minor
    Found in lib/rubocop/cli.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 handle_exiting_options has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

        def handle_exiting_options
          return unless Options::EXITING_OPTIONS.any? { |o| @options.key? o }
    
          run_command(:version) if @options[:version] || @options[:verbose_version]
          run_command(:show_cops) if @options[:show_cops]
    Severity: Minor
    Found in lib/rubocop/cli.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 parallel_by_default! has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

        def parallel_by_default!
          # See https://github.com/rubocop/rubocop/pull/4537 for JRuby and Windows constraints.
          return if RUBY_ENGINE != 'ruby' || RuboCop::Platform.windows?
    
          if (@options.keys - DEFAULT_PARALLEL_OPTIONS).empty? &&
    Severity: Minor
    Found in lib/rubocop/cli.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