pug-php/js-phpize

View on GitHub

Showing 179 of 179 total issues

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

<?php

namespace JsPhpize\Parser;

use JsPhpize\JsPhpize;
Severity: Minor
Found in src/JsPhpize/Parser/Parser.php - About 5 hrs to fix

    Function appendFunctionsCalls has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring.
    Open

        protected function appendFunctionsCalls(&$value, $previousToken = null, $applicant = null)
        {
            while ($token = $this->get(0)) {
                if ($token->is('{') || $token->expectNoLeftMember()) {
                    throw $this->unexpected($this->next());
    Severity: Minor
    Found in src/JsPhpize/Parser/TokenExtractor.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 parseParentheses has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring.
    Open

        protected function parseParentheses($allowedSeparators = [',', ';'])
        {
            $parentheses = new Parenthesis();
            $exceptionInfos = $this->exceptionInfos();
            $expectComma = false;
    Severity: Minor
    Found in src/JsPhpize/Parser/Parser.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

    File Compiler.php has 313 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    <?php
    
    namespace JsPhpize\Compiler;
    
    use JsPhpize\JsPhpize;
    Severity: Minor
    Found in src/JsPhpize/Compiler/Compiler.php - About 3 hrs to fix

      The class Parser has an overall complexity of 107 which is very high. The configured complexity threshold is 50.
      Open

      class Parser extends TokenExtractor
      {
          /**
           * @var JsPhpize
           */
      Severity: Minor
      Found in src/JsPhpize/Parser/Parser.php by phpmd

      The class Scanner has 11 public methods. Consider refactoring Scanner to keep number of public methods under 10.
      Open

      class Scanner
      {
          public function scanUnexpected($matches)
          {
              throw $this->unexpected($this->valueToken('token', $matches));
      Severity: Minor
      Found in src/JsPhpize/Lexer/Scanner.php by phpmd

      TooManyPublicMethods

      Since: 0.1

      A class with too many public methods is probably a good suspect for refactoring, in order to reduce its complexity and find a way to have more fine grained objects.

      By default it ignores methods starting with 'get' or 'set'.

      Example

      Source https://phpmd.org/rules/codesize.html#toomanypublicmethods

      The class Compiler has an overall complexity of 75 which is very high. The configured complexity threshold is 50.
      Open

      class Compiler
      {
          const DOT_DISABLED = 1;
      
          use DyiadeTrait;
      Severity: Minor
      Found in src/JsPhpize/Compiler/Compiler.php by phpmd

      The class TokenExtractor has an overall complexity of 55 which is very high. The configured complexity threshold is 50.
      Open

      abstract class TokenExtractor extends TokenCrawler
      {
          protected function getBracketsArrayItemKeyFromToken($token)
          {
              $typeAndValue = new BracketsArrayItemKey($token);

      Function parseVariable has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
      Open

          protected function parseVariable($name)
          {
              $children = [];
              $variable = null;
      
      
      Severity: Minor
      Found in src/JsPhpize/Parser/Parser.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 appendFunctionsCalls has 44 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          protected function appendFunctionsCalls(&$value, $previousToken = null, $applicant = null)
          {
              while ($token = $this->get(0)) {
                  if ($token->is('{') || $token->expectNoLeftMember()) {
                      throw $this->unexpected($this->next());
      Severity: Minor
      Found in src/JsPhpize/Parser/TokenExtractor.php - About 1 hr to fix

        Method render has 43 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public function render($input, $filename = null, array $variables = [])
            {
                if (is_array($filename)) {
                    $variables = $filename;
                    $filename = null;
        Severity: Minor
        Found in src/JsPhpize/JsPhpize.php - About 1 hr to fix

          Method parseParentheses has 39 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              protected function parseParentheses($allowedSeparators = [',', ';'])
              {
                  $parentheses = new Parenthesis();
                  $exceptionInfos = $this->exceptionInfos();
                  $expectComma = false;
          Severity: Minor
          Found in src/JsPhpize/Parser/Parser.php - About 1 hr to fix

            Function parseHooksArray has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
            Open

                protected function parseHooksArray()
                {
                    $array = new HooksArray();
                    $exceptionInfos = $this->exceptionInfos();
                    $expectComma = false;
            Severity: Minor
            Found in src/JsPhpize/Parser/Parser.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 parseBracketsArray has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
            Open

                protected function parseBracketsArray()
                {
                    $array = new BracketsArray();
                    $exceptionInfos = $this->exceptionInfos();
                    $expectComma = false;
            Severity: Minor
            Found in src/JsPhpize/Parser/Parser.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 visitDyiade has 33 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                protected function visitDyiade(Dyiade $dyiade, $indent)
                {
                    $leftHand = $this->visitNode($dyiade->leftHand, $indent);
                    $rightHand = $this->visitNode($dyiade->rightHand, $indent);
                    switch ($dyiade->operator) {
            Severity: Minor
            Found in src/JsPhpize/Compiler/Compiler.php - About 1 hr to fix

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

                  protected function parseKeywordStatement($token)
                  {
                      $name = $token->value;
                      $keyword = new Block($name);
              
              
              Severity: Minor
              Found in src/JsPhpize/Parser/Parser.php - About 1 hr to fix

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

                    protected function parseVariable($name)
                    {
                        $children = [];
                        $variable = null;
                
                
                Severity: Minor
                Found in src/JsPhpize/Parser/Parser.php - About 1 hr to fix

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

                      protected function visitDyiade(Dyiade $dyiade, $indent)
                      {
                          $leftHand = $this->visitNode($dyiade->leftHand, $indent);
                          $rightHand = $this->visitNode($dyiade->rightHand, $indent);
                          switch ($dyiade->operator) {
                  Severity: Minor
                  Found in src/JsPhpize/Compiler/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

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

                      protected function parseInstruction($block, $token, &$initNext)
                      {
                          if ($token->type === 'keyword') {
                              if ($token->isIn('var', 'const')) {
                                  $initNext = true;
                  Severity: Minor
                  Found in src/JsPhpize/Parser/Parser.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 render has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                  Open

                      public function render($input, $filename = null, array $variables = [])
                      {
                          if (is_array($filename)) {
                              $variables = $filename;
                              $filename = null;
                  Severity: Minor
                  Found in src/JsPhpize/JsPhpize.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