XoopsModules25x/xoopsinfo

View on GitHub

Showing 1,065 of 16,781 total issues

Avoid deeply nested control flow statements.
Open

                        if (disks[i]["@attributes"][proc_param] !== undefined) {
                            html+="<tr id=\"stablebit-" + i + "-" + proc_param + "\" class=\"treegrid-parent-stablebit-" + i + "\">";
                            html+="<td><span class=\"treegrid-spanbold\">" + genlang(paramlist[proc_param], 'stablebit') + "</span></td>";
                            html+="<td class=\"rightCell\"><span data-bind=\"" + proc_param + "\"></span></td>";
                            html+="</tr>";
Severity: Major
Found in phpsysinfo/plugins/stablebit/js/stablebit_bootstrap.js - About 45 mins to fix

    Avoid deeply nested control flow statements.
    Open

              } else if (typeof value === 'object') {
                _results.push(children.push(key));
              } else {
                _results.push(void 0);
              }
    Severity: Major
    Found in phpsysinfo/js/vendor/transparency.js - About 45 mins to fix

      Avoid deeply nested control flow statements.
      Open

                          if (!isNaN(parseInt(raiditems[i]["@attributes"].Persistend_Superblock))) {
                              if (parseInt(raiditems[i]["@attributes"].Persistend_Superblock) == 1) {
                                  html += "<tr class=\"treegrid-parent-raid-" + i + "\"><td><span class=\"treegrid-spanbold\">"+genlang(15, 'raid')+"</span></td><td>"+genlang(16, 'raid')+"</td></tr>";
                              } else {
                                  html += "<tr class=\"treegrid-parent-raid-" + i + "\"><td><span class=\"treegrid-spanbold\">"+genlang(15, 'raid')+"</span></td><td>"+genlang(17, 'raid')+"</td></tr>";
      Severity: Major
      Found in phpsysinfo/plugins/raid/js/raid_bootstrap.js - About 45 mins to fix

        Avoid deeply nested control flow statements.
        Open

                            if (raiditems[i]["@attributes"].Bad_Blocks !== undefined) html += "<tr class=\"treegrid-parent-raid-" + i + "\"><td><span class=\"treegrid-spanbold\">"+genlang(26, 'raid')+"</span></td><td>" + parseInt(raiditems[i]["@attributes"].Bad_Blocks) + "</td></tr>"; // Bad_Blocks
        Severity: Major
        Found in phpsysinfo/plugins/raid/js/raid_bootstrap.js - About 45 mins to fix

          Function _checkfiles has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
          Open

              private function _checkfiles()
              {
                  if (!file_exists($this->_plugin_base."js/".strtolower($this->_plugin_name).".js")) {
                      $this->global_error->addError("file_exists(".$this->_plugin_base."js/".strtolower($this->_plugin_name).".js)", "JS-File for Plugin '".$this->_plugin_name."' is missing!");
                  } else {
          Severity: Minor
          Found in phpsysinfo/includes/plugin/class.PSI_Plugin.inc.php - About 45 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 deeply nested control flow statements.
          Open

                              if (CommonFunctions::rolv($sensor[$i], "/_input$/", "_crit_alarm")==="1") {
                                  $dev->setEvent("Critical Alarm");
                              }
          Severity: Major
          Found in phpsysinfo/includes/mb/class.hwmon.inc.php - About 45 mins to fix

            Avoid deeply nested control flow statements.
            Open

                                                if (PSI_SHOW_MOUNT_OPTION && (trim($mount_param['options'])!=="")) {
                                                    if (PSI_SHOW_MOUNT_CREDENTIALS) {
                                                        $dev->setOptions($mount_param['options']);
                                                    } else {
                                                        $mpo=$mount_param['options'];
            Severity: Major
            Found in phpsysinfo/includes/class.Parser.inc.php - About 45 mins to fix

              Function _users has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
              Open

                  protected function _users()
                  {
                      if (CommonFunctions::executeProgram('quser', '', $strBuf, false) && (strlen($strBuf) > 0)) {
                              $lines = preg_split('/\n/', $strBuf);
                              $users = count($lines)-1;
              Severity: Minor
              Found in phpsysinfo/includes/os/class.WINNT.inc.php - About 45 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 deeply nested control flow statements.
              Open

                                              if ($mount_param['mountpoint']===$df_buf[5]) {
                                                  $dev->setFsType($mount_param['fstype']);
                                                  if (PSI_SHOW_MOUNT_OPTION && (trim($mount_param['options'])!=="")) {
                                                      if (PSI_SHOW_MOUNT_CREDENTIALS) {
                                                          $dev->setOptions($mount_param['options']);
              Severity: Major
              Found in phpsysinfo/includes/class.Parser.inc.php - About 45 mins to fix

                Avoid deeply nested control flow statements.
                Open

                                                switch ($buffer[2]) {
                                                case 'degrees C':
                                                    $sens['Value'] = $buffer[1];
                                                    $sens['Unit'] = $buffer[2];
                                                    $sens['Upper Critical'] = $buffer[8];
                Severity: Major
                Found in phpsysinfo/includes/mb/class.ipmitool.inc.php - About 45 mins to fix

                  Function _machine has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                  Open

                      private function _machine()
                      {
                          $buffer = $this->_get_Win32_ComputerSystem();
                          if ($buffer) {
                              $buf = "";
                  Severity: Minor
                  Found in phpsysinfo/includes/os/class.WINNT.inc.php - About 45 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 deeply nested control flow statements.
                  Open

                                                  if (!defined('PSI_HIDE_NETWORK_MACADDR') || !PSI_HIDE_NETWORK_MACADDR) $dev->setInfo(($dev->getInfo()?$dev->getInfo().';':'').preg_replace('/:/', '-', strtoupper($ar_buf2[1])));
                  Severity: Major
                  Found in phpsysinfo/includes/os/class.QNX.inc.php - About 45 mins to fix

                    Avoid deeply nested control flow statements.
                    Open

                                                    if (preg_match('/^\s+ether\s+(\S+)/i', $buf2, $ar_buf2)) {
                                                        if (!defined('PSI_HIDE_NETWORK_MACADDR') || !PSI_HIDE_NETWORK_MACADDR) $dev->setInfo(($dev->getInfo()?$dev->getInfo().';':'').preg_replace('/:/', '-', strtoupper($ar_buf2[1])));
                                                    } elseif (preg_match('/^\s+inet\s+(\S+)\s+netmask/i', $buf2, $ar_buf2)) {
                                                        $dev->setInfo(($dev->getInfo()?$dev->getInfo().';':'').$ar_buf2[1]);
                                                    } elseif ((preg_match('/^\s+inet6\s+([^\s%]+)\s+prefixlen/i', $buf2, $ar_buf2)
                    Severity: Major
                    Found in phpsysinfo/includes/os/class.FreeBSD.inc.php - About 45 mins to fix

                      Avoid deeply nested control flow statements.
                      Open

                                                  if (preg_match('/^(\d+)\s+Hz/i', $arrBuff1, $bufr2)) {
                                                      $_cpus = round($bufr2[1]/1000000);
                                                  }
                      Severity: Major
                      Found in phpsysinfo/includes/os/class.Linux.inc.php - About 45 mins to fix

                        Avoid deeply nested control flow statements.
                        Open

                                                if (defined('PSI_SHOW_DEVICES_INFOS') && PSI_SHOW_DEVICES_INFOS
                                                   && defined('PSI_SHOW_DEVICES_SERIAL') && PSI_SHOW_DEVICES_SERIAL) {
                                                    $serial = CommonFunctions::rolv($usbdevices[$i], '/\/idProduct$/', '/serial');
                                                    if (($serial!==null) && !preg_match('/\W/', $serial)) {
                                                        $usbarray[$usbid]['serial'] = $serial;
                        Severity: Major
                        Found in phpsysinfo/includes/os/class.Linux.inc.php - About 45 mins to fix

                          Avoid deeply nested control flow statements.
                          Open

                                                      if (!defined('PSI_HIDE_NETWORK_MACADDR') || !PSI_HIDE_NETWORK_MACADDR) $dev->setInfo(($dev->getInfo()?$dev->getInfo().';':'').preg_replace('/:/', '-', strtoupper($ar_buf2[1])));
                          Severity: Major
                          Found in phpsysinfo/includes/os/class.OpenBSD.inc.php - About 45 mins to fix

                            Avoid deeply nested control flow statements.
                            Open

                                                            if (!defined('PSI_HIDE_NETWORK_MACADDR') || !PSI_HIDE_NETWORK_MACADDR) $macaddr = preg_replace('/:/', '-', strtoupper($ar_buf2[1]));
                            Severity: Major
                            Found in phpsysinfo/includes/os/class.Linux.inc.php - About 45 mins to fix

                              Avoid deeply nested control flow statements.
                              Open

                                                              if (!defined('PSI_HIDE_NETWORK_MACADDR') || !PSI_HIDE_NETWORK_MACADDR) $dev->setInfo(($dev->getInfo()?$dev->getInfo().';':'').preg_replace('/:/', '-', strtoupper($ar_buf2[1])));
                              Severity: Major
                              Found in phpsysinfo/includes/os/class.Darwin.inc.php - About 45 mins to fix

                                Function _processes has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                                Open

                                    protected function _processes()
                                    {
                                        if (CommonFunctions::executeProgram('ps', '', $bufr, PSI_DEBUG)) {
                                            $lines = preg_split("/\n/", $bufr, -1, PREG_SPLIT_NO_EMPTY);
                                            $processes['*'] = 0;
                                Severity: Minor
                                Found in phpsysinfo/includes/os/class.Haiku.inc.php - About 45 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 deeply nested control flow statements.
                                Open

                                                            if (preg_match('/^(\d+)\s+Hz/i', $arrBuff1, $bufr2)) {
                                                                $_buss = round($bufr2[1]/1000000);
                                                            }
                                Severity: Major
                                Found in phpsysinfo/includes/os/class.Linux.inc.php - About 45 mins to fix
                                  Severity
                                  Category
                                  Status
                                  Source
                                  Language