phug-php/tester

View on GitHub

Showing 93 of 93 total issues

The method dumpCoverage() has 153 lines of code. Current threshold is set to 100. Avoid really long methods.
Open

    public function dumpCoverage(bool $output = false, string $directory = null)
    {
        if ($directory) {
            static::addEmptyDirectory($directory);
            foreach (static::$assets as $asset) {
Severity: Minor
Found in src/Phug/Tester/Coverage.php by phpmd

The method dumpCoverage() has an NPath complexity of 3646296. The configured NPath complexity threshold is 200.
Open

    public function dumpCoverage(bool $output = false, string $directory = null)
    {
        if ($directory) {
            static::addEmptyDirectory($directory);
            foreach (static::$assets as $asset) {
Severity: Minor
Found in src/Phug/Tester/Coverage.php by phpmd

NPathComplexity

Since: 0.1

The NPath complexity of a method is the number of acyclic execution paths through that method. A threshold of 200 is generally considered the point where measures should be taken to reduce complexity.

Example

class Foo {
    function bar() {
        // lots of complicated code
    }
}

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

Avoid using Phug\Tester\count() function in for loops.
Open

        for ($i = 1; $i < count($arguments); $i++) {
            $arg = $arguments[$i];

            if ($arg === static::PUG_COVERAGE_TEXT) {
                $textCoverage = true;
Severity: Minor
Found in src/Phug/Tester/Cli.php by phpmd

CountInLoopExpression

Since: 2.7.0

Using count/sizeof in loops expressions is considered bad practice and is a potential source of many bugs, especially when the loop manipulates an array, as count happens on each iteration.

Example

class Foo {

  public function bar()
  {
    $array = array();

    for ($i = 0; count($array); $i++) {
      // ...
    }
  }
}

Source https://phpmd.org/rules/design.html#countinloopexpression

The method exec() has a Cyclomatic Complexity of 11. The configured cyclomatic complexity threshold is 10.
Open

    protected function exec(array $arguments): bool
    {
        $phpunit = $this->getVendorScript('phpunit/phpunit/phpunit');
        $phpunitArguments = [$phpunit];
        $textCoverage = false;
Severity: Minor
Found in src/Phug/Tester/Cli.php by phpmd

CyclomaticComplexity

Since: 0.1

Complexity is determined by the number of decision points in a method plus one for the method entry. The decision points are 'if', 'while', 'for', and 'case labels'. Generally, 1-4 is low complexity, 5-7 indicates moderate complexity, 8-10 is high complexity, and 11+ is very high complexity.

Example

// Cyclomatic Complexity = 11
class Foo {
1   public function example() {
2       if ($a == $b) {
3           if ($a1 == $b1) {
                fiddle();
4           } elseif ($a2 == $b2) {
                fiddle();
            } else {
                fiddle();
            }
5       } elseif ($c == $d) {
6           while ($c == $d) {
                fiddle();
            }
7        } elseif ($e == $f) {
8           for ($n = 0; $n < $h; $n++) {
                fiddle();
            }
        } else {
            switch ($z) {
9               case 1:
                    fiddle();
                    break;
10              case 2:
                    fiddle();
                    break;
11              case 3:
                    fiddle();
                    break;
                default:
                    fiddle();
                    break;
            }
        }
    }
}

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

The method dumpCoverage() has a Cyclomatic Complexity of 38. The configured cyclomatic complexity threshold is 10.
Open

    public function dumpCoverage(bool $output = false, string $directory = null)
    {
        if ($directory) {
            static::addEmptyDirectory($directory);
            foreach (static::$assets as $asset) {
Severity: Minor
Found in src/Phug/Tester/Coverage.php by phpmd

CyclomaticComplexity

Since: 0.1

Complexity is determined by the number of decision points in a method plus one for the method entry. The decision points are 'if', 'while', 'for', and 'case labels'. Generally, 1-4 is low complexity, 5-7 indicates moderate complexity, 8-10 is high complexity, and 11+ is very high complexity.

Example

// Cyclomatic Complexity = 11
class Foo {
1   public function example() {
2       if ($a == $b) {
3           if ($a1 == $b1) {
                fiddle();
4           } elseif ($a2 == $b2) {
                fiddle();
            } else {
                fiddle();
            }
5       } elseif ($c == $d) {
6           while ($c == $d) {
                fiddle();
            }
7        } elseif ($e == $f) {
8           for ($n = 0; $n < $h; $n++) {
                fiddle();
            }
        } else {
            switch ($z) {
9               case 1:
                    fiddle();
                    break;
10              case 2:
                    fiddle();
                    break;
11              case 3:
                    fiddle();
                    break;
                default:
                    fiddle();
                    break;
            }
        }
    }
}

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

The variable $__php is not named in camelCase.
Open

    protected function getTemplateFile(string $file, array $vars): string
    {
        $__php = file_get_contents(__DIR__."/../../template/$file");
        extract($vars);
        ob_start();
Severity: Minor
Found in src/Phug/Tester/Coverage.php by phpmd

CamelCaseVariableName

Since: 0.2

It is considered best practice to use the camelCase notation to name variables.

Example

class ClassName {
    public function doSomething() {
        $data_module = new DataModule();
    }
}

Source

The variable $_coveredNodes is not named in camelCase.
Open

    public function dumpCoverage(bool $output = false, string $directory = null)
    {
        if ($directory) {
            static::addEmptyDirectory($directory);
            foreach (static::$assets as $asset) {
Severity: Minor
Found in src/Phug/Tester/Coverage.php by phpmd

CamelCaseVariableName

Since: 0.2

It is considered best practice to use the camelCase notation to name variables.

Example

class ClassName {
    public function doSomething() {
        $data_module = new DataModule();
    }
}

Source

The variable $_coveredNodes is not named in camelCase.
Open

    public function dumpCoverage(bool $output = false, string $directory = null)
    {
        if ($directory) {
            static::addEmptyDirectory($directory);
            foreach (static::$assets as $asset) {
Severity: Minor
Found in src/Phug/Tester/Coverage.php by phpmd

CamelCaseVariableName

Since: 0.2

It is considered best practice to use the camelCase notation to name variables.

Example

class ClassName {
    public function doSomething() {
        $data_module = new DataModule();
    }
}

Source

The variable $_coveredNodes is not named in camelCase.
Open

    public function dumpCoverage(bool $output = false, string $directory = null)
    {
        if ($directory) {
            static::addEmptyDirectory($directory);
            foreach (static::$assets as $asset) {
Severity: Minor
Found in src/Phug/Tester/Coverage.php by phpmd

CamelCaseVariableName

Since: 0.2

It is considered best practice to use the camelCase notation to name variables.

Example

class ClassName {
    public function doSomething() {
        $data_module = new DataModule();
    }
}

Source

The variable $_nodes is not named in camelCase.
Open

    public function dumpCoverage(bool $output = false, string $directory = null)
    {
        if ($directory) {
            static::addEmptyDirectory($directory);
            foreach (static::$assets as $asset) {
Severity: Minor
Found in src/Phug/Tester/Coverage.php by phpmd

CamelCaseVariableName

Since: 0.2

It is considered best practice to use the camelCase notation to name variables.

Example

class ClassName {
    public function doSomething() {
        $data_module = new DataModule();
    }
}

Source

The variable $_nodes is not named in camelCase.
Open

    public function dumpCoverage(bool $output = false, string $directory = null)
    {
        if ($directory) {
            static::addEmptyDirectory($directory);
            foreach (static::$assets as $asset) {
Severity: Minor
Found in src/Phug/Tester/Coverage.php by phpmd

CamelCaseVariableName

Since: 0.2

It is considered best practice to use the camelCase notation to name variables.

Example

class ClassName {
    public function doSomething() {
        $data_module = new DataModule();
    }
}

Source

The variable $_nodes is not named in camelCase.
Open

    public function dumpCoverage(bool $output = false, string $directory = null)
    {
        if ($directory) {
            static::addEmptyDirectory($directory);
            foreach (static::$assets as $asset) {
Severity: Minor
Found in src/Phug/Tester/Coverage.php by phpmd

CamelCaseVariableName

Since: 0.2

It is considered best practice to use the camelCase notation to name variables.

Example

class ClassName {
    public function doSomething() {
        $data_module = new DataModule();
    }
}

Source

The variable $_nodes is not named in camelCase.
Open

    public function dumpCoverage(bool $output = false, string $directory = null)
    {
        if ($directory) {
            static::addEmptyDirectory($directory);
            foreach (static::$assets as $asset) {
Severity: Minor
Found in src/Phug/Tester/Coverage.php by phpmd

CamelCaseVariableName

Since: 0.2

It is considered best practice to use the camelCase notation to name variables.

Example

class ClassName {
    public function doSomething() {
        $data_module = new DataModule();
    }
}

Source

The variable $__php is not named in camelCase.
Open

    protected function getTemplateFile(string $file, array $vars): string
    {
        $__php = file_get_contents(__DIR__."/../../template/$file");
        extract($vars);
        ob_start();
Severity: Minor
Found in src/Phug/Tester/Coverage.php by phpmd

CamelCaseVariableName

Since: 0.2

It is considered best practice to use the camelCase notation to name variables.

Example

class ClassName {
    public function doSomething() {
        $data_module = new DataModule();
    }
}

Source

The variable $_coveredNodes is not named in camelCase.
Open

    public function dumpCoverage(bool $output = false, string $directory = null)
    {
        if ($directory) {
            static::addEmptyDirectory($directory);
            foreach (static::$assets as $asset) {
Severity: Minor
Found in src/Phug/Tester/Coverage.php by phpmd

CamelCaseVariableName

Since: 0.2

It is considered best practice to use the camelCase notation to name variables.

Example

class ClassName {
    public function doSomething() {
        $data_module = new DataModule();
    }
}

Source

Property \Phug\Tester\Coverage->renderer has undeclared type \Phug\Renderer
Open

    protected $renderer;
Severity: Minor
Found in src/Phug/Tester/Coverage.php by phan

Call to method getOption from undeclared class \Phug\Renderer
Open

        $cache = $this->renderer->getOption('cache_dir');
Severity: Critical
Found in src/Phug/Tester/Coverage.php by phan

Class extends undeclared class \PHPUnit\TextUI\TestRunner
Open

class TestRunnerInterceptor extends TestRunner
Severity: Critical
Found in src/Phug/Tester/TestRunnerInterceptor.php by phan

Parameter $location has undeclared type ?\Phug\Util\SourceLocationInterface
Open

    protected function recordLocation(SourceLocationInterface $location = null, int $covered = 0)
Severity: Minor
Found in src/Phug/Tester/Coverage.php by phan

Property \Phug\Tester\TestCaseTrait->renderer has undeclared type \Phug\Renderer
Open

    protected $renderer;
Severity: Minor
Found in src/Phug/Tester/TestCaseTrait.php by phan
Severity
Category
Status
Source
Language