searls/rubbycop

View on GitHub
lib/rubbycop/runner.rb

Summary

Maintainability
B
5 hrs
Test Coverage

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

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

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

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

        def iterate_until_no_changes(source, offenses)
          # 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/rubbycop/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

    Method add_unneeded_disables has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

        def add_unneeded_disables(file, offenses, source)
          if check_for_unneded_disables?(source)
            config = @config_store.for(file)
            if config.for_cop(Cop::Lint::UnneededDisable).fetch('Enabled')
              cop = Cop::Lint::UnneededDisable.new(config, @options)
    Severity: Minor
    Found in lib/rubbycop/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