XoopsModules25x/xoopsinfo

View on GitHub

Showing 1,065 of 16,781 total issues

Consider simplifying this complex logical expression.
Open

                    if ((isset($buffer[8]) && preg_match("/^lo-crit\s(\S+)\s*$/", $buffer[8], $limits))
                        ||(isset($buffer[9]) && preg_match("/^lo-crit\s(\S+)\s*$/", $buffer[9], $limits))
                        ||(isset($buffer[10]) && preg_match("/^lo-crit\s(\S+)\s*$/", $buffer[10], $limits))
                        ||(isset($buffer[11]) && preg_match("/^lo-crit\s(\S+)\s*$/", $buffer[11], $limits))) {
                        $dev->setMin($limits[1]);
Severity: Critical
Found in phpsysinfo/includes/mb/class.ipmiutil.inc.php - About 3 hrs to fix

    Consider simplifying this complex logical expression.
    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: Critical
    Found in phpsysinfo/includes/os/class.Linux.inc.php - About 3 hrs to fix

      Function renderNetwork has 90 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      function renderNetwork(data) {
          if ((blocks.length <= 0) || ((blocks[0] !== "true") && ($.inArray('network', blocks) < 0))) {
              $("#block_network").remove();
              return;
          }
      Severity: Major
      Found in phpsysinfo/js/phpSysInfo/phpsysinfo_bootstrap.js - About 3 hrs to fix

        Method __construct has 90 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public function __construct()
            {
                parent::__construct();
                switch (strtolower(PSI_UPS_SNMPUPS_ACCESS)) {
                case 'command':
        Severity: Major
        Found in phpsysinfo/includes/ups/class.snmpups.inc.php - About 3 hrs to fix

          Function _pci has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring.
          Open

              protected function _pci()
              {
                  if (CommonFunctions::executeProgram('listdev', '', $bufr, PSI_DEBUG)) {
          //            $devices = preg_split("/^device |\ndevice /", $bufr, -1, PREG_SPLIT_NO_EMPTY);
                      $devices = preg_split("/^device /m", $bufr, -1, PREG_SPLIT_NO_EMPTY);
          Severity: Minor
          Found in phpsysinfo/includes/os/class.Haiku.inc.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

          Function run has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring.
          Open

              public function run()
              {
                  $this->_checkTemplateLanguage();
          
                  $tpl = new Template("/templates/html/index_".$this->_indexname.".html");
          Severity: Minor
          Found in phpsysinfo/includes/output/class.Webpage.inc.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 _temperature has 88 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              private function _temperature()
              {
                  $applesmc = false;
                  $sname = '';
                  foreach ($this->_lines as $line) {
          Severity: Major
          Found in phpsysinfo/includes/mb/class.lmsensors.inc.php - About 3 hrs to fix

            Method xml has 87 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                public function xml()
                {
                    foreach ($this->_result as $bat_item) {
                        $xmlbat = $this->xml->addChild("Bat");
                        if (isset($bat_item['name'])) {
            Severity: Major
            Found in phpsysinfo/plugins/bat/class.bat.inc.php - About 3 hrs to fix

              Function _cpuinfo has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
              Open

                  protected function _cpuinfo()
                  {
              
                      if (CommonFunctions::executeProgram('sysinfo', '-cpu', $bufr, PSI_DEBUG)) {
                          $cpus = preg_split("/\nCPU #\d+/", $bufr, -1, PREG_SPLIT_NO_EMPTY);
              Severity: Minor
              Found in phpsysinfo/includes/os/class.Haiku.inc.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

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

                  protected function _users()
                  {
                      if (CommonFunctions::executeProgram('who', '', $strBuf, PSI_DEBUG)) {
                          if (strlen($strBuf) > 0) {
                              $lines = preg_split('/\n/', $strBuf);
              Severity: Minor
              Found in phpsysinfo/includes/os/class.OS.inc.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

              Function fnDestroy has 85 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                      this.fnDestroy = function ( )
                      {
                          var oSettings = _fnSettingsFromNode( this[_oExt.iApiIndex] );
                          var nOrig = oSettings.nTableWrapper.parentNode;
                          var nBody = oSettings.nTBody;
              Severity: Major
              Found in phpsysinfo/js/jQuery/jquery.dataTables.js - About 3 hrs to fix

                Function _fnBuildHead has 84 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                        function _fnBuildHead( oSettings )
                        {
                            var i, nTh, iLen, j, jLen;
                            var anTr = oSettings.nTHead.getElementsByTagName('tr');
                            var iThs = oSettings.nTHead.getElementsByTagName('th').length;
                Severity: Major
                Found in phpsysinfo/js/jQuery/jquery.dataTables.js - About 3 hrs to fix

                  Function renderFilesystem has 83 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  function renderFilesystem(data) {
                      if ((blocks.length <= 0) || ((blocks[0] !== "true") && ($.inArray('filesystem', blocks) < 0))) {
                          $("#block_filesystem").remove();
                          return;
                      }
                  Severity: Major
                  Found in phpsysinfo/js/phpSysInfo/phpsysinfo_bootstrap.js - About 3 hrs to fix

                    Method list_mimetypes has 83 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                    function list_mimetypes()
                    {
                        global $uri, $status, $mid, $start, $type;
                    
                        $mimetypes_Handler = xoops_getHandler('mimetypes');
                    Severity: Major
                    Found in modules/xoopsinfo/include/mimetypes.php - About 3 hrs to fix

                      Function reload has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
                      Open

                      function reload(initiate) {
                          $("#errorbutton").css("visibility", "hidden");
                          $("#errorbutton").css('cursor', 'default');
                          $("#errorbutton").attr('data-toggle', '');
                          $("#errors").empty();
                      Severity: Minor
                      Found in phpsysinfo/js/phpSysInfo/phpsysinfo_bootstrap.js - 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

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

                          private function _kernel()
                          {
                              $result = "";
                              if (CommonFunctions::executeProgram($uname="uptrack-uname", '-r', $strBuf, false) || // show effective kernel if ksplice uptrack is installed
                                  CommonFunctions::executeProgram($uname="uname", '-r', $strBuf, PSI_DEBUG)) {
                      Severity: Minor
                      Found in phpsysinfo/includes/os/class.Linux.inc.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

                      Function Sizzle has 81 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                      function Sizzle( selector, context, results, seed ) {
                          var m, i, elem, nid, nidselect, match, groups, newSelector,
                              newContext = context && context.ownerDocument,
                      
                              // nodeType defaults to 9, since context defaults to document
                      Severity: Major
                      Found in phpsysinfo/js/jQuery/jquery.js - About 3 hrs to fix

                        Function CHILD has 80 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                                "CHILD": function( type, what, argument, first, last ) {
                                    var simple = type.slice( 0, 3 ) !== "nth",
                                        forward = type.slice( -4 ) !== "last",
                                        ofType = what === "of-type";
                        
                        
                        Severity: Major
                        Found in phpsysinfo/js/jQuery/jquery.js - About 3 hrs to fix

                          Function getUps has 80 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                              $("UPSInfo UPS", xml).each(function getUps(id) {
                                  var name = "", model = "", mode = "", start_time = "", upsstatus = "", temperature = "", outages_count = "", last_outage = "", last_outage_finish = "", line_voltage = "", line_frequency = "", load_percent = "", battery_date = "", battery_voltage = "", battery_charge_percent = "", time_left_minutes = "";
                                  name = $(this).attr("Name");
                                  model = $(this).attr("Model");
                                  mode = $(this).attr("Mode");
                          Severity: Major
                          Found in phpsysinfo/js/phpSysInfo/phpsysinfo.js - About 3 hrs to fix

                            Method _temperature has 80 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                                private function _temperature()
                                {
                                    $ar_buf = array();
                                    switch (defined('PSI_SENSOR_HDDTEMP_ACCESS')?strtolower(PSI_SENSOR_HDDTEMP_ACCESS):'command') {
                                    case 'tcp':
                            Severity: Major
                            Found in phpsysinfo/includes/mb/class.hddtemp.inc.php - About 3 hrs to fix
                              Severity
                              Category
                              Status
                              Source
                              Language