krixon/rules

View on GitHub

Showing 28 of 42 total issues

ComparisonNode has 32 functions (exceeds 20 allowed). Consider refactoring.
Open

class ComparisonNode implements Node
{
    private $identifier;
    private $operator;
    private $value;
Severity: Minor
Found in src/Ast/ComparisonNode.php - About 4 hrs to fix

    Function isSatisfiedBy has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
    Open

        public function isSatisfiedBy($value) : bool
        {
            if (empty($this->children)) {
                return false;
            }
    Severity: Minor
    Found in src/Specification/Composite.php - About 2 hrs 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 parseComparisonExpression has 48 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        private function parseComparisonExpression() : Ast\Node
        {
            $left    = $this->parseIdentifier();
            $negated = false;
    
    
    Severity: Minor
    Found in src/Parser/DefaultParser.php - About 1 hr to fix

      Function parseComparisonExpression has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
      Open

          private function parseComparisonExpression() : Ast\Node
          {
              $left    = $this->parseIdentifier();
              $negated = false;
      
      
      Severity: Minor
      Found in src/Parser/DefaultParser.php - 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 next has 29 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          private function next() : void
          {
              $char = $this->advance();
      
              switch ($char) {
      Severity: Minor
      Found in src/Lexer/Lexer.php - About 1 hr to fix

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

            public function visitLogical(LogicalNode $node) : void
            {
                $left  = $node->left();
                $right = $node->right();
        
        
        Severity: Minor
        Found in src/Ast/Writer.php - About 1 hr to fix

          Method parseLiteralList has 28 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              private function parseLiteralList() : Ast\LiteralNodeList
              {
                  $this->match(Token::LEFT_BRACKET);
          
                  $this->next();
          Severity: Minor
          Found in src/Parser/DefaultParser.php - About 1 hr to fix

            Function visitComparison has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
            Open

                public function visitComparison(ComparisonNode $node) : void
                {
                    $node->identifier()->accept($this);
            
                    $negated = $this->negating;
            Severity: Minor
            Found in src/Ast/Writer.php - 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 visitComparison has 26 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                public function visitComparison(ComparisonNode $node) : void
                {
                    $node->identifier()->accept($this);
            
                    $negated = $this->negating;
            Severity: Minor
            Found in src/Ast/Writer.php - About 1 hr to fix

              Function visitLogical has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
              Open

                  public function visitLogical(Ast\LogicalNode $node) : void
                  {
                      $node->right()->accept($this);
                      $node->left()->accept($this);
              
              
              Severity: Minor
              Found in src/Compiler/BaseCompiler.php - 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

              Function blockComment has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
              Open

                  private function blockComment() : void
                  {
                      /* This kind of comment continues until it is closed. It can also be nested. */
                      $balance = 1;
              
              
              Severity: Minor
              Found in src/Lexer/Lexer.php - 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

              Function string has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
              Open

                  private function string()
                  {
                      $buffer = '';
              
                      while ($this->peek() !== '"' && !$this->eof()) {
              Severity: Minor
              Found in src/Lexer/Lexer.php - 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

              Function isSatisfiedBy has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
              Open

                  public function isSatisfiedBy($value) : bool
                  {
                      if (empty($this->candidates)) {
                          return false;
                      }
              Severity: Minor
              Found in src/Specification/Contains.php - 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

              Function parseLiteralList has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
              Open

                  private function parseLiteralList() : Ast\LiteralNodeList
                  {
                      $this->match(Token::LEFT_BRACKET);
              
                      $this->next();
              Severity: Minor
              Found in src/Parser/DefaultParser.php - 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

              Avoid too many return statements within this method.
              Open

                              return new TimezoneMatches($candidate);
              Severity: Major
              Found in src/Specification/Contains.php - About 30 mins to fix

                Avoid too many return statements within this method.
                Open

                                return $value <= $this->string;
                Severity: Major
                Found in src/Specification/StringMatches.php - About 30 mins to fix

                  Avoid too many return statements within this method.
                  Open

                              case self::CONTAINS_ALL:   return 'contains all';
                  Severity: Major
                  Found in src/Operator.php - About 30 mins to fix

                    Avoid too many return statements within this method.
                    Open

                                    return $value >= $this->string;
                    Severity: Major
                    Found in src/Specification/StringMatches.php - About 30 mins to fix

                      Avoid too many return statements within this method.
                      Open

                                      return $value >= $this->date;
                      Severity: Major
                      Found in src/Specification/DateMatches.php - About 30 mins to fix

                        Avoid too many return statements within this method.
                        Open

                                        return $equal || $value > $this->number;
                        Severity: Major
                        Found in src/Specification/NumberMatches.php - About 30 mins to fix
                          Severity
                          Category
                          Status
                          Source
                          Language