XaBerr/JUICE

View on GitHub
JATE/dist/jate/modules/ExternalModules/vendor/pug-php/pug/src/Jade/Compiler/CodeHandler.php

Summary

Maintainability
B
5 hrs
Test Coverage

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

    protected function parseSeparator($sep, &$separators, &$result, &$varname, $subCodeHandler, $innerName)
    {
        $handleCodeInbetween = $subCodeHandler->handleCodeInbetween($separators, $result);
        $var = '$__' . $this->name;

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 parseArrayElement has 6 arguments (exceeds 4 allowed). Consider refactoring.
Open

    protected function parseArrayElement(&$argument, $match, $consume, &$quote, &$key, &$value)

    Method parseArrayString has 6 arguments (exceeds 4 allowed). Consider refactoring.
    Open

        protected function parseArrayString(&$argument, $match, $consume, &$quote, &$key, &$value)

      Method parseSeparator has 6 arguments (exceeds 4 allowed). Consider refactoring.
      Open

          protected function parseSeparator($sep, &$separators, &$result, &$varname, $subCodeHandler, $innerName)

        Method parseArrayAssign has 6 arguments (exceeds 4 allowed). Consider refactoring.
        Open

            protected function parseArrayAssign(&$argument, $match, $consume, &$quote, &$key, &$value)

          Method parseEqual has 5 arguments (exceeds 4 allowed). Consider refactoring.
          Open

              protected function parseEqual($sep, &$separators, &$result, $innerName, $subCodeHandler)

            Avoid too many return statements within this method.
            Open

                    return $this->parseBetweenSeparators();

              Missing class import via use statement (line '43', column '23').
              Open

                          throw new \ErrorException('Expecting a variable name or an expression, got: ' . $this->input, 13);

              MissingImport

              Since: 2.7.0

              Importing all external classes in a file through use statements makes them clearly visible.

              Example

              function make() {
                  return new \stdClass();
              }

              Source http://phpmd.org/rules/cleancode.html#MissingImport

              Missing class import via use statement (line '17', column '23').
              Open

                          throw new \InvalidArgumentException('Expecting a string of PHP, got: ' . gettype($input), 11);

              MissingImport

              Since: 2.7.0

              Importing all external classes in a file through use statements makes them clearly visible.

              Example

              function make() {
                  return new \stdClass();
              }

              Source http://phpmd.org/rules/cleancode.html#MissingImport

              Missing class import via use statement (line '21', column '23').
              Open

                          throw new \InvalidArgumentException('Expecting a string of PHP, empty string received.', 12);

              MissingImport

              Since: 2.7.0

              Importing all external classes in a file through use statements makes them clearly visible.

              Example

              function make() {
                  return new \stdClass();
              }

              Source http://phpmd.org/rules/cleancode.html#MissingImport

              Missing class import via use statement (line '114', column '23').
              Open

                          throw new \ErrorException('Parse error on ' . substr($argument, strlen($match[1])), 15);

              MissingImport

              Since: 2.7.0

              Importing all external classes in a file through use statements makes them clearly visible.

              Example

              function make() {
                  return new \stdClass();
              }

              Source http://phpmd.org/rules/cleancode.html#MissingImport

              Avoid using static access to class 'Jade\Compiler\CommonUtils' in method 'parseArrayString'.
              Open

                          ? CommonUtils::escapedEnd($match[1])

              StaticAccess

              Since: 1.4.0

              Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.

              Example

              class Foo
              {
                  public function bar()
                  {
                      Bar::baz();
                  }
              }

              Source https://phpmd.org/rules/cleancode.html#staticaccess

              Avoid unused parameters such as '$key'.
              Open

                  protected function parseArrayString(&$argument, $match, $consume, &$quote, &$key, &$value)

              UnusedFormalParameter

              Since: 0.2

              Avoid passing parameters to methods or constructors and then not using those parameters.

              Example

              class Foo
              {
                  private function bar($howdy)
                  {
                      // $howdy is not used
                  }
              }

              Source https://phpmd.org/rules/unusedcode.html#unusedformalparameter

              There are no issues that match your filters.

              Category
              Status