XoopsModules25x/xoopsinfo

View on GitHub

Showing 16,781 of 16,781 total issues

Function renderHardware has a Cognitive Complexity of 73 (exceeds 5 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: 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

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

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

    Identical blocks of code found in 2 locations. Consider refactoring.
    Open

        private function _filesystems()
        {
            if (CommonFunctions::executeProgram('df', '-kP', $df, PSI_DEBUG)) {
                $mounts = preg_split("/\n/", $df, -1, PREG_SPLIT_NO_EMPTY);
                if (CommonFunctions::executeProgram('mount', '-v', $s, PSI_DEBUG)) {
    Severity: Major
    Found in phpsysinfo/includes/os/class.HPUX.inc.php and 1 other location - About 1 day to fix
    phpsysinfo/includes/os/class.AIX.inc.php on lines 274..299

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 318.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Identical blocks of code found in 2 locations. Consider refactoring.
    Open

        private function _filesystems()
        {
            if (CommonFunctions::executeProgram('df', '-kP', $df, PSI_DEBUG)) {
                $mounts = preg_split("/\n/", $df, -1, PREG_SPLIT_NO_EMPTY);
                if (CommonFunctions::executeProgram('mount', '-v', $s, PSI_DEBUG)) {
    Severity: Major
    Found in phpsysinfo/includes/os/class.AIX.inc.php and 1 other location - About 1 day to fix
    phpsysinfo/includes/os/class.HPUX.inc.php on lines 318..343

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 318.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

    function genlang(id, plugin) {
        var html = "", idString = "", plugname = "",
            langarrId = current_language + "_";
    
        if (plugin === undefined) {
    Severity: Major
    Found in phpsysinfo/js/phpSysInfo/phpsysinfo.js and 1 other location - About 1 day to fix
    phpsysinfo/js/phpSysInfo/phpsysinfo_bootstrap.js on lines 111..145

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 263.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

    function genlang(id, plugin) {
        var html = "", idString = "", plugname = "",
            langarrId = current_language + "_";
    
        if (plugin === undefined) {
    Severity: Major
    Found in phpsysinfo/js/phpSysInfo/phpsysinfo_bootstrap.js and 1 other location - About 1 day to fix
    phpsysinfo/js/phpSysInfo/phpsysinfo.js on lines 173..206

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 263.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    File transparency.js has 639 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    /* ========================================================================
     * transparency.js v0.10.0
     * http://leonidas.github.io/transparency/
     * Licensed under MIT (https://github.com/leonidas/transparency/blob/master/LICENSE)
     * ======================================================================== */
    Severity: Major
    Found in phpsysinfo/js/vendor/transparency.js - About 1 day to fix

      File mimetypes.php has 620 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      <?php
      // $Id: comment.php 506 2006-05-26 23:10:37Z skalpa $
      //  ------------------------------------------------------------------------ //
      //                XOOPS - PHP Content Management System                      //
      //                    Copyright (c) 2000 XOOPS.org                           //
      Severity: Major
      Found in kernel/mimetypes.php - About 1 day to fix

        Similar blocks of code found in 2 locations. Consider refactoring.
        Open

                RxBytes: {
                    html: function () {
                        var htmladd = '';
                        if (showNetworkActiveSpeed && ($.inArray(this.Name, oldnetwork) >= 0)) {
                            var diff, difftime;
        Severity: Major
        Found in phpsysinfo/js/phpSysInfo/phpsysinfo_bootstrap.js and 1 other location - About 1 day to fix
        phpsysinfo/js/phpSysInfo/phpsysinfo_bootstrap.js on lines 1119..1134

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 250.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Similar blocks of code found in 2 locations. Consider refactoring.
        Open

                TxBytes: {
                    html: function () {
                        var htmladd = '';
                        if (showNetworkActiveSpeed && ($.inArray(this.Name, oldnetwork) >= 0)) {
                            var diff, difftime;
        Severity: Major
        Found in phpsysinfo/js/phpSysInfo/phpsysinfo_bootstrap.js and 1 other location - About 1 day to fix
        phpsysinfo/js/phpSysInfo/phpsysinfo_bootstrap.js on lines 1103..1118

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 250.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Method _cpuinfo has 265 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            protected function _cpuinfo()
            {
                if (CommonFunctions::rfts('/proc/cpuinfo', $bufr)) {
                    $cpulist = null;
                    $raslist = null;
        Severity: Major
        Found in phpsysinfo/includes/os/class.Linux.inc.php - About 1 day to fix

          Function stablebit_buildTable has a Cognitive Complexity of 67 (exceeds 5 allowed). Consider refactoring.
          Open

          function stablebit_buildTable(xml) {
              var html = "", tree = [], closed = [];
          
              $("#Plugin_StableBit #Plugin_StableBitTable").remove();
          
          
          Severity: Minor
          Found in phpsysinfo/plugins/stablebit/js/stablebit.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 66 (exceeds 5 allowed). Consider refactoring.
          Open

              private function _temperature()
              {
                  $applesmc = false;
                  $sname = '';
                  foreach ($this->_lines as $line) {
          Severity: Minor
          Found in phpsysinfo/includes/mb/class.lmsensors.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 __construct has a Cognitive Complexity of 66 (exceeds 5 allowed). Consider refactoring.
          Open

              public function __construct($enc)
              {
                  parent::__construct(__CLASS__, $enc);
                  switch (strtolower(PSI_PLUGIN_SMART_ACCESS)) {
                      case 'wmi':
          Severity: Minor
          Found in phpsysinfo/plugins/smart/class.smart.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 _buildUpsinfo has a Cognitive Complexity of 64 (exceeds 5 allowed). Consider refactoring.
          Open

              private function _buildUpsinfo()
              {
                  $upsinfo = $this->_xml->addChild('UPSInfo');
                  if (defined('PSI_UPS_APCUPSD_CGI_ENABLE') && PSI_UPS_APCUPSD_CGI_ENABLE) {
                      $upsinfo->addAttribute('ApcupsdCgiLinks', true);
          Severity: Minor
          Found in phpsysinfo/includes/xml/class.XML.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 ajax has 248 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              ajax: function( url, options ) {
          
                  // If url is an object, simulate pre-1.5 signature
                  if ( typeof url === "object" ) {
                      options = url;
          Severity: Major
          Found in phpsysinfo/js/jQuery/jquery.js - About 1 day to fix

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

            function bat_buildTable(xml) {
                var html = "", tree = [], closed = [], batcount = 0;
            
                $("#Plugin_BAT #Plugin_BATTable").remove();
            
            
            Severity: Minor
            Found in phpsysinfo/plugins/bat/js/bat.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 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

              Severity
              Category
              Status
              Source
              Language