pug-php/pug-symfony

View on GitHub

Showing 102 of 102 total issues

Function interpolateTwigFunctions has a Cognitive Complexity of 38 (exceeds 5 allowed). Consider refactoring.
Open

protected function interpolateTwigFunctions(string $code): string
{
$tokens = array_slice(token_get_all('<?php '.$code), 1);
$output = '';
$count = count($tokens);
Severity: Minor
Found in src/Pug/Symfony/Traits/HelpersHandler.php - About 5 hrs to fix

Function compileSource has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
Open

public function compileSource(Source $source): string
{
$path = $source->getPath();
 
if ($this->pugSymfonyEngine->supports($path)) {
Severity: Minor
Found in src/Pug/Twig/Environment.php - About 3 hrs to fix

File HelpersHandler.php has 273 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php
 
declare(strict_types=1);
 
namespace Pug\Symfony\Traits;
Severity: Minor
Found in src/Pug/Symfony/Traits/HelpersHandler.php - About 2 hrs to fix

    Method interpolateTwigFunctions has 60 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    protected function interpolateTwigFunctions(string $code): string
    {
    $tokens = array_slice(token_get_all('<?php '.$code), 1);
    $output = '';
    $count = count($tokens);
    Severity: Major
    Found in src/Pug/Symfony/Traits/HelpersHandler.php - About 2 hrs to fix

      Method compileSource has 46 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      public function compileSource(Source $source): string
      {
      $path = $source->getPath();
       
      if ($this->pugSymfonyEngine->supports($path)) {
      Severity: Minor
      Found in src/Pug/Twig/Environment.php - About 1 hr to fix

        Method getRendererOptions has 45 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        protected function getRendererOptions(): array
        {
        if ($this->options === null) {
        $environment = $this->kernel->getEnvironment();
        $projectDirectory = $this->kernel->getProjectDir();
        Severity: Minor
        Found in src/Pug/Symfony/Traits/HelpersHandler.php - About 1 hr to fix

          Avoid excessively long variable names like $argumentNeedInterpolation. Keep variable name length under 20.
          Open

          $argumentNeedInterpolation = false;

          Avoid excessively long variable names like $defaultTemplateDirectory. Keep variable name length under 20.
          Open

          protected $defaultTemplateDirectory;
          Severity: Minor
          Found in src/Pug/PugSymfonyEngine.php by phpmd

          Avoid excessively long variable names like $argumentNeedInterpolation. Keep variable name length under 20.
          Open

          protected function pushArgument(array &$arguments, string &$argument, bool &$argumentNeedInterpolation): void

          Function copyTwigFunctions has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
          Open

          protected function copyTwigFunctions(): void
          {
          $this->twigHelpers = [];
          $twig = $this->getTwig();
          $twig->env = $twig;
          Severity: Minor
          Found in src/Pug/Symfony/Traits/HelpersHandler.php - About 1 hr to fix

          Method copyTwigFunctions has 33 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          protected function copyTwigFunctions(): void
          {
          $this->twigHelpers = [];
          $twig = $this->getTwig();
          $twig->env = $twig;
          Severity: Minor
          Found in src/Pug/Symfony/Traits/HelpersHandler.php - About 1 hr to fix

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

            public static function fromTwigEnvironment(
            TwigEnvironment $baseTwig,
            PugSymfonyEngine $pugSymfonyEngine,
            ContainerInterface $container,
            ): static {
            Severity: Minor
            Found in src/Pug/Twig/Environment.php - About 1 hr to fix

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

              protected function getRendererOptions(): array
              {
              if ($this->options === null) {
              $environment = $this->kernel->getEnvironment();
              $projectDirectory = $this->kernel->getProjectDir();
              Severity: Minor
              Found in src/Pug/Symfony/Traits/HelpersHandler.php - About 55 mins to fix

              Avoid variables with short names like $io. Configured minimum length is 3.
              Open

              IOInterface $io,
              Severity: Minor
              Found in src/Pug/Symfony/Traits/Installer.php by phpmd

              Avoid variables with short names like $io. Configured minimum length is 3.
              Open

              public static function proceedTask(&$flags, $io, $taskResult, $flag, $successMessage, $message)
              Severity: Minor
              Found in src/Pug/Symfony/Traits/Installer.php by phpmd

              Avoid variables with short names like $io. Configured minimum length is 3.
              Open

              $io = $event->getIO();
              Severity: Minor
              Found in src/Pug/Symfony/Traits/Installer.php by phpmd

              Avoid variables with short names like $io. Configured minimum length is 3.
              Open

              $io = $event->getIO();
              Severity: Minor
              Found in src/Pug/Symfony/Traits/Installer.php by phpmd

              Avoid variables with short names like $io. Configured minimum length is 3.
              Open

              protected static function askConfirmation(IOInterface $io, string $message): bool
              Severity: Minor
              Found in src/Pug/Symfony/Traits/Installer.php by phpmd

              A file should declare new symbols (classes, functions, constants, etc.) and cause no other side effects, or it should execute logic with side effects, but should not do both. The first symbol is defined on line 19 and the first side effect is on line 16.
              Open

              <?php

              Avoid deeply nested control flow statements.
              Open

              switch ($tokens[$index]) {
              case '(':
              $opening++;
              $argumentNeedInterpolation = true;
              $argument .= '(';
              Severity: Major
              Found in src/Pug/Symfony/Traits/HelpersHandler.php - About 45 mins to fix
                Severity
                Category
                Status
                Source
                Language