XoopsModules25x/xoopsinfo

View on GitHub

Showing 1,065 of 16,781 total issues

Avoid deeply nested control flow statements.
Open

                        if ($cpulist && (isset($cpulist['cpu'][$cpuimplpart = strtolower($impl.','.$part)]))) {
                            if (($cpumodel = $dev->getModel()) !== '') {
                                $dev->setModel($cpumodel.' - '.$cpulist['cpu'][$cpuimplpart]);
                            } else {
                                $dev->setModel($cpulist['cpu'][$cpuimplpart]);
Severity: Major
Found in phpsysinfo/includes/os/class.Linux.inc.php - About 45 mins to fix

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

        private function _kernel()
        {
            if (CommonFunctions::executeProgram('uname', '-s', $os, PSI_DEBUG) && ($os!="")) {
                if (CommonFunctions::executeProgram('uname', '-r', $version, PSI_DEBUG) && ($version!="")) {
                    $os.=' '.$version;
    Severity: Minor
    Found in phpsysinfo/includes/os/class.SunOS.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('/\s+encap:Ethernet\s+HWaddr\s(\S+)/i', $buf2, $ar_buf2)
                                       || preg_match('/\s+encap:UNSPEC\s+HWaddr\s(\S+)-00-00-00-00-00-00-00-00-00-00\s*$/i', $buf2, $ar_buf2)
                                       || preg_match('/^\s+ether\s+(\S+)\s+txqueuelen/i', $buf2, $ar_buf2)
                                       || preg_match('/^\s+link\/ether\s+(\S+)\s+brd/i', $buf2, $ar_buf2)
                                       || preg_match('/^\s+link\/ether\s+(\S+)$/i', $buf2, $ar_buf2)
    Severity: Major
    Found in phpsysinfo/includes/os/class.Linux.inc.php - About 45 mins to fix

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

          private function _uptime()
          {
      
              if (CommonFunctions::executeProgram('pidin', 'info', $buf)
                 && preg_match('/^.* BootTime:(.*)/', $buf, $bstart)
      Severity: Minor
      Found in phpsysinfo/includes/os/class.QNX.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

                                  switch ($bufferWB[$bi]['Chemistry']) {
                                      case 1: $techn = 'Other'; break;
                                      case 2: $techn = 'Unknown'; break;
                                      case 3: $techn = 'PbAc'; break;
                                      case 4: $techn = 'NiCd'; break;
      Severity: Major
      Found in phpsysinfo/plugins/bat/class.bat.inc.php - About 45 mins to fix

        Avoid deeply nested control flow statements.
        Open

                                    if (! empty($bufferarr3)) {
                                        foreach ($bufferarr3 as $id=>$string) {
                                            $buffer .= $id." = ".$string."\n";
                                        }
                                    }                            }
        Severity: Major
        Found in phpsysinfo/includes/ups/class.snmpups.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]);
                                          }
          Severity: Major
          Found in phpsysinfo/includes/os/class.SunOS.inc.php - About 45 mins to fix

            Avoid deeply nested control flow statements.
            Open

                                        if ($batstat != '') $buffer[$bi]['state'] .= 'POWER_SUPPLY_STATUS='.$batstat."\n";
            Severity: Major
            Found in phpsysinfo/plugins/bat/class.bat.inc.php - About 45 mins to fix

              Avoid deeply nested control flow statements.
              Open

                                          for ($i = 0; $i < $total; $i++) {
                                              if (CommonFunctions::rfts($process[$i], $buf, 0, 4096, false)) {
              
                                                  if (($totalmem != 0) && (preg_match('/^VmRSS:\s+(\d+)\s+kB/m', $buf, $tmppmem))) {
                                                      $pmem = round(100 * $tmppmem[1] / $totalmem, 1);
              Severity: Major
              Found in phpsysinfo/plugins/ps/class.ps.inc.php - About 45 mins to fix

                Avoid deeply nested control flow statements.
                Open

                                            if (isset($bufferBS[$bi]['Voltage']) && ($bufferBS[$bi]['Voltage']>0)) {
                                                $buffer[$bi]['state'] .= 'POWER_SUPPLY_VOLTAGE_NOW='.($bufferBS[$bi]['Voltage']*1000)."\n";
                                                $hasvolt = true;
                                            } elseif (isset($bufferWB[$bi]['DesignVoltage']) && ($bufferWB[$bi]['DesignVoltage']>0)) {
                                                $buffer[$bi]['state'] .= 'POWER_SUPPLY_VOLTAGE_NOW='.($bufferWB[$bi]['DesignVoltage']*1000)."\n";
                Severity: Major
                Found in phpsysinfo/plugins/bat/class.bat.inc.php - About 45 mins to fix

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

                      public function execute()
                      {
                          $this->_lines = array();
                          switch (strtolower(PSI_PLUGIN_IPTABLES_ACCESS)) {
                              case 'command':
                  Severity: Minor
                  Found in phpsysinfo/plugins/iptables/class.iptables.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 (count($grouparr)) {
                                                  $this->_prtconf[$group][] = $grouparr;
                                              }
                  Severity: Major
                  Found in phpsysinfo/includes/os/class.SunOS.inc.php - About 45 mins to fix

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

                        protected function _distro()
                        {
                            $buf = "";
                            if (($lines = $this->_get_buildprop()) && preg_match('/^ro\.build\.version\.release=([^\n]+)/m', $lines, $ar_buf)) {
                                    $buf = trim($ar_buf[1]);
                    Severity: Minor
                    Found in phpsysinfo/includes/os/class.Android.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 (!empty($blocks1) && count($blocks1)) {
                                                    array_shift($blocks1);
                                                    foreach ($blocks1 as $block1) {
                                                        if (!preg_match('/^        name=\'([^\']+)\'/',$block1)
                                                           && preg_match('/^        (\S+) /',$block1, $ar_buf)) {
                    Severity: Major
                    Found in phpsysinfo/includes/os/class.SunOS.inc.php - About 45 mins to fix

                      Avoid deeply nested control flow statements.
                      Open

                                                      if (preg_match('/^\s+inet6\s+([^\s\/]+)/i', $buf2, $ar_buf2)
                                                         && ($ar_buf2[1]!="::") && !preg_match('/^fe80::/i', $ar_buf2[1]))
                                                          $dev->setInfo(($dev->getInfo()?$dev->getInfo().';':'').strtolower($ar_buf2[1]));
                      Severity: Major
                      Found in phpsysinfo/includes/os/class.SunOS.inc.php - About 45 mins to fix

                        Avoid deeply nested control flow statements.
                        Open

                                                    if (PSI_SHOW_MOUNT_OPTION) {
                                                        if (PSI_SHOW_MOUNT_CREDENTIALS) {
                                                            $dev->setOptions($mount_parm[$df_buf[1]]['options']);
                                                        } else {
                                                            $mpo=$mount_parm[$df_buf[1]]['options'];
                        Severity: Major
                        Found in phpsysinfo/includes/os/class.Android.inc.php - About 45 mins to fix

                          Avoid deeply nested control flow statements.
                          Open

                                                  if (preg_match("/^\.$/m", $include_path)) {
                                                      $include_path = ".";
                                                  }
                          Severity: Major
                          Found in phpsysinfo/includes/xml/class.XML.inc.php - About 45 mins to fix

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

                                public static function checkForExtensions($arrExt = array())
                                {
                                    if ((strcasecmp(PSI_SYSTEM_CODEPAGE, "UTF-8") == 0) || (strcasecmp(PSI_SYSTEM_CODEPAGE, "CP437") == 0))
                                        $arrReq = array('simplexml', 'pcre', 'xml', 'dom');
                                    elseif (PSI_OS == "WINNT")
                            Severity: Minor
                            Found in phpsysinfo/includes/class.CommonFunctions.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

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

                                private function _printVar($var)
                                {
                                    if (is_string($var)) {
                                        $search = array("\x00", "\x0a", "\x0d", "\x1a", "\x09");
                                        $replace = array('\0', '\n', '\r', '\Z', '\t');
                            Severity: Minor
                            Found in phpsysinfo/includes/error/class.PSI_Error.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::rfts($batdevices[$i], $pbuffer, 1, 4096, false) && trim($pbuffer[0]==="1")) {
                                                            $infoitem = '';
                                                            $stateitem = '';
                                                            CommonFunctions::rfts(preg_replace('/\/present$/', '/uevent', $batdevices[$i]), $infoitem, 0, 4096, false);
                            
                            
                            Severity: Major
                            Found in phpsysinfo/plugins/bat/class.bat.inc.php - About 45 mins to fix
                              Severity
                              Category
                              Status
                              Source
                              Language