pug-php/ci-pug

View on GitHub

Showing 54 of 54 total issues

Function parseBetweenSeparators has a Cognitive Complexity of 74 (exceeds 5 allowed). Consider refactoring.
Open

    protected function parseBetweenSeparators()
    {
        $input = $this->input;
        $name = $this->name;
        $separators = $this->separators;
Severity: Minor
Found in Jade/Compiler/CodeHandler.php - About 1 day 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

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 parseWith has 111 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function parseWith($str)
          {
              $parser = $this;
      
              $key = '';
      Severity: Major
      Found in Jade/Lexer/Attributes.php - About 4 hrs to fix

        Function parseWith has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring.
        Open

            public function parseWith($str)
            {
                $parser = $this;
        
                $key = '';
        Severity: Minor
        Found in Jade/Lexer/Attributes.php - About 4 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

        Function cache has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring.
        Open

            public function cache($input)
            {
                $cacheFolder = $this->options['cache'];
        
                if (!is_dir($cacheFolder)) {
        Severity: Minor
        Found in Jade/Jade.php - About 3 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 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 parseBetweenSeparators has 84 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              protected function parseBetweenSeparators()
              {
                  $input = $this->input;
                  $name = $this->name;
                  $separators = $this->separators;
          Severity: Major
          Found in Jade/Compiler/CodeHandler.php - About 3 hrs to fix

            Function canInline has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
            Open

                public function canInline()
                {
                    $nodes = $this->block->nodes;
            
                    $isInline = function ($node) use (&$isInline) {
            Severity: Minor
            Found in Jade/Nodes/Tag.php - About 3 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 visitMixinCall has 63 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                protected function visitMixinCall(Mixin $mixin, $name, $blockName, $attributes)
                {
                    $arguments = $mixin->arguments;
                    $block = $mixin->block;
                    $defaultAttributes = array();
            Severity: Major
            Found in Jade/Compiler/MixinVisitor.php - About 2 hrs to fix

              Function includeBlock has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
              Open

                  public function includeBlock()
                  {
                      $ret = $this;
                      foreach ($this->nodes as $node) {
                          if (isset($node->yield)) {
              Severity: Minor
              Found in Jade/Nodes/Block.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 cache has 42 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  public function cache($input)
                  {
                      $cacheFolder = $this->options['cache'];
              
                      if (!is_dir($cacheFolder)) {
              Severity: Minor
              Found in Jade/Jade.php - About 1 hr to fix

                Method canInline has 42 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    public function canInline()
                    {
                        $nodes = $this->block->nodes;
                
                        $isInline = function ($node) use (&$isInline) {
                Severity: Minor
                Found in Jade/Nodes/Tag.php - About 1 hr to fix

                  Function view has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
                  Open

                      public function view($view, array $data = array(), $return = false)
                      {
                          if (is_array($view) || $view === true) {
                              $return = (bool) $data;
                              $data = $view;
                  Severity: Minor
                  Found in Jade.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 nextToken has 39 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      public function nextToken()
                      {
                          if ($token = $this->deferred()) {
                              return $token;
                          }
                  Severity: Minor
                  Found in Jade/Lexer.php - About 1 hr to fix

                    Method view has 33 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        public function view($view, array $data = array(), $return = false)
                        {
                            if (is_array($view) || $view === true) {
                                $return = (bool) $data;
                                $data = $view;
                    Severity: Minor
                    Found in Jade.php - About 1 hr to fix

                      Method parseSpace has 33 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          public function parseSpace(&$states, $state, $interpolate, $escapedAttribute, &$val, &$key, $char, $previousNonBlankChar, $nextChar)
                          {
                              switch ($state()) {
                                  case 'expr':
                                  case 'array':
                      Severity: Minor
                      Found in Jade/Lexer/Attributes.php - About 1 hr 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

                          Function createStatements has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                          Open

                              protected function createStatements()
                              {
                                  if (func_num_args() == 0) {
                                      throw new \Exception('No Arguments provided');
                                  }
                          Severity: Minor
                          Found in Jade/Compiler.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

                          Severity
                          Category
                          Status
                          Source
                          Language