pug-php/ci-pug

View on GitHub

Showing 54 of 54 total issues

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

        public function __construct(array $options = null)
        {
            if (is_null($options)) {
                $options = defined('static::SETTINGS') ? ((array) static::SETTINGS) : array();
            }
    Severity: Minor
    Found in Jade.php - About 1 hr to fix

      Method parseSpace has 9 arguments (exceeds 4 allowed). Consider refactoring.
      Open

          public function parseSpace(&$states, $state, $interpolate, $escapedAttribute, &$val, &$key, $char, $previousNonBlankChar, $nextChar)
      Severity: Major
      Found in Jade/Lexer/Attributes.php - About 1 hr to fix

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

            protected function getAndAttributeCode($attr, &$classes, &$classesCheck)
            {
                $addClasses = '""';
                if (count($classes) || count($classesCheck)) {
                    foreach ($classes as &$value) {
        Severity: Minor
        Found in Jade/Compiler/AttributesCompiler.php - About 1 hr to fix

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

              protected function parseMixinAttributes($attributes, $defaultAttributes, $mixinAttributes)
              {
                  if (!count($attributes)) {
                      return "(isset(\$attributes)) ? \$attributes : array($defaultAttributes)";
                  }
          Severity: Minor
          Found in Jade/Compiler/MixinVisitor.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

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

              public function __construct(array $options = null)
              {
                  if (is_null($options)) {
                      $options = defined('static::SETTINGS') ? ((array) static::SETTINGS) : array();
                  }
          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 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

            Avoid deeply nested control flow statements.
            Open

                                                if ($quote) {
                                                    if (CommonUtils::escapedEnd($match[1])) {
                                                        ${is_null($value) ? 'key' : 'value'} .= $match[0];
                                                        $consume($argument, $match[0]);
                                                        break;
            Severity: Major
            Found in Jade/Compiler/CodeHandler.php - About 45 mins to fix

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

                  protected function parseMixinArguments(&$arguments, &$containsOnlyArrays, &$defaultAttributes)
                  {
                      $newArrayKey = null;
                      $arguments = is_null($arguments) ? array() : explode(',', $arguments);
                      foreach ($arguments as $key => &$argument) {
              Severity: Minor
              Found in Jade/Compiler/MixinVisitor.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 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

              Avoid deeply nested control flow statements.
              Open

                                                  if (!is_null($value)) {
                                                      throw new \Exception('Parse error on '.substr($argument, strlen($match[1])), 1);
                                                  }
              Severity: Major
              Found in Jade/Compiler/CodeHandler.php - About 45 mins to fix

                Avoid deeply nested control flow statements.
                Open

                                                    if ($quote) {
                                                        ${is_null($value) ? 'key' : 'value'} .= $match[0];
                                                        break;
                                                    }
                Severity: Major
                Found in Jade/Compiler/CodeHandler.php - About 45 mins to fix

                  Function parseSpace has a Cognitive Complexity of 8 (exceeds 5 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 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 displayAttributes has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                  Open

                      public static function displayAttributes($attributes, $quote)
                      {
                          if (is_array($attributes) || $attributes instanceof Traversable) {
                              foreach ($attributes as $key => $value) {
                                  if ($key !== 'class' && $value !== false && $value !== 'null') {
                  Severity: Minor
                  Found in Jade/Compiler/CompilerFacade.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

                  Avoid deeply nested control flow statements.
                  Open

                                                      if ($quote) {
                                                          ${is_null($value) ? 'key' : 'value'} .= $match[0];
                                                          $consume($argument, $match[0]);
                                                          break;
                                                      }
                  Severity: Major
                  Found in Jade/Compiler/CodeHandler.php - About 45 mins to fix

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

                        public function handleString($input)
                        {
                            $result = array();
                            $resultsString = array();
                    
                    
                    Severity: Minor
                    Found in Jade/Compiler.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

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

                        protected function isArrayOfConstants($str)
                        {
                            $str = trim($str);
                    
                            if (0 === strpos($str, 'array(') || 0 === strpos($str, '[')) {
                    Severity: Minor
                    Found in Jade/Compiler.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

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

                        protected function visitCodeConditional(array $matches)
                        {
                            $code = trim($matches[2], '; ');
                            while (($len = strlen($code)) > 1 && ($code[0] == '(' || $code[0] == '{') && ord($code[0]) == ord(substr($code, -1)) - 1) {
                                $code = trim(substr($code, 1, $len - 2));
                    Severity: Minor
                    Found in Jade/Compiler/CodeVisitor.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

                    Severity
                    Category
                    Status
                    Source
                    Language