pug-php/ci-pug

View on GitHub
Jade/Compiler/CodeHandler.php

Summary

Maintainability
D
2 days
Test Coverage

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

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

    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

      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

          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

            Avoid too many return statements within this method.
            Open

                            return $arguments;
            Severity: Major
            Found in Jade/Compiler/CodeHandler.php - About 30 mins to fix

              Avoid too many return statements within this method.
              Open

                              return $separators[$index + 1];
              Severity: Major
              Found in Jade/Compiler/CodeHandler.php - About 30 mins to fix

                Avoid too many return statements within this method.
                Open

                            return $arguments;
                Severity: Major
                Found in Jade/Compiler/CodeHandler.php - About 30 mins to fix

                  Avoid too many return statements within this method.
                  Open

                          return $result;
                  Severity: Major
                  Found in Jade/Compiler/CodeHandler.php - About 30 mins to fix

                    There are no issues that match your filters.

                    Category
                    Status