XoopsModules25x/xoopsinfo

View on GitHub

Showing 16,781 of 16,781 total issues

Function _temperature has a Cognitive Complexity of 89 (exceeds 5 allowed). Consider refactoring.
Open

    private function _temperature()
    {
        if (PSI_OS == 'WINNT') {
            if ($this->_buf) foreach ($this->_buf as $buffer) {
                if (isset($buffer['CurrentTemperature']) && (($value = ($buffer['CurrentTemperature'] - 2732)/10) > -100)) {
Severity: Minor
Found in phpsysinfo/includes/mb/class.thermalzone.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 89 (exceeds 5 allowed). Consider refactoring.
Open

    public function __construct()
    {
        parent::__construct();
        switch (strtolower(PSI_UPS_SNMPUPS_ACCESS)) {
        case 'command':
Severity: Minor
Found in phpsysinfo/includes/ups/class.snmpups.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 Modal has 349 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  function () {
    function Modal(element, config) {
      this._config = this._getConfig(config);
      this._element = element;
      this._dialog = element.querySelector(Selector.DIALOG);
Severity: Major
Found in phpsysinfo/js/vendor/bootstrap-modal.js - About 1 day to fix

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

    <?php
    /**
     * WINNT System Class
     *
     * PHP version 5
    Severity: Major
    Found in phpsysinfo/includes/os/class.WINNT.inc.php - About 1 day to fix

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

          private function _network()
          {
              if (CommonFunctions::executeProgram('netstat', '-ni | awk \'(NF ==10){print;}\'', $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.SunOS.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 class.bat.inc.php has 710 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      <?php
      /**
       * BAT Plugin, which displays battery state
       *
       * @category  PHP
      Severity: Major
      Found in phpsysinfo/plugins/bat/class.bat.inc.php - About 1 day to fix

        Function __construct has a Cognitive Complexity of 81 (exceeds 5 allowed). Consider refactoring.
        Open

            public function __construct()
            {
                parent::__construct();
                $lines = "";
                switch (defined('PSI_SENSOR_IPMITOOL_ACCESS')?strtolower(PSI_SENSOR_IPMITOOL_ACCESS):'command') {
        Severity: Minor
        Found in phpsysinfo/includes/mb/class.ipmitool.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 _network has a Cognitive Complexity of 81 (exceeds 5 allowed). Consider refactoring.
        Open

            private function _network()
            {
                $dev = null;
                if (CommonFunctions::executeProgram('netstat', '-nibd', $netstat, PSI_DEBUG)) {
                    $lines = preg_split("/\n/", $netstat, -1, PREG_SPLIT_NO_EMPTY);
        Severity: Minor
        Found in phpsysinfo/includes/os/class.FreeBSD.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 renderPlugin_bat has a Cognitive Complexity of 80 (exceeds 5 allowed). Consider refactoring.
        Open

        function renderPlugin_bat(data) {
            var batcount = 0;
            var directives = {
                Name: {
                    text: function () {
        Severity: Minor
        Found in phpsysinfo/plugins/bat/js/bat_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

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

            private function _power()
            {
                foreach ($this->_lines as $line) {
                    $buffer = preg_split("/\s*\|\s*/", $line);
                    if (isset($buffer[2]) && $buffer[2] == "Current"
        Severity: Major
        Found in phpsysinfo/includes/mb/class.ipmiutil.inc.php and 1 other location - About 1 day to fix
        phpsysinfo/includes/mb/class.ipmiutil.inc.php on lines 51..74

        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 342.

        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

            private function _temperature()
            {
                foreach ($this->_lines as $line) {
                    $buffer = preg_split("/\s*\|\s*/", $line);
                    if (isset($buffer[2]) && $buffer[2] == "Temperature"
        Severity: Major
        Found in phpsysinfo/includes/mb/class.ipmiutil.inc.php and 1 other location - About 1 day to fix
        phpsysinfo/includes/mb/class.ipmiutil.inc.php on lines 154..177

        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 342.

        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 execute has 314 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public function execute()
            {
                if (empty($this->_filecontent)) {
                    return;
                }
        Severity: Major
        Found in phpsysinfo/plugins/bat/class.bat.inc.php - About 1 day to fix

          Function _nvme has a Cognitive Complexity of 76 (exceeds 5 allowed). Consider refactoring.
          Open

              protected function _nvme()
              {
                  if (CommonFunctions::executeProgram('nvme', 'list', $bufr, PSI_DEBUG) && ($bufr!="")) {
                      $bufe = preg_split("/\n/", $bufr, -1, PREG_SPLIT_NO_EMPTY);
                      $count = 0;
          Severity: Minor
          Found in phpsysinfo/includes/os/class.Linux.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 _filesystems has a Cognitive Complexity of 76 (exceeds 5 allowed). Consider refactoring.
          Open

              private function _filesystems()
              {
                  $notwas = true;
                  if (CommonFunctions::executeProgram('df', '2>/dev/null ', $df, PSI_DEBUG) && preg_match("/\s+[0-9\.]+[KMGT]\s+/", $df)) {
                      $df = preg_split("/\n/", $df, -1, PREG_SPLIT_NO_EMPTY);
          Severity: Minor
          Found in phpsysinfo/includes/os/class.Android.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 _distro has 301 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              protected function _distro()
              {
                  $this->sys->setDistribution("Linux");
                  $list = @parse_ini_file(PSI_APP_ROOT."/data/distros.ini", true);
                  if (!$list) {
          Severity: Major
          Found in phpsysinfo/includes/os/class.Linux.inc.php - About 1 day to fix

            Function _info has a Cognitive Complexity of 75 (exceeds 5 allowed). Consider refactoring.
            Open

                private function _info()
                {
                    if (empty($this->_output)) {
                        return;
                    }
            Severity: Minor
            Found in phpsysinfo/includes/ups/class.snmpups.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 __construct has 294 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                public function __construct($enc)
                {
                    parent::__construct(__CLASS__, $enc);
                    $buffer = array();
                    switch (strtolower(PSI_PLUGIN_BAT_ACCESS)) {
            Severity: Major
            Found in phpsysinfo/plugins/bat/class.bat.inc.php - About 1 day to fix

              Function _devicelist has a Cognitive Complexity of 74 (exceeds 5 allowed). Consider refactoring.
              Open

                  private function _devicelist($strType)
                  {
                      if (empty($this->_wmidevices)) {
                          if (defined('PSI_SHOW_DEVICES_INFOS') && PSI_SHOW_DEVICES_INFOS) {
                              $this->_wmidevices = CommonFunctions::getWMI($this->_wmi, 'Win32_PnPEntity', array('Name', 'PNPDeviceID', 'Manufacturer', 'PNPClass'));
              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

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

              function renderPlugin_hyperv(data) {
              
                  var directives = {
                      State1: {
                          text: function () {
              Severity: Major
              Found in phpsysinfo/plugins/hyperv/js/hyperv_bootstrap.js and 1 other location - About 1 day to fix
              phpsysinfo/plugins/psstatus/js/psstatus_bootstrap.js on lines 1..32

              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 269.

              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 renderPlugin_psstatus(data) {
              
                  var directives = {
                      Status1: {
                          text: function () {
              Severity: Major
              Found in phpsysinfo/plugins/psstatus/js/psstatus_bootstrap.js and 1 other location - About 1 day to fix
              phpsysinfo/plugins/hyperv/js/hyperv_bootstrap.js on lines 1..32

              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 269.

              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

              Severity
              Category
              Status
              Source
              Language