pug-php/pug-symfony

View on GitHub

Showing 287 of 287 total issues

Line exceeds 120 characters; contains 127 characters
Open

        $output->writeln($count.' '.($count === 1 ? 'directory' : 'directories').' scanned: '.implode(', ', $directories).'.');

Line exceeds 120 characters; contains 121 characters
Open

        [$directories, $success, $errors, $errorDetails] = $this->cacheTemplates($this->pugSymfonyEngine->getRenderer());

Line exceeds 120 characters; contains 122 characters
Open

            'optimizations'    => static::getPrivateExtensionProperty($baseTwig, OptimizerExtension::class, 'optimizers'),
Severity: Minor
Found in src/Pug/Twig/Environment.php by phpcodesniffer

Line exceeds 120 characters; contains 125 characters
Open

            'autoescape'       => static::getPrivateExtensionProperty($baseTwig, EscaperExtension::class, 'defaultStrategy'),
Severity: Minor
Found in src/Pug/Twig/Environment.php by phpcodesniffer

Line exceeds 120 characters; contains 122 characters
Open

        $this->userOptions = ($this->container->hasParameter('pug') ? $this->container->getParameter('pug') : null) ?: [];
Severity: Minor
Found in src/Pug/PugSymfonyEngine.php by phpcodesniffer

Line exceeds 120 characters; contains 142 characters
Open

        $addBundle = static::askConfirmation($io, 'Would you like us to add automatically the pug bundle in your config/bundles.php? [Y/N] ');

Line exceeds 120 characters; contains 140 characters
Open

    public static function fromTwigEnvironment(TwigEnvironment $baseTwig, PugSymfonyEngine $pugSymfonyEngine, ContainerInterface $container)
Severity: Minor
Found in src/Pug/Twig/Environment.php by phpcodesniffer

Expected 1 newline at end of file; 0 found
Open

];
Severity: Minor
Found in .phan/config.php by phpcodesniffer

The variable $_ is not named in camelCase.
Open

    public function getRuntime(string $class)
    {
        try {
            return parent::getRuntime($class);
        } catch (RuntimeError $error) {
Severity: Minor
Found in src/Pug/Twig/Environment.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

Define a constant instead of duplicating this literal "paths" 5 times.
Open

            $this->setOption('paths', array_unique($this->getOptionDefault('paths', [])));

Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.

On the other hand, constants can be referenced from many places, but only need to be updated in a single place.

Noncompliant Code Example

With the default threshold of 3:

function run() {
  prepare('action1');                              // Non-Compliant - 'action1' is duplicated 3 times
  execute('action1');
  release('action1');
}

Compliant Solution

ACTION_1 = 'action1';

function run() {
  prepare(ACTION_1);
  execute(ACTION_1);
  release(ACTION_1);
}

Exceptions

To prevent generating some false-positives, literals having less than 5 characters are excluded.

Reference to undeclared property \Pug\PugSymfonyBundle\PugSymfonyBundle->container
Open

            $engine = $this->container->get(PugSymfonyEngine::class);

Call to method getPath from undeclared class \Phug\Parser\Node\ImportNode
Open

            $path = var_export($node->getPath(), true);
Severity: Critical
Found in src/Pug/PugSymfonyEngine.php by phan

Property \Pug\Symfony\CssExtension->assets has undeclared type \Symfony\Bridge\Twig\Extension\AssetExtension
Open

    protected $assets;
Severity: Minor
Found in src/Pug/Symfony/CssExtension.php by phan

Call to method getFilter from undeclared class \Pug\Pug
Open

        return $this->getRenderer()->getFilter($name);
Severity: Critical
Found in src/Pug/Symfony/Traits/Filters.php by phan

Refactor this function to reduce its Cognitive Complexity from 29 to the 15 allowed.
Open

    public function compileSource(Source $source): string
Severity: Critical
Found in src/Pug/Twig/Environment.php by sonar-php

Cognitive Complexity is a measure of how hard the control flow of a function is to understand. Functions with high Cognitive Complexity will be difficult to maintain.

See

Class extends undeclared class \Symfony\Component\Console\Command\Command
Open

class AssetsPublishCommand extends Command

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

        foreach ($pug->getOption('viewDirectories') as $viewDirectory) {

Call to method writeln from undeclared class \Symfony\Component\Console\Output\OutputInterface
Open

        $output->writeln($count.' '.($count === 1 ? 'directory' : 'directories').' scanned: '.implode(', ', $directories).'.');

Call to method renderString from undeclared class \Pug\Pug
Open

        return $pug->$method(
Severity: Critical
Found in src/Pug/PugSymfonyEngine.php by phan

Parameter $name has undeclared type \Symfony\Component\Templating\TemplateReferenceInterface
Open

    public function exists($name): bool
Severity: Minor
Found in src/Pug/PugSymfonyEngine.php by phan
Severity
Category
Status
Source
Language