pug-php/ci-pug

View on GitHub
Jade/Parser.php

Summary

Maintainability
F
3 days
Test Coverage

File Parser.php has 565 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php

namespace Jade;

class Parser
Severity: Major
Found in Jade/Parser.php - About 1 day to fix

    Function tag has a Cognitive Complexity of 35 (exceeds 5 allowed). Consider refactoring.
    Open

        protected function tag($tag)
        {
            $tag->line = $this->line();
    
            while (true) {
    Severity: Minor
    Found in Jade/Parser.php - About 5 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

    Parser has 38 functions (exceeds 20 allowed). Consider refactoring.
    Open

    class Parser
    {
        public $basepath;
        public $extension;
        public $allowMixedIndent;
    Severity: Minor
    Found in Jade/Parser.php - About 5 hrs to fix

      Method tag has 89 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          protected function tag($tag)
          {
              $tag->line = $this->line();
      
              while (true) {
      Severity: Major
      Found in Jade/Parser.php - About 3 hrs to fix

        Method parseInclude has 32 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            protected function parseInclude()
            {
                $token = $this->expect('include');
                $file = trim($token->value);
                $dir = realpath(dirname($this->filename));
        Severity: Minor
        Found in Jade/Parser.php - About 1 hr to fix

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

              protected function parseBlock()
              {
                  $block = $this->expect('block');
                  $mode = $block->mode;
                  $name = trim($block->value);
          Severity: Minor
          Found in Jade/Parser.php - About 1 hr to fix

            Method parseTextBlock has 26 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                protected function parseTextBlock()
                {
                    $block = new Nodes\Block();
                    $block->line = $this->line();
                    $spaces = $this->expect('indent')->value;
            Severity: Minor
            Found in Jade/Parser.php - About 1 hr to fix

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

                  public function parse()
                  {
                      $block = new Nodes\Block();
                      $block->line = $this->line();
              
              
              Severity: Minor
              Found in Jade/Parser.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 parseTextBlock has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
              Open

                  protected function parseTextBlock()
                  {
                      $block = new Nodes\Block();
                      $block->line = $this->line();
                      $spaces = $this->expect('indent')->value;
              Severity: Minor
              Found in Jade/Parser.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 parseInclude has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
              Open

                  protected function parseInclude()
                  {
                      $token = $this->expect('include');
                      $file = trim($token->value);
                      $dir = realpath(dirname($this->filename));
              Severity: Minor
              Found in Jade/Parser.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

              There are no issues that match your filters.

              Category
              Status