rubocop-hq/rubocop

View on GitHub
lib/rubocop/runner.rb

Summary

Maintainability
C
1 day
Test Coverage
A
97%

Class Runner has 42 methods (exceeds 20 allowed). Consider refactoring.
Open

  class Runner # rubocop:disable Metrics/ClassLength
    # An exception indicating that the inspection loop got stuck correcting
    # offenses back and forth.
    class InfiniteCorrectionLoop < StandardError
      attr_reader :offenses
Severity: Minor
Found in lib/rubocop/runner.rb - About 5 hrs to fix

    File runner.rb has 359 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    require 'parallel'
    
    module RuboCop
      # This class handles the processing of files, which includes dealing with
      # formatters and letting cops inspect the files.
    Severity: Minor
    Found in lib/rubocop/runner.rb - About 4 hrs to fix

      Method run has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

          def run(paths)
            target_files = find_target_files(paths)
            if @options[:list_target_files]
              list_files(target_files)
            else
      Severity: Minor
      Found in lib/rubocop/runner.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 each_inspected_file has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

          def each_inspected_file(files)
            files.reduce(true) do |all_passed, file|
              offenses = process_file(file)
              yield file
      
      
      Severity: Minor
      Found in lib/rubocop/runner.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 iterate_until_no_changes has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

          def iterate_until_no_changes(source, offenses_by_iteration)
            # Keep track of the state of the source. If a cop modifies the source
            # and another cop undoes it producing identical source we have an
            # infinite loop.
            @processed_sources = []
      Severity: Minor
      Found in lib/rubocop/runner.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