XoopsModules25x/xoopsinfo

View on GitHub

Showing 1,065 of 16,781 total issues

Function _hostname has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring.
Open

    private function _hostname()
    {
        if (PSI_USE_VHOST === true) {
            if (CommonFunctions::readenv('SERVER_NAME', $hnm)) $this->sys->setHostname($hnm);
        } else {
Severity: Minor
Found in phpsysinfo/includes/os/class.WINNT.inc.php - About 4 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 pciconf has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring.
Open

    protected function pciconf()
    {
        $arrResults = array();
        $intS = 0;
        if (CommonFunctions::executeProgram("pciconf", "-lv", $strBuf, PSI_DEBUG)) {
Severity: Minor
Found in phpsysinfo/includes/os/class.BSDCommon.inc.php - About 4 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 execute has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring.
Open

    public function execute()
    {
        switch (strtolower(PSI_PLUGIN_HYPERV_ACCESS)) {
        case 'command':
            if (PSI_OS == 'WINNT') {
Severity: Minor
Found in phpsysinfo/plugins/hyperv/class.hyperv.inc.php - About 4 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 executeProgram has 109 lines of code (exceeds 25 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: Major
Found in phpsysinfo/includes/class.CommonFunctions.inc.php - About 4 hrs to fix

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

    <?php
    /**
     * Darwin System Class
     *
     * PHP version 5
    Severity: Minor
    Found in phpsysinfo/includes/os/class.Darwin.inc.php - About 4 hrs to fix

      Function formatBytes has 108 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      function formatBytes(bytes, xml) {
          var byteFormat = "", show = "";
      
          $("Options", xml).each(function getByteFormat(id) {
              byteFormat = $(this).attr("byteFormat");
      Severity: Major
      Found in phpsysinfo/js/phpSysInfo/phpsysinfo.js - About 4 hrs to fix

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

            public function __construct()
            {
                parent::__construct();
                $lines = "";
                switch (defined('PSI_SENSOR_IPMITOOL_ACCESS')?strtolower(PSI_SENSOR_IPMITOOL_ACCESS):'command') {
        Severity: Major
        Found in phpsysinfo/includes/mb/class.ipmitool.inc.php - About 4 hrs to fix

          Function renderPlugin_smart has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring.
          Open

          function renderPlugin_smart(data) {
          
              if ((data.Plugins.Plugin_SMART !== undefined) && (data.Plugins.Plugin_SMART.columns !== undefined) && (items(data.Plugins.Plugin_SMART.columns.column).length > 0) && (data.Plugins.Plugin_SMART.disks !== undefined) && (items(data.Plugins.Plugin_SMART.disks.disk).length > 0)) {
                  var smartitems = items(data.Plugins.Plugin_SMART.columns.column);
                  var smartnames = {
          Severity: Minor
          Found in phpsysinfo/plugins/smart/js/smart_bootstrap.js - About 4 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 renderPlugin_snmppinfo has 106 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          function renderPlugin_snmppinfo(data) {
          
              var directives = {
                  Device: {
                      text: function () {
          Severity: Major
          Found in phpsysinfo/plugins/snmppinfo/js/snmppinfo_bootstrap.js - About 4 hrs to fix

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

                public function __construct($enc)
                {
                    parent::__construct(__CLASS__, $enc);
                    switch (strtolower(PSI_PLUGIN_SMART_ACCESS)) {
                        case 'wmi':
            Severity: Major
            Found in phpsysinfo/plugins/smart/class.smart.inc.php - About 4 hrs to fix

              Function defaultPrefilter has 105 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              function defaultPrefilter( elem, props, opts ) {
                  /* jshint validthis: true */
                  var prop, value, toggle, tween, hooks, oldfire, display, checkDisplay,
                      anim = this,
                      orig = {},
              Severity: Major
              Found in phpsysinfo/js/jQuery/jquery.js - About 4 hrs to fix

                Function _fnFeatureHtmlTable has 105 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                        function _fnFeatureHtmlTable ( oSettings )
                        {
                            /* Chack if scrolling is enabled or not - if not then leave the DOM unaltered */
                            if ( oSettings.oScroll.sX === "" && oSettings.oScroll.sY === "" )
                            {
                Severity: Major
                Found in phpsysinfo/js/jQuery/jquery.dataTables.js - About 4 hrs to fix

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

                      public function __construct($enc)
                      {
                          parent::__construct(__CLASS__, $enc);
                          switch (strtolower(PSI_PLUGIN_PS_ACCESS)) {
                          case 'command':
                  Severity: Major
                  Found in phpsysinfo/plugins/ps/class.ps.inc.php - About 4 hrs to fix

                    Function _filesystems has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring.
                    Open

                        private function _filesystems()
                        {
                            $typearray = array('Unknown', 'No Root Directory', 'Removable Disk', 'Local Disk', 'Network Drive', 'Compact Disc', 'RAM Disk');
                            $floppyarray = array('Unknown', '5 1/4 in.', '3 1/2 in.', '3 1/2 in.', '3 1/2 in.', '3 1/2 in.', '5 1/4 in.', '5 1/4 in.', '5 1/4 in.', '5 1/4 in.', '5 1/4 in.', 'Other', 'HD', '3 1/2 in.', '3 1/2 in.', '5 1/4 in.', '5 1/4 in.', '3 1/2 in.', '3 1/2 in.', '5 1/4 in.', '3 1/2 in.', '3 1/2 in.', '8 in.');
                            $buffer = CommonFunctions::getWMI($this->_wmi, 'Win32_LogicalDisk', array('Name', 'Size', 'FreeSpace', 'FileSystem', 'DriveType', 'MediaType'));
                    Severity: Minor
                    Found in phpsysinfo/includes/os/class.WINNT.inc.php - About 4 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 _power has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring.
                    Open

                        private function _power()
                        {
                            $sname = '';
                            foreach ($this->_lines as $line) {
                                if ((trim($line) !== "") && (strpos($line, ':') === false)) {
                    Severity: Minor
                    Found in phpsysinfo/includes/mb/class.lmsensors.inc.php - About 4 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 _machine has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring.
                    Open

                        private function _machine()
                        {
                            $machine = "";
                            if ((CommonFunctions::rfts('/var/log/dmesg', $result, 0, 4096, false)
                                  && preg_match('/^[\s\[\]\.\d]*DMI:\s*(.*)/m', $result, $ar_buf))
                    Severity: Minor
                    Found in phpsysinfo/includes/os/class.Linux.inc.php - About 4 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 bat_getdisks has 101 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        $("Plugins Plugin_Bat Bat", xml).each(function bat_getdisks(id) {
                            var name = "", DesignCapacity = "", FullCapacity = "", Capacity = "", DesignVoltage = "",  BatteryType = "",RemainingCapacity = "", PresentVoltage = "", ChargingState = "", BatteryTemperature = "", BatteryCondition = "", CapacityUnit = "", CycleCount = "", DesignVoltageMax = "", Manufacturer = "", Model = "", SerialNumber = "";
                            name = $(this).attr("Name");
                            if (name === undefined) {
                                name = "Battery"+(batcount++);
                    Severity: Major
                    Found in phpsysinfo/plugins/bat/js/bat.js - About 4 hrs to fix

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

                      <?php
                      /**
                       * lmsensor sensor class, getting information from lmsensor
                       *
                       * PHP version 5
                      Severity: Minor
                      Found in phpsysinfo/includes/mb/class.lmsensors.inc.php - About 4 hrs to fix

                        UPSDevice has 32 functions (exceeds 20 allowed). Consider refactoring.
                        Open

                        class UPSDevice
                        {
                            /**
                             * name of the ups
                             *
                        Severity: Minor
                        Found in phpsysinfo/includes/to/device/class.UPSDevice.inc.php - About 4 hrs to fix

                          Function refreshMemory has 99 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                          function refreshMemory(xml) {
                              if ((blocks.length <= 0) || ((blocks[0] !== "true") && ($.inArray('memory', blocks) < 0))) {
                                  $("#memory").remove();
                                  return;
                              }
                          Severity: Major
                          Found in phpsysinfo/js/phpSysInfo/phpsysinfo.js - About 3 hrs to fix
                            Severity
                            Category
                            Status
                            Source
                            Language