attogram/attogram-modulemanager

View on GitHub

Showing 65 of 65 total issues

Method moduleRow has 40 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function moduleRow($moduleBaseName, $moduleInfo, $enabled = true)
    {
        $homepage = (
            isset($moduleInfo['homepage'])
            ? '<br /><a href="'.$moduleInfo['homepage'].'">'.$moduleInfo['homepage'].'</a>'
Severity: Minor
Found in includes/ModuleManager.php - About 1 hr to fix

    Method getModuleInfo has 31 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function getModuleInfo($moduleDir)
        {
            $result['basename'] = basename($moduleDir);
            $result['name'] = $result['basename'];
            $result['description'] = '';
    Severity: Minor
    Found in includes/ModuleManager.php - About 1 hr to fix

      Avoid using undefined variables such as '$result' which will lead to PHP notices.
      Open

              $result['homepage'] = '';
      Severity: Minor
      Found in includes/ModuleManager.php by phpmd

      UndefinedVariable

      Since: 2.8.0

      Detects when a variable is used that has not been defined before.

      Example

      class Foo
      {
          private function bar()
          {
              // $message is undefined
              echo $message;
          }
      }

      Source https://phpmd.org/rules/cleancode.html#undefinedvariable

      Avoid using undefined variables such as '$result' which will lead to PHP notices.
      Open

              $result['name'] = $result['basename'];
      Severity: Minor
      Found in includes/ModuleManager.php by phpmd

      UndefinedVariable

      Since: 2.8.0

      Detects when a variable is used that has not been defined before.

      Example

      class Foo
      {
          private function bar()
          {
              // $message is undefined
              echo $message;
          }
      }

      Source https://phpmd.org/rules/cleancode.html#undefinedvariable

      Avoid using undefined variables such as '$result' which will lead to PHP notices.
      Open

              $result['license'] = '';
      Severity: Minor
      Found in includes/ModuleManager.php by phpmd

      UndefinedVariable

      Since: 2.8.0

      Detects when a variable is used that has not been defined before.

      Example

      class Foo
      {
          private function bar()
          {
              // $message is undefined
              echo $message;
          }
      }

      Source https://phpmd.org/rules/cleancode.html#undefinedvariable

      Avoid using undefined variables such as '$result' which will lead to PHP notices.
      Open

              $result['description'] = '';
      Severity: Minor
      Found in includes/ModuleManager.php by phpmd

      UndefinedVariable

      Since: 2.8.0

      Detects when a variable is used that has not been defined before.

      Example

      class Foo
      {
          private function bar()
          {
              // $message is undefined
              echo $message;
          }
      }

      Source https://phpmd.org/rules/cleancode.html#undefinedvariable

      Avoid using undefined variables such as '$result' which will lead to PHP notices.
      Open

                  return $result;
      Severity: Minor
      Found in includes/ModuleManager.php by phpmd

      UndefinedVariable

      Since: 2.8.0

      Detects when a variable is used that has not been defined before.

      Example

      class Foo
      {
          private function bar()
          {
              // $message is undefined
              echo $message;
          }
      }

      Source https://phpmd.org/rules/cleancode.html#undefinedvariable

      Avoid using undefined variables such as '$result' which will lead to PHP notices.
      Open

                  $result['description'] = $composerData->description;
      Severity: Minor
      Found in includes/ModuleManager.php by phpmd

      UndefinedVariable

      Since: 2.8.0

      Detects when a variable is used that has not been defined before.

      Example

      class Foo
      {
          private function bar()
          {
              // $message is undefined
              echo $message;
          }
      }

      Source https://phpmd.org/rules/cleancode.html#undefinedvariable

      Avoid using undefined variables such as '$result' which will lead to PHP notices.
      Open

                  $result['license'] = $composerData->license;
      Severity: Minor
      Found in includes/ModuleManager.php by phpmd

      UndefinedVariable

      Since: 2.8.0

      Detects when a variable is used that has not been defined before.

      Example

      class Foo
      {
          private function bar()
          {
              // $message is undefined
              echo $message;
          }
      }

      Source https://phpmd.org/rules/cleancode.html#undefinedvariable

      Avoid using undefined variables such as '$result' which will lead to PHP notices.
      Open

                  $result['name'] = $composerData->name;
      Severity: Minor
      Found in includes/ModuleManager.php by phpmd

      UndefinedVariable

      Since: 2.8.0

      Detects when a variable is used that has not been defined before.

      Example

      class Foo
      {
          private function bar()
          {
              // $message is undefined
              echo $message;
          }
      }

      Source https://phpmd.org/rules/cleancode.html#undefinedvariable

      Avoid using undefined variables such as '$result' which will lead to PHP notices.
      Open

              $result['basename'] = basename($moduleDir);
      Severity: Minor
      Found in includes/ModuleManager.php by phpmd

      UndefinedVariable

      Since: 2.8.0

      Detects when a variable is used that has not been defined before.

      Example

      class Foo
      {
          private function bar()
          {
              // $message is undefined
              echo $message;
          }
      }

      Source https://phpmd.org/rules/cleancode.html#undefinedvariable

      Avoid using undefined variables such as '$result' which will lead to PHP notices.
      Open

                  $result['homepage'] = $composerData->homepage;
      Severity: Minor
      Found in includes/ModuleManager.php by phpmd

      UndefinedVariable

      Since: 2.8.0

      Detects when a variable is used that has not been defined before.

      Example

      class Foo
      {
          private function bar()
          {
              // $message is undefined
              echo $message;
          }
      }

      Source https://phpmd.org/rules/cleancode.html#undefinedvariable

      Avoid using undefined variables such as '$result' which will lead to PHP notices.
      Open

              return $result;
      Severity: Minor
      Found in includes/ModuleManager.php by phpmd

      UndefinedVariable

      Since: 2.8.0

      Detects when a variable is used that has not been defined before.

      Example

      class Foo
      {
          private function bar()
          {
              // $message is undefined
              echo $message;
          }
      }

      Source https://phpmd.org/rules/cleancode.html#undefinedvariable

      Avoid using undefined variables such as '$result' which will lead to PHP notices.
      Open

                  return $result;
      Severity: Minor
      Found in includes/ModuleManager.php by phpmd

      UndefinedVariable

      Since: 2.8.0

      Detects when a variable is used that has not been defined before.

      Example

      class Foo
      {
          private function bar()
          {
              // $message is undefined
              echo $message;
          }
      }

      Source https://phpmd.org/rules/cleancode.html#undefinedvariable

      Avoid using undefined variables such as '$result' which will lead to PHP notices.
      Open

              $result['name'] = $result['basename'];
      Severity: Minor
      Found in includes/ModuleManager.php by phpmd

      UndefinedVariable

      Since: 2.8.0

      Detects when a variable is used that has not been defined before.

      Example

      class Foo
      {
          private function bar()
          {
              // $message is undefined
              echo $message;
          }
      }

      Source https://phpmd.org/rules/cleancode.html#undefinedvariable

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

          private function getModuleList($directory)
          {
              $modules = array();
              $directories = array_diff(
                  scandir($directory),
      Severity: Minor
      Found in includes/ModuleManager.php - About 1 hr to fix

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

            private function getModuleList($directory)
            {
                $modules = array();
                $directories = array_diff(
                    scandir($directory),
        Severity: Minor
        Found in includes/ModuleManager.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

        The method moduleRow has a boolean flag argument $enabled, which is a certain sign of a Single Responsibility Principle violation.
        Open

            public function moduleRow($moduleBaseName, $moduleInfo, $enabled = true)
        Severity: Minor
        Found in includes/ModuleManager.php by phpmd

        BooleanArgumentFlag

        Since: 1.4.0

        A boolean flag argument is a reliable indicator for a violation of the Single Responsibility Principle (SRP). You can fix this problem by extracting the logic in the boolean flag into its own class or method.

        Example

        class Foo {
            public function bar($flag = true) {
            }
        }

        Source https://phpmd.org/rules/cleancode.html#booleanargumentflag

        Remove error control operator '@' on line 203.
        Open

            public function getModuleInfo($moduleDir)
            {
                $result['basename'] = basename($moduleDir);
                $result['name'] = $result['basename'];
                $result['description'] = '';
        Severity: Minor
        Found in includes/ModuleManager.php by phpmd

        ErrorControlOperator

        Error suppression should be avoided if possible as it doesn't just suppress the error, that you are trying to stop, but will also suppress errors that you didn't predict would ever occur. Consider changing error_reporting() level and/or setting up your own error handler.

        Example

        function foo($filePath) {
            $file = @fopen($filPath); // hides exceptions
            $key = @$array[$notExistingKey]; // assigns null to $key
        }

        Source http://phpmd.org/rules/cleancode.html#errorcontroloperator

        Avoid too many return statements within this method.
        Open

                return true;
        Severity: Major
        Found in includes/ModuleManager.php - About 30 mins to fix
          Severity
          Category
          Status
          Source
          Language