detain/myadmin-servers-module

View on GitHub

Showing 21 of 21 total issues

Function update_ipmi_ip has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring.
Open

function update_ipmi_ip()
{
    require_once __DIR__.'/../../../../include/functions.inc.php';
    if (isset($_SERVER['argv'])) {
        $GLOBALS['tf']->session->create(160307, 'services', false, 0, false, substr(basename($_SERVER['argv'][0], '.php'), 0, 32));
Severity: Minor
Found in bin/update_ipmi.php - About 3 hrs 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 update_ipmi_ip has 47 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function update_ipmi_ip()
{
    require_once __DIR__.'/../../../../include/functions.inc.php';
    if (isset($_SERVER['argv'])) {
        $GLOBALS['tf']->session->create(160307, 'services', false, 0, false, substr(basename($_SERVER['argv'][0], '.php'), 0, 32));
Severity: Minor
Found in bin/update_ipmi.php - About 1 hr to fix

    Method loadProcessing has 34 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public static function loadProcessing(GenericEvent $event)
        {
            /**
             * @var \ServiceHandler $service
             */
    Severity: Minor
    Found in src/Plugin.php - About 1 hr to fix

      Missing class import via use statement (line '110', column '31').
      Open

                      $smarty = new \TFSmarty();
      Severity: Minor
      Found in src/Plugin.php by phpmd

      MissingImport

      Since: 2.7.0

      Importing all external classes in a file through use statements makes them clearly visible.

      Example

      function make() {
          return new \stdClass();
      }

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

      Missing class import via use statement (line '114', column '22').
      Open

                      (new \MyAdmin\Mail())->adminMail($subject, $email, false, 'admin/server_reactivated.tpl');
      Severity: Minor
      Found in src/Plugin.php by phpmd

      MissingImport

      Since: 2.7.0

      Importing all external classes in a file through use statements makes them clearly visible.

      Example

      function make() {
          return new \stdClass();
      }

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

      The function update_ipmi_ip() contains an exit expression.
      Open

                  exit;
      Severity: Minor
      Found in bin/update_ipmi.php by phpmd

      ExitExpression

      Since: 0.2

      An exit-expression within regular code is untestable and therefore it should be avoided. Consider to move the exit-expression into some kind of startup script where an error/exception code is returned to the calling environment.

      Example

      class Foo {
          public function bar($param)  {
              if ($param === 42) {
                  exit(23);
              }
          }
      }

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

      The function update_ipmi_ip() contains an exit expression.
      Open

              die('You\'re not authorized');
      Severity: Minor
      Found in bin/update_ipmi.php by phpmd

      ExitExpression

      Since: 0.2

      An exit-expression within regular code is untestable and therefore it should be avoided. Consider to move the exit-expression into some kind of startup script where an error/exception code is returned to the calling environment.

      Example

      class Foo {
          public function bar($param)  {
              if ($param === 42) {
                  exit(23);
              }
          }
      }

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

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

                          $server_id = $db->Record['id'];
      Severity: Minor
      Found in bin/update_ipmi.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 '$serviceTypes'.
      Open

              $serviceTypes = run_event('get_service_types', false, self::$module);
      Severity: Minor
      Found in src/Plugin.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

      The variable $ip_val is not named in camelCase.
      Open

      function update_ipmi_ip()
      {
          require_once __DIR__.'/../../../../include/functions.inc.php';
          if (isset($_SERVER['argv'])) {
              $GLOBALS['tf']->session->create(160307, 'services', false, 0, false, substr(basename($_SERVER['argv'][0], '.php'), 0, 32));
      Severity: Minor
      Found in bin/update_ipmi.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 $server_id is not named in camelCase.
      Open

      function update_ipmi_ip()
      {
          require_once __DIR__.'/../../../../include/functions.inc.php';
          if (isset($_SERVER['argv'])) {
              $GLOBALS['tf']->session->create(160307, 'services', false, 0, false, substr(basename($_SERVER['argv'][0], '.php'), 0, 32));
      Severity: Minor
      Found in bin/update_ipmi.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 $ip_val is not named in camelCase.
      Open

      function update_ipmi_ip()
      {
          require_once __DIR__.'/../../../../include/functions.inc.php';
          if (isset($_SERVER['argv'])) {
              $GLOBALS['tf']->session->create(160307, 'services', false, 0, false, substr(basename($_SERVER['argv'][0], '.php'), 0, 32));
      Severity: Minor
      Found in bin/update_ipmi.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 $ip_val is not named in camelCase.
      Open

      function update_ipmi_ip()
      {
          require_once __DIR__.'/../../../../include/functions.inc.php';
          if (isset($_SERVER['argv'])) {
              $GLOBALS['tf']->session->create(160307, 'services', false, 0, false, substr(basename($_SERVER['argv'][0], '.php'), 0, 32));
      Severity: Minor
      Found in bin/update_ipmi.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 $ip_val is not named in camelCase.
      Open

      function update_ipmi_ip()
      {
          require_once __DIR__.'/../../../../include/functions.inc.php';
          if (isset($_SERVER['argv'])) {
              $GLOBALS['tf']->session->create(160307, 'services', false, 0, false, substr(basename($_SERVER['argv'][0], '.php'), 0, 32));
      Severity: Minor
      Found in bin/update_ipmi.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 $ip_val is not named in camelCase.
      Open

      function update_ipmi_ip()
      {
          require_once __DIR__.'/../../../../include/functions.inc.php';
          if (isset($_SERVER['argv'])) {
              $GLOBALS['tf']->session->create(160307, 'services', false, 0, false, substr(basename($_SERVER['argv'][0], '.php'), 0, 32));
      Severity: Minor
      Found in bin/update_ipmi.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 $mac_key is not named in camelCase.
      Open

      function update_ipmi_ip()
      {
          require_once __DIR__.'/../../../../include/functions.inc.php';
          if (isset($_SERVER['argv'])) {
              $GLOBALS['tf']->session->create(160307, 'services', false, 0, false, substr(basename($_SERVER['argv'][0], '.php'), 0, 32));
      Severity: Minor
      Found in bin/update_ipmi.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 $server_id is not named in camelCase.
      Open

      function update_ipmi_ip()
      {
          require_once __DIR__.'/../../../../include/functions.inc.php';
          if (isset($_SERVER['argv'])) {
              $GLOBALS['tf']->session->create(160307, 'services', false, 0, false, substr(basename($_SERVER['argv'][0], '.php'), 0, 32));
      Severity: Minor
      Found in bin/update_ipmi.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 $mac_key is not named in camelCase.
      Open

      function update_ipmi_ip()
      {
          require_once __DIR__.'/../../../../include/functions.inc.php';
          if (isset($_SERVER['argv'])) {
              $GLOBALS['tf']->session->create(160307, 'services', false, 0, false, substr(basename($_SERVER['argv'][0], '.php'), 0, 32));
      Severity: Minor
      Found in bin/update_ipmi.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 $mac_key is not named in camelCase.
      Open

      function update_ipmi_ip()
      {
          require_once __DIR__.'/../../../../include/functions.inc.php';
          if (isset($_SERVER['argv'])) {
              $GLOBALS['tf']->session->create(160307, 'services', false, 0, false, substr(basename($_SERVER['argv'][0], '.php'), 0, 32));
      Severity: Minor
      Found in bin/update_ipmi.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 $mac_key is not named in camelCase.
      Open

      function update_ipmi_ip()
      {
          require_once __DIR__.'/../../../../include/functions.inc.php';
          if (isset($_SERVER['argv'])) {
              $GLOBALS['tf']->session->create(160307, 'services', false, 0, false, substr(basename($_SERVER['argv'][0], '.php'), 0, 32));
      Severity: Minor
      Found in bin/update_ipmi.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

      Severity
      Category
      Status
      Source
      Language