attogram/attogram-modulemanager

View on GitHub

Showing 6 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

      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

        Avoid too many return statements within this method.
        Open

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

          Function getModuleInfo has a Cognitive Complexity of 6 (exceeds 5 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 25 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

          Severity
          Category
          Status
          Source
          Language