digipolisgent/robo-digipolis-drupal8

View on GitHub

Showing 118 of 118 total issues

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

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

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

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

      Method addEnableMaintenanceModeTask has 28 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          protected function addEnableMaintenanceModeTask(CollectionBuilder $collection, ?string $uri = null)
          {
              $enableMaintenanceMode = CommandBuilder::create('cd')
                  ->addFlag('P')
                  ->addRawArgument(
      Severity: Minor
      Found in src/EventHandler/UpdateDrupal8Handler.php - About 1 hr to fix

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

            public function getSiteUuid($uri = false, $aliases = [])
            {
                $aliases ??= [0 => false];
                $webDir = $this->getConfig()->get('digipolis.root.web', false);
                if (!$webDir) {
        Severity: Minor
        Found in src/Traits/Drupal8UtilsTrait.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 RoboFileBase
          Severity: Minor
          Found in src/RoboFile.php by phpcodesniffer

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

              public function getLanguageUuids($uri = false, $aliases = [])
              {
                  $aliases ??= [0 => false];
                  $webDir = $this->getConfig()->get('digipolis.root.web', false);
                  if (!$webDir) {
          Severity: Minor
          Found in src/Traits/Drupal8UtilsTrait.php - About 55 mins to fix

          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

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

              public function defaultDbConfig()
              {
                  $settings = $this->getRemoteSettings(null, null, null, null);
                  $webDir = $this->getConfig()->get('digipolis.root.web', false);
                  if (!$webDir) {
          Severity: Minor
          Found in src/Robo/Plugin/Commands/DigipolisDrupal8DefaultHooksCommands.php - About 55 mins to fix

          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

          Function handle has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
          Open

              public function handle(GenericEvent $event)
              {
                  /** @var RemoteConfig $remoteConfig */
                  $remoteConfig = $event->getArgument('remoteConfig');
                  $remoteSettings = $remoteConfig->getRemoteSettings();
          Severity: Minor
          Found in src/EventHandler/RestoreBackupRemoteHandler.php - About 45 mins to fix

          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

          Function handle has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
          Open

              public function handle(GenericEvent $event)
              {
                  /** @var RemoteConfig $remoteConfig */
                  $remoteConfig = $event->getArgument('remoteConfig');
                  $remoteSettings = $remoteConfig->getRemoteSettings();
          Severity: Minor
          Found in src/EventHandler/PreRestoreBackupRemoteHandler.php - About 45 mins to fix

          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

          The class DigipolisDrupal8DefaultHooksCommands has a coupling between objects value of 13. Consider to reduce the number of dependencies under 13.
          Open

          class DigipolisDrupal8DefaultHooksCommands extends Tasks implements ConfigAwareInterface, CustomEventAwareInterface
          {
          
              use \Consolidation\Config\ConfigAwareTrait;
              use \DigipolisGent\Robo\Task\General\Common\DigipolisPropertiesAware;

          CouplingBetweenObjects

          Since: 1.1.0

          A class with too many dependencies has negative impacts on several quality aspects of a class. This includes quality criteria like stability, maintainability and understandability

          Example

          class Foo {
              /**
               * @var \foo\bar\X
               */
              private $x = null;
          
              /**
               * @var \foo\bar\Y
               */
              private $y = null;
          
              /**
               * @var \foo\bar\Z
               */
              private $z = null;
          
              public function setFoo(\Foo $foo) {}
              public function setBar(\Bar $bar) {}
              public function setBaz(\Baz $baz) {}
          
              /**
               * @return \SplObjectStorage
               * @throws \OutOfRangeException
               * @throws \InvalidArgumentException
               * @throws \ErrorException
               */
              public function process(\Iterator $it) {}
          
              // ...
          }

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

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

                CollectionBuilder $collection,
                array $options,
                array $aliases,
                string $profile,
                ?string $uri = null
          Severity: Minor
          Found in src/EventHandler/InstallDrupal8Handler.php - About 35 mins to fix

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

                        $collection
                            ->taskSsh($remoteConfig->getHost(), new KeyFile($remoteConfig->getUser(), $remoteConfig->getPrivateKeyFile()))
                                ->remoteDirectory($currentProjectRoot, true)
                                // Updates can take a long time. Let's set it to 15 minutes.
                                ->timeout(900)
            Severity: Minor
            Found in src/EventHandler/UpdateHandler.php and 1 other location - About 35 mins to fix
            src/EventHandler/InstallHandler.php on lines 58..62

            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 57.

            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

                        $collection->taskSsh($remoteConfig->getHost(), new KeyFile($remoteConfig->getUser(), $remoteConfig->getPrivateKeyFile()))
                            ->remoteDirectory($currentProjectRoot, true)
                            // Install can take a long time. Let's set it to 15 minutes.
                            ->timeout(900)
                            ->exec((string) $install);
            Severity: Minor
            Found in src/EventHandler/InstallHandler.php and 1 other location - About 35 mins to fix
            src/EventHandler/UpdateHandler.php on lines 46..51

            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 57.

            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

            Function addConfigImportTask has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
            Open

                protected function addConfigImportTask(CollectionBuilder $collection, array $options, ?string $uri = null, array $aliases = [])
                {
                    if ($options['config-import']) {
                        $drushBase = CommandBuilder::create('vendor/bin/drush');
                        if ($uri) {
            Severity: Minor
            Found in src/EventHandler/Drupal8Handler.php - About 35 mins to fix

            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

            Multi-line function declaration not indented correctly; expected 8 spaces but found 6
            Open

                  array $options,

            The closing brace for the class must go on the next line after the body
            Open

            }

            Multi-line function declaration not indented correctly; expected 8 spaces but found 6
            Open

                  array $aliases,

            Multi-line function declaration not indented correctly; expected 8 spaces but found 6
            Open

                  string $profile,

            Multi-line function declaration not indented correctly; expected 8 spaces but found 6
            Open

                  ?string $uri = null

            Blank line found at end of control structure
            Open

            
            
            Severity
            Category
            Status
            Source
            Language