XoopsModules25x/xoopsinfo

View on GitHub

Showing 1,065 of 16,781 total issues

Function executeProgram has a Cognitive Complexity of 63 (exceeds 5 allowed). Consider refactoring.
Open

    public static function executeProgram($strProgramname, $strArgs, &$strBuffer, $booErrorRep = true, $timeout = PSI_EXEC_TIMEOUT_INT)
    {
        if (defined('PSI_LOG') && is_string(PSI_LOG) && (strlen(PSI_LOG)>0) && ((substr(PSI_LOG, 0, 1)=="-") || (substr(PSI_LOG, 0, 1)=="+"))) {
            $out = self::_parse_log_file("Executing: ".trim($strProgramname.' '.$strArgs));
            if ($out == false) {
Severity: Minor
Found in phpsysinfo/includes/class.CommonFunctions.inc.php - About 1 day 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 renderOutput has 244 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function renderOutput($page_title = 'PHP Security Information')
    {
        /**
         * We need to use PhpSecInfo_Test::getBooleanIniValue() below
         *
Severity: Major
Found in phpsecinfo/PhpSecInfo/PhpSecInfo.php - About 1 day to fix

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

        private function _cpuinfo()
        {
            $allCpus = $this->_get_Win32_Processor();
            if (!$allCpus) {
                $hkey = "HKEY_LOCAL_MACHINE\\HARDWARE\\DESCRIPTION\\System\\CentralProcessor";
    Severity: Minor
    Found in phpsysinfo/includes/os/class.WINNT.inc.php - About 1 day 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 scsi has a Cognitive Complexity of 62 (exceeds 5 allowed). Consider refactoring.
    Open

        protected function scsi()
        {
            foreach ($this->readdmesg() as $line) {
                if (preg_match($this->_SCSIRegExp1, $line, $ar_buf)) {
                    $dev = new HWDevice();
    Severity: Minor
    Found in phpsysinfo/includes/os/class.BSDCommon.inc.php - About 1 day 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 xml has a Cognitive Complexity of 62 (exceeds 5 allowed). Consider refactoring.
    Open

        public function xml()
        {
            foreach ($this->_result as $bat_item) {
                $xmlbat = $this->xml->addChild("Bat");
                if (isset($bat_item['name'])) {
    Severity: Minor
    Found in phpsysinfo/plugins/bat/class.bat.inc.php - About 1 day 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 _network has 239 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        protected function _network()
        {
            if (CommonFunctions::rfts('/proc/net/dev', $bufr, 0, 4096, PSI_DEBUG)) {
                $bufe = preg_split("/\n/", $bufr, -1, PREG_SPLIT_NO_EMPTY);
                foreach ($bufe as $buf) {
    Severity: Major
    Found in phpsysinfo/includes/os/class.Linux.inc.php - About 1 day to fix

      System has 65 functions (exceeds 20 allowed). Consider refactoring.
      Open

      class System
      {
          /**
           * name of the host where phpSysInfo runs
           *
      Severity: Major
      Found in phpsysinfo/includes/to/class.System.inc.php - About 1 day to fix

        File bootstrap-ie8.js has 561 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        /* Bootstrap 4 for IE8 - v4.3.100          */
        /* https://github.com/namiltd/bootstrap-ie */
        
        // create the nodeType constants if the Node object is not defined
        if (!window.Node){
        Severity: Major
        Found in phpsysinfo/js/vendor/bootstrap-ie8.js - About 1 day to fix

          File class.CommonFunctions.inc.php has 549 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          <?php
          /**
           * common Functions class
           *
           * PHP version 5
          Severity: Major
          Found in phpsysinfo/includes/class.CommonFunctions.inc.php - About 1 day to fix

            Function renderHardware has 220 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            function renderHardware(data) {
                var hw_type, datas, proc_param, i;
            
                if ((blocks.length <= 0) || ((blocks[0] !== "true") && ($.inArray('hardware', blocks) < 0))) {
                    $("#block_hardware").remove();
            Severity: Major
            Found in phpsysinfo/js/phpSysInfo/phpsysinfo_bootstrap.js - About 1 day to fix

              Function refreshVitals has a Cognitive Complexity of 56 (exceeds 5 allowed). Consider refactoring.
              Open

              function refreshVitals(xml) {
                  var hostname = "", ip = "";
                  if ((blocks.length <= 0) || ((blocks[0] !== "true") && ($.inArray('vitals', blocks) < 0))) {
                      $("#vitals").remove();
                      $("Vitals", xml).each(function getVitals(id) {
              Severity: Minor
              Found in phpsysinfo/js/phpSysInfo/phpsysinfo.js - About 1 day 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 _temperature has a Cognitive Complexity of 56 (exceeds 5 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: Minor
              Found in phpsysinfo/includes/mb/class.hddtemp.inc.php - About 1 day 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 setDocument has 218 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              setDocument = Sizzle.setDocument = function( node ) {
                  var hasCompare, parent,
                      doc = node ? node.ownerDocument || node : preferredDoc;
              
                  // Return early if doc is invalid or already selected
              Severity: Major
              Found in phpsysinfo/js/jQuery/jquery.js - About 1 day to fix

                Function _network has a Cognitive Complexity of 54 (exceeds 5 allowed). Consider refactoring.
                Open

                    private function _network()
                    {
                        if (CommonFunctions::executeProgram('netstat', '-nbdi | cut -c1-24,42- | grep Link', $netstat, PSI_DEBUG)) {
                            $lines = preg_split("/\n/", $netstat, -1, PREG_SPLIT_NO_EMPTY);
                            foreach ($lines as $line) {
                Severity: Minor
                Found in phpsysinfo/includes/os/class.Darwin.inc.php - About 1 day 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 ide has a Cognitive Complexity of 54 (exceeds 5 allowed). Consider refactoring.
                Open

                    protected function ide()
                    {
                        foreach ($this->readdmesg() as $line) {
                            if (preg_match('/^(ad[0-9]+): (.*)MB <(.*)> (.*) (.*)/', $line, $ar_buf)) {
                                $dev = new HWDevice();
                Severity: Minor
                Found in phpsysinfo/includes/os/class.BSDCommon.inc.php - About 1 day 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 renderVitals has a Cognitive Complexity of 53 (exceeds 5 allowed). Consider refactoring.
                Open

                function renderVitals(data) {
                    var hostname = "", ip = "";
                
                    if ((blocks.length <= 0) || ((blocks[0] !== "true") && ($.inArray('vitals', blocks) < 0))) {
                        $("#block_vitals").remove();
                Severity: Minor
                Found in phpsysinfo/js/phpSysInfo/phpsysinfo_bootstrap.js - About 1 day 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 formatBytes has a Cognitive Complexity of 53 (exceeds 5 allowed). Consider refactoring.
                Open

                function formatBytes(bytes, byteFormat, parenths) {
                    var show = "";
                
                    if (byteFormat === undefined) {
                        byteFormat = "auto_binary";
                Severity: Minor
                Found in phpsysinfo/js/phpSysInfo/phpsysinfo_bootstrap.js - About 1 day 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 _findProgram has a Cognitive Complexity of 53 (exceeds 5 allowed). Consider refactoring.
                Open

                    private static function _findProgram($strProgram)
                    {
                        $path_parts = pathinfo($strProgram);
                        if (empty($path_parts['basename'])) {
                            return null;
                Severity: Minor
                Found in phpsysinfo/includes/class.CommonFunctions.inc.php - About 1 day 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

                File PhpSecInfo.php has 502 lines of code (exceeds 250 allowed). Consider refactoring.
                Open

                <?php declare(strict_types=1);
                
                /**
                 * Main class file
                 * @author Ed Finkler <coj@funkatron.com>
                Severity: Major
                Found in phpsecinfo/PhpSecInfo/PhpSecInfo.php - About 1 day to fix

                  Function formatBytes has a Cognitive Complexity of 51 (exceeds 5 allowed). Consider refactoring.
                  Open

                  function formatBytes(bytes, xml) {
                      var byteFormat = "", show = "";
                  
                      $("Options", xml).each(function getByteFormat(id) {
                          byteFormat = $(this).attr("byteFormat");
                  Severity: Minor
                  Found in phpsysinfo/js/phpSysInfo/phpsysinfo.js - About 7 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

                  Severity
                  Category
                  Status
                  Source
                  Language