pug-php/js-phpize

View on GitHub

Showing 35 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

      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

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

                      protected function visitFunctionCall(FunctionCall $functionCall, $indent)
                      {
                          $function = $functionCall->function;
                          $arguments = $functionCall->arguments;
                          $applicant = $functionCall->applicant;
                  Severity: Minor
                  Found in src/JsPhpize/Compiler/Compiler.php - About 1 hr to fix

                    Method compile has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        public function compile($input, $filename = null)
                        {
                            $this->flags = 0;
                    
                            if ($filename === null) {
                    Severity: Minor
                    Found in src/JsPhpize/JsPhpize.php - About 1 hr to fix

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

                          protected function getVariableChildFromToken(Token $token)
                          {
                              if ($token->is('.')) {
                                  $this->skip();
                                  $token = $this->next();
                      Severity: Minor
                      Found in src/JsPhpize/Parser/TokenExtractor.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 parseFunctionCallChildren has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                      Open

                          protected function parseFunctionCallChildren($function, $applicant = null)
                          {
                              $arguments = $this->parseParentheses()->nodes;
                              $children = [];
                      
                      
                      Severity: Minor
                      Found in src/JsPhpize/Parser/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

                      Severity
                      Category
                      Status
                      Source
                      Language