XoopsModules25x/xoopsinfo

View on GitHub

Showing 1,065 of 16,781 total issues

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

    private function _voltage()
    {
        $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 memory has a Cognitive Complexity of 32 (exceeds 5 allowed). Consider refactoring.
Open

    protected function memory()
    {
        $s = $this->grabkey('hw.memsize');
        if (CommonFunctions::executeProgram('vm_stat', '', $pstat, PSI_DEBUG)) {
            // calculate free memory from page sizes (each page = 4096)
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 _fnGatherData has 118 lines of code (exceeds 25 allowed). Consider refactoring.
Open

        function _fnGatherData( oSettings )
        {
            var iLoop, i, iLen, j, jLen, jInner,
                 nTds, nTrs, nTd, aLocalData, iThisIndex,
                iRow, iRows, iColumn, iColumns, sNodeName;
Severity: Major
Found in phpsysinfo/js/jQuery/jquery.dataTables.js - About 4 hrs to fix

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

        public function __construct($enc)
        {
            parent::__construct(__CLASS__, $enc);
    
            $RaidProgs = array();
    Severity: Major
    Found in phpsysinfo/plugins/raid/class.raid.inc.php - About 4 hrs to fix

      Consider simplifying this complex logical expression.
      Open

                      if (CommonFunctions::fileexists($filename="/etc/DISTRO_SPECS")
                         && CommonFunctions::rfts($filename, $buf, 0, 4096, false)
                         && preg_match('/^DISTRO_NAME=\'(.+)\'/m', $buf, $id_buf)) {
                          if (isset($list[trim($id_buf[1])]['Name'])) {
                              $dist = trim($list[trim($id_buf[1])]['Name']);
      Severity: Critical
      Found in phpsysinfo/includes/os/class.Linux.inc.php - About 4 hrs to fix

        Consider simplifying this complex logical expression.
        Open

                        if (preg_match('/^[dD]esign capacity:\s*(.*) (.*)$/', $roworig, $data)
                           || preg_match('/^energy-full-design:\s*(.*) (.*)$/', $roworig, $data)) {
                            $bat['design_capacity'] = str_replace(',', '.', $data[1])+0;
                            if (!isset($bat['capacity_unit'])) {
                                $bat['capacity_unit'] = trim($data[2]);
        Severity: Critical
        Found in phpsysinfo/plugins/bat/class.bat.inc.php - About 4 hrs to fix

          Function _fnAddOptionsHtml has 116 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

                  function _fnAddOptionsHtml ( oSettings )
                  {
                      /*
                       * Create a temporary, empty, div which we can later on replace with what we have generated
                       * we do it this way to rendering the 'options' html offline - speed :-)
          Severity: Major
          Found in phpsysinfo/js/jQuery/jquery.dataTables.js - About 4 hrs to fix

            Function jqTreeTable has 116 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              jq.fn.jqTreeTable=function(map, options){
                var opts = jq.extend({openImg:"",shutImg:"",leafImg:"",lastOpenImg:"",lastShutImg:"",lastLeafImg:"",vertLineImg:"",blankImg:"",collapse:false,column:0,striped:false,highlight:false,state:true},options),
                mapa=[],mapb=[],tid=this.attr("id"),collarr=[],
                stripe=function(){
                  if(opts.striped){
            Severity: Major
            Found in phpsysinfo/js/jQuery/jquery.treeTable.js - About 4 hrs to fix

              Function _fnSortingClasses has 115 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                      function _fnSortingClasses( oSettings )
                      {
                          var i, iLen, j, jLen, iFound;
                          var aaSort, sClass;
                          var iColumns = oSettings.aoColumns.length;
              Severity: Major
              Found in phpsysinfo/js/jQuery/jquery.dataTables.js - About 4 hrs to fix

                Function renderUPS has a Cognitive Complexity of 31 (exceeds 5 allowed). Consider refactoring.
                Open

                function renderUPS(data) {
                    if ((blocks.length <= 0) || ((blocks[0] !== "true") && ($.inArray('ups', blocks) < 0))) {
                        $("#block_ups").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 xml has a Cognitive Complexity of 31 (exceeds 5 allowed). Consider refactoring.
                Open

                    public function xml()
                    {
                        foreach ($this->_result as $printer=>$markersupplies_item) {
                            $xmlsnmppinfo_printer = $this->xml->addChild("Printer");
                            $xmlsnmppinfo_printer->addAttribute("Device", $printer);
                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

                Function _outputRenderTable has a Cognitive Complexity of 31 (exceeds 5 allowed). Consider refactoring.
                Open

                    public function _outputRenderTable($group_name, $group_results)
                    {
                        // exit out if $group_results was empty or not an array. This sorta seems a little hacky...
                        if (!is_array($group_results) || count($group_results) < 1) {
                            return false;
                Severity: Minor
                Found in phpsecinfo/PhpSecInfo/PhpSecInfo.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

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

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

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

                    Function renderMemory has 111 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

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

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

                      function formatBytes(bytes, byteFormat, parenths) {
                          var show = "";
                      
                          if (byteFormat === undefined) {
                              byteFormat = "auto_binary";
                      Severity: Major
                      Found in phpsysinfo/js/phpSysInfo/phpsysinfo_bootstrap.js - About 4 hrs to fix

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

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

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

                              private function _fans()
                              {
                                  $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 _voltage has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring.
                          Open

                              private function _voltage()
                              {
                                  foreach ($this->_lines as $line) {
                                      $buffer = preg_split("/\s*\|\s*/", $line);
                                      if (isset($buffer[2]) && $buffer[2] == "Voltage"
                          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 30 (exceeds 5 allowed). Consider refactoring.
                          Open

                              private function _current()
                              {
                                  foreach ($this->_lines as $line) {
                                      $buffer = preg_split("/\s*\|\s*/", $line);
                                      if (isset($buffer[2]) && $buffer[2] == "Current"
                          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

                          Severity
                          Category
                          Status
                          Source
                          Language