digipolisgent/robo-digipolis-drupal8

View on GitHub
src/Traits/Drupal8UtilsTrait.php

Summary

Maintainability
A
3 hrs
Test Coverage
F
0%

Method getLanguageUuids has 35 lines of code (exceeds 25 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 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

      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

      Avoid unused local variables such as '$site_path'.
      Open

                  $site_path = 'sites' . $subdir;
      Severity: Minor
      Found in src/Traits/Drupal8UtilsTrait.php by phpmd

      UnusedLocalVariable

      Since: 0.2

      Detects when a local variable is declared and/or assigned, but not used.

      Example

      class Foo {
          public function doSomething()
          {
              $i = 5; // Unused
          }
      }

      Source https://phpmd.org/rules/unusedcode.html#unusedlocalvariable

      Avoid unused local variables such as '$app_root'.
      Open

                  $app_root = $webDir;
      Severity: Minor
      Found in src/Traits/Drupal8UtilsTrait.php by phpmd

      UnusedLocalVariable

      Since: 0.2

      Detects when a local variable is declared and/or assigned, but not used.

      Example

      class Foo {
          public function doSomething()
          {
              $i = 5; // Unused
          }
      }

      Source https://phpmd.org/rules/unusedcode.html#unusedlocalvariable

      Avoid unused local variables such as '$app_root'.
      Open

                  $app_root = $webDir;
      Severity: Minor
      Found in src/Traits/Drupal8UtilsTrait.php by phpmd

      UnusedLocalVariable

      Since: 0.2

      Detects when a local variable is declared and/or assigned, but not used.

      Example

      class Foo {
          public function doSomething()
          {
              $i = 5; // Unused
          }
      }

      Source https://phpmd.org/rules/unusedcode.html#unusedlocalvariable

      Avoid unused local variables such as '$site_path'.
      Open

                  $site_path = 'sites' . $subdir;
      Severity: Minor
      Found in src/Traits/Drupal8UtilsTrait.php by phpmd

      UnusedLocalVariable

      Since: 0.2

      Detects when a local variable is declared and/or assigned, but not used.

      Example

      class Foo {
          public function doSomething()
          {
              $i = 5; // Unused
          }
      }

      Source https://phpmd.org/rules/unusedcode.html#unusedlocalvariable

      Line exceeds 120 characters; contains 122 characters
      Open

              return $command->addArgument('sql-query')->addArgument('SHOW TABLES')->pipeOutputTo('grep')->addArgument('users');

      Line exceeds 120 characters; contains 182 characters
      Open

                  ->onSuccess((clone $drushBase)->addArgument('pml')->addOption('fields', 'name')->addOption('status', 'enabled')->addOption('type', 'module')->addOption('format', 'list'))

      Line exceeds 120 characters; contains 143 characters
      Open

                  ->pipeOutputTo('grep')->addRawArgument(version_compare($drushVersion, '9.0', '<') ? '"(' . $module . ')"' : '"^' . $module . '$"');

      Line exceeds 120 characters; contains 121 characters
      Open

              $sync = $webDir . '/' . ($settings['config_sync_directory'] ?? $config_directories['sync']) . '/system.site.yml';

      Expected 1 space after FOREACH keyword; 0 found
      Open

              foreach($languageFinder as $language) {

      Line indented incorrectly; expected at least 16 spaces, found 14
      Open

                    continue;

      The variable $config_directories is not named in camelCase.
      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 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 $site_path is not named in camelCase.
      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 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 $config_directories is not named in camelCase.
      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 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 $config_directories is not named in camelCase.
      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 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 $site_path is not named in camelCase.
      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 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 $app_root is not named in camelCase.
      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 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 $config_directories is not named in camelCase.
      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 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 $config_directories is not named in camelCase.
      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 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 $config_directories is not named in camelCase.
      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 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 $app_root is not named in camelCase.
      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 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

      There are no issues that match your filters.

      Category
      Status