rubocop-hq/rubocop-ast

View on GitHub
lib/rubocop/ast/node_pattern/compiler/sequence_subcompiler.rb

Summary

Maintainability
C
1 day
Test Coverage
A
98%

Class SequenceSubcompiler has 32 methods (exceeds 20 allowed). Consider refactoring.
Open

        class SequenceSubcompiler < Subcompiler
          DELTA = 1
          POSITIVE = :positive?.to_proc
          private_constant :POSITIVE

Severity: Minor
Found in lib/rubocop/ast/node_pattern/compiler/sequence_subcompiler.rb - About 4 hrs to fix

    File sequence_subcompiler.rb has 303 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    module RuboCop
      module AST
        class NodePattern
          class Compiler
            # Compiles terms within a sequence to code that evalues to true or false.
    Severity: Minor
    Found in lib/rubocop/ast/node_pattern/compiler/sequence_subcompiler.rb - About 3 hrs to fix

      Method compile_min_check has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

                def compile_min_check
                  return 'false' unless node.variadic?
      
                  unless @remaining_arity.end.infinite?
                    not_too_much_remaining = "#{compile_remaining} <= #{@remaining_arity.max}"
      Severity: Minor
      Found in lib/rubocop/ast/node_pattern/compiler/sequence_subcompiler.rb - About 45 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