piotrpolak/pepiscms

View on GitHub
pepiscms/application/libraries/ModuleRunner.php

Summary

Maintainability
C
7 hrs
Test Coverage

Function runAdminModule has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
Open

    public function runAdminModule($module_name, $method)
    {
        $this->load->model('Module_model');
        if (!$module_name || !self::isModuleInstalled($module_name)) {
            return false;
Severity: Minor
Found in pepiscms/application/libraries/ModuleRunner.php - About 1 hr 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

Method runModule has 45 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function runModule($module_name, $method)
    {
        $this->load->model('Module_model');
        if (!$module_name || !self::isModuleInstalled($module_name)) {
            return false;
Severity: Minor
Found in pepiscms/application/libraries/ModuleRunner.php - About 1 hr to fix

    Method runAdminModule has 45 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function runAdminModule($module_name, $method)
        {
            $this->load->model('Module_model');
            if (!$module_name || !self::isModuleInstalled($module_name)) {
                return false;
    Severity: Minor
    Found in pepiscms/application/libraries/ModuleRunner.php - About 1 hr to fix

      Function runModule has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
      Open

          public function runModule($module_name, $method)
          {
              $this->load->model('Module_model');
              if (!$module_name || !self::isModuleInstalled($module_name)) {
                  return false;
      Severity: Minor
      Found in pepiscms/application/libraries/ModuleRunner.php - About 1 hr 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 getAvailableModules has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

          public static function getAvailableModules()
          {
              $modules_dir = INSTALLATIONPATH . 'modules/';
              $modules = scandir($modules_dir);
              $modules_out = array();
      Severity: Minor
      Found in pepiscms/application/libraries/ModuleRunner.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

      There are no issues that match your filters.

      Category
      Status