rubocop-hq/rubocop

View on GitHub
lib/rubocop/cop/team.rb

Summary

Maintainability
B
6 hrs
Test Coverage
A
93%

Class Team has 26 methods (exceeds 20 allowed). Consider refactoring.
Open

    class Team
      # @return [Team]
      def self.new(cop_or_classes, config, options = {})
        # Support v0 api:
        return mobilize(cop_or_classes, config, options) if cop_or_classes.first.is_a?(Class)
Severity: Minor
Found in lib/rubocop/cop/team.rb - About 3 hrs to fix

    Method roundup_relevant_cops has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
    Open

          def roundup_relevant_cops(processed_source)
            cops.select do |cop|
              next true if processed_source.comment_config.cop_opted_in?(cop)
              next false if cop.excluded_file?(processed_source.file_path)
              next false unless @registry.enabled?(cop, @config)
    Severity: Minor
    Found in lib/rubocop/cop/team.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 each_corrector has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

          def each_corrector(report)
            skips = Set.new
            report.cop_reports.each do |cop_report|
              cop = cop_report.cop
              corrector = cop_report.corrector
    Severity: Minor
    Found in lib/rubocop/cop/team.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 autocorrect has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

          def autocorrect(processed_source, report, original:, offset:)
            @updated_source_file = false
            return unless autocorrect?
            return if report.processed_source.parser_error
    
    
    Severity: Minor
    Found in lib/rubocop/cop/team.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 process_errors has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

          def process_errors(file, errors)
            errors.each do |error|
              line = ":#{error.line}" if error.line
              column = ":#{error.column}" if error.column
              location = "#{file}#{line}#{column}"
    Severity: Minor
    Found in lib/rubocop/cop/team.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

    There are no issues that match your filters.

    Category
    Status