digipolisgent/robo-digipolis-symfony

View on GitHub

Showing 30 of 30 total issues

Method handle has 29 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function handle(GenericEvent $event)
    {
        $event->stopPropagation();
        $archiveName = $event->hasArgument('archiveName') ? $event->getArgument('archiveName') : null;
        $archive = is_null($archiveName) ? TimeHelper::getInstance()->getTime() . '.tar.gz' : $archiveName;
Severity: Minor
Found in src/EventHandler/BuildTaskHandler.php - About 1 hr to fix

    Method digipolisSyncSymfony has 9 arguments (exceeds 4 allowed). Consider refactoring.
    Open

            $sourceUser,
            $sourceHost,
            $sourceKeyFile,
            $destinationUser,
            $destinationHost,
    Severity: Major
    Found in src/Robo/Plugin/Commands/DigipolisSymfonySyncCommand.php - About 1 hr to fix

      Method defaultDbConfig has 26 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function defaultDbConfig()
          {
              $rootDir = $this->getConfig()->get('digipolis.root.project', false);
              if (!$rootDir) {
                  return false;
      Severity: Minor
      Found in src/Robo/Plugin/Commands/DigipolisSymfonyDefaultHooksCommands.php - About 1 hr to fix

        Each class must be in a namespace of at least one level (a top-level vendor name)
        Open

        class RoboFile extends Tasks
        Severity: Minor
        Found in src/RoboFile.php by phpcodesniffer

        Similar blocks of code found in 2 locations. Consider refactoring.
        Open

        <?php
        
        namespace DigipolisGent\Robo\Symfony\Robo\Plugin\Commands;
        
        use Consolidation\AnnotatedCommand\Events\CustomEventAwareInterface;
        Severity: Minor
        Found in src/Robo/Plugin/Commands/DigipolisSymfonyUpdateCommand.php and 1 other location - About 1 hr to fix
        src/Robo/Plugin/Commands/DigipolisSymfonyInstallCommand.php on lines 1..30

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 65.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Similar blocks of code found in 2 locations. Consider refactoring.
        Open

        <?php
        
        namespace DigipolisGent\Robo\Symfony\Robo\Plugin\Commands;
        
        use Consolidation\AnnotatedCommand\Events\CustomEventAwareInterface;
        Severity: Minor
        Found in src/Robo/Plugin/Commands/DigipolisSymfonyInstallCommand.php and 1 other location - About 1 hr to fix
        src/Robo/Plugin/Commands/DigipolisSymfonyUpdateCommand.php on lines 1..30

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 65.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Identical blocks of code found in 2 locations. Consider refactoring.
        Open

            public function handle(GenericEvent $event)
            {
                $collection = $this->collectionBuilder();
        
                $console = $this->getConsolePath();
        Severity: Minor
        Found in src/EventHandler/UpdateSymfonyHandler.php and 1 other location - About 45 mins to fix
        src/EventHandler/InstallSymfonyHandler.php on lines 12..21

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 60.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Identical blocks of code found in 2 locations. Consider refactoring.
        Open

            public function handle(GenericEvent $event)
            {
                $collection = $this->collectionBuilder();
                $console = $this->getConsolePath();
                $collection
        Severity: Minor
        Found in src/EventHandler/InstallSymfonyHandler.php and 1 other location - About 45 mins to fix
        src/EventHandler/UpdateSymfonyHandler.php on lines 15..25

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 60.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Avoid too many return statements within this method.
        Open

                return $value;
        Severity: Major
        Found in src/Robo/Plugin/Commands/DigipolisSymfonyDefaultHooksCommands.php - About 30 mins to fix

          Avoid too many return statements within this method.
          Open

                          return;
          Severity: Major
          Found in src/Robo/Plugin/Commands/DigipolisSymfonyDefaultHooksCommands.php - About 30 mins to fix

            Avoid too many return statements within this method.
            Open

                        return substr($value, 1, -1);
            Severity: Major
            Found in src/Robo/Plugin/Commands/DigipolisSymfonyDefaultHooksCommands.php - About 30 mins to fix

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

                  protected function env($key, $default = null)
                  {
                      $value = array_key_exists($key, $_ENV) ? $_ENV[$key] : false;
                      if ($value === false) {
                          return is_callable($default) ? call_user_func($default) : $default;

              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

              env accesses the super-global variable $_ENV.
              Open

                  protected function env($key, $default = null)
                  {
                      $value = array_key_exists($key, $_ENV) ? $_ENV[$key] : false;
                      if ($value === false) {
                          return is_callable($default) ? call_user_func($default) : $default;

              Superglobals

              Since: 0.2

              Accessing a super-global variable directly is considered a bad practice. These variables should be encapsulated in objects that are provided by a framework, for instance.

              Example

              class Foo {
                  public function bar() {
                      $name = $_POST['foo'];
                  }
              }

              Source

              env accesses the super-global variable $_ENV.
              Open

                  protected function env($key, $default = null)
                  {
                      $value = array_key_exists($key, $_ENV) ? $_ENV[$key] : false;
                      if ($value === false) {
                          return is_callable($default) ? call_user_func($default) : $default;

              Superglobals

              Since: 0.2

              Accessing a super-global variable directly is considered a bad practice. These variables should be encapsulated in objects that are provided by a framework, for instance.

              Example

              class Foo {
                  public function bar() {
                      $name = $_POST['foo'];
                  }
              }

              Source

              Line exceeds 120 characters; contains 122 characters
              Open

                      preg_match('/^([^:\/\/]*):\/\/([^:]*):([^@]*)@([^:]*):([^\/]*)\/([^\?]*)(\?serverVersion=.*)?$/', $url, $matches);

              Line exceeds 120 characters; contains 126 characters
              Open

              use DigipolisGent\Robo\Helpers\EventHandler\DefaultHandler\PreRestoreBackupRemoteHandler as PreRestoreBackupRemoteHandlerBase;

              Expected 0 spaces before closing bracket; newline found
              Open

                      $collection->taskExec((string) CommandBuilder::create('rm')

              Line length
              Open

              digipolis:restore-backup-symfony   Restore a backup of files (storage folder) and database.
              Severity: Info
              Found in README.md by markdownlint

              MD013 - Line length

              Tags: line_length

              Aliases: line-length Parameters: linelength, codeblocks, tables (number; default 80, boolean; default true)

              This rule is triggered when there are lines that are longer than the configured line length (default: 80 characters). To fix this, split the line up into multiple lines.

              This rule has an exception where there is no whitespace beyond the configured line length. This allows you to still include items such as long URLs without being forced to break them in the middle.

              You also have the option to exclude this rule for code blocks and tables. To do this, set the code_blocks and/or tables parameters to false.

              Code blocks are included in this rule by default since it is often a requirement for document readability, and tentatively compatible with code rules. Still, some languages do not lend themselves to short lines.

              Line indented incorrectly; expected at least 8 spaces, found 6
              Open

                    return parent::getPriority() - 100;

              Opening brace should be on a new line
              Open

                  public function digipolisUpdateSymfony() {
              Severity
              Category
              Status
              Source
              Language