XoopsModules25x/xoopsinfo

View on GitHub

Showing 1,065 of 16,781 total issues

Function _voltage has a Cognitive Complexity of 35 (exceeds 5 allowed). Consider refactoring.
Open

    private function _voltage($hwpath)
    {
       $sensor = glob($hwpath."in*_input", GLOB_NOSORT);
       if (is_array($sensor) && (($total = count($sensor)) > 0)) {
            $buf = "";
Severity: Minor
Found in phpsysinfo/includes/mb/class.hwmon.inc.php - About 5 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 _current has a Cognitive Complexity of 35 (exceeds 5 allowed). Consider refactoring.
Open

    private function _current($hwpath)
    {
       $sensor = glob($hwpath."curr*_input", GLOB_NOSORT);
       if (is_array($sensor) && (($total = count($sensor)) > 0)) {
            $buf = "";
Severity: Minor
Found in phpsysinfo/includes/mb/class.hwmon.inc.php - About 5 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 enumKey has a Cognitive Complexity of 35 (exceeds 5 allowed). Consider refactoring.
Open

    public static function enumKey($key, $strName, &$arrBuffer, $booErrorRep = true)
    {
        $_hkey = array('HKEY_CLASSES_ROOT'=>0x80000000, 'HKEY_CURRENT_USER'=>0x80000001, 'HKEY_LOCAL_MACHINE'=>0x80000002, 'HKEY_USERS'=>0x80000003, 'HKEY_PERFORMANCE_DATA'=>0x80000004, 'HKEY_PERFORMANCE_TEXT'=>0x80000050, 'HKEY_PERFORMANCE_NLSTEXT'=>0x80000060, 'HKEY_CURRENT_CONFIG'=>0x80000005, 'HKEY_DYN_DATA'=>0x80000006);

        $arrBuffer = array();
Severity: Minor
Found in phpsysinfo/includes/class.CommonFunctions.inc.php - About 5 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 _toUTF8 has a Cognitive Complexity of 35 (exceeds 5 allowed). Consider refactoring.
Open

    private function _toUTF8($str)
    {
        $str = trim(preg_replace('/[\x00-\x09\x0b-\x1F]/', ' ', $str)); //remove nonprintable characters
        if ($this->_encoding != null) {
            if (strcasecmp($this->_encoding, "UTF-8") == 0) {
Severity: Minor
Found in phpsysinfo/includes/xml/class.SimpleXMLExtended.inc.php - About 5 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 stablebit_buildTable has 128 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function stablebit_buildTable(xml) {
    var html = "", tree = [], closed = [];

    $("#Plugin_StableBit #Plugin_StableBitTable").remove();

Severity: Major
Found in phpsysinfo/plugins/stablebit/js/stablebit.js - About 5 hrs to fix

    Method _usb has 128 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        protected function _usb()
        {
            $usbarray = array();
            if (CommonFunctions::executeProgram('lsusb', (PSI_OS != 'Android')?'':'2>/dev/null', $bufr, PSI_DEBUG && (PSI_OS != 'Android'), 5) && ($bufr !== "")) {
                $bufe = preg_split("/\n/", $bufr, -1, PREG_SPLIT_NO_EMPTY);
    Severity: Major
    Found in phpsysinfo/includes/os/class.Linux.inc.php - About 5 hrs to fix

      Method execute_dmraid has 126 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          private function execute_dmraid($buffer)
          {
              $raiddata = preg_split("/(\r?\n\*\*\* )|(\r?\n--> )/", $buffer, -1, PREG_SPLIT_NO_EMPTY);
              if (!empty($raiddata)) {
                  $group = "";
      Severity: Major
      Found in phpsysinfo/plugins/raid/class.raid.inc.php - About 5 hrs to fix

        Consider simplifying this complex logical expression.
        Open

                    if ( event.pageX == null && original.clientX != null ) {
                        eventDoc = event.target.ownerDocument || document;
                        doc = eventDoc.documentElement;
                        body = eventDoc.body;
        
        
        Severity: Critical
        Found in phpsysinfo/js/jQuery/jquery.js - About 5 hrs to fix

          Function 2 has 123 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          },{"../lib/lodash.js":7,"./context":3,"./helpers":5}],2:[function(require,module,exports){
          var Attribute, AttributeFactory, BooleanAttribute, Class, Html, Text, helpers, _,
            __hasProp = {}.hasOwnProperty,
            __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };
          
          
          Severity: Major
          Found in phpsysinfo/js/vendor/transparency.js - About 4 hrs to fix

            Function renderFilesystem has a Cognitive Complexity of 33 (exceeds 5 allowed). Consider refactoring.
            Open

            function renderFilesystem(data) {
                if ((blocks.length <= 0) || ((blocks[0] !== "true") && ($.inArray('filesystem', blocks) < 0))) {
                    $("#block_filesystem").remove();
                    return;
                }
            Severity: Minor
            Found in phpsysinfo/js/phpSysInfo/phpsysinfo_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 _temperature has a Cognitive Complexity of 33 (exceeds 5 allowed). Consider refactoring.
            Open

                protected function _temperature($hwpath)
                {
                   $sensor = glob($hwpath."temp*_input", GLOB_NOSORT);
                   if (is_array($sensor) && (($total = count($sensor)) > 0)) {
                        $buf = "";
            Severity: Minor
            Found in phpsysinfo/includes/mb/class.hwmon.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 cpuinfo has a Cognitive Complexity of 33 (exceeds 5 allowed). Consider refactoring.
            Open

                protected function cpuinfo()
                {
                    $dev = new CpuDevice();
                    if (CommonFunctions::executeProgram('hostinfo', '| grep "Processor type"', $buf, PSI_DEBUG)) {
                        $dev->setModel(preg_replace('/Processor type: /', '', $buf));
            Severity: Minor
            Found in phpsysinfo/includes/os/class.Darwin.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 33 (exceeds 5 allowed). Consider refactoring.
            Open

                public function execute()
                {
                    if (empty($this->_filecontent)) {
                        return;
                    }
            Severity: Minor
            Found in phpsysinfo/plugins/snmppinfo/class.snmppinfo.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 _info has 122 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                private function _info()
                {
                    if (empty($this->_output)) {
                        return;
                    }
            Severity: Major
            Found in phpsysinfo/includes/ups/class.snmpups.inc.php - About 4 hrs to fix

              Function Callbacks has 121 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              jQuery.Callbacks = function( options ) {
              
                  // Convert options from String-formatted to Object-formatted if needed
                  // (we check in cache first)
                  options = typeof options === "string" ?
              Severity: Major
              Found in phpsysinfo/js/jQuery/jquery.js - About 4 hrs to fix

                Function initModal has 121 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    function initModal() {
                        debug('initModal');
                        if (!modal.full) {
                            if (currentSettings.debug)
                                setCurrentSettings({color: 'white'}, 'cssOpt', 'bg');
                Severity: Major
                Found in phpsysinfo/js/jQuery/jquery.nyroModal.js - About 4 hrs to fix

                  Function refreshVitals has 120 lines of code (exceeds 25 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: Major
                  Found in phpsysinfo/js/phpSysInfo/phpsysinfo.js - About 4 hrs to fix

                    Function refreshUps has 120 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

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

                      Function _fans has a Cognitive Complexity of 32 (exceeds 5 allowed). Consider refactoring.
                      Open

                          private function _fans()
                          {
                              foreach ($this->_lines as $line) {
                                  $buffer = preg_split("/\s*\|\s*/", $line);
                                  if (isset($buffer[2]) && $buffer[2] == "Fan"
                      Severity: Minor
                      Found in phpsysinfo/includes/mb/class.ipmiutil.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 _current has a Cognitive Complexity of 32 (exceeds 5 allowed). Consider refactoring.
                      Open

                          private function _current()
                          {
                              $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

                      Severity
                      Category
                      Status
                      Source
                      Language