XoopsModules25x/userlog

View on GitHub

Showing 113 of 1,244 total issues

Avoid too many return statements within this method.
Open

                return $sets;
Severity: Major
Found in class/setting.php - About 30 mins to fix

    Avoid too many return statements within this method.
    Open

            return true;
    Severity: Major
    Found in class/log.php - About 30 mins to fix

      Function update_userlog_v114 has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

      function update_userlog_v114(XoopsModule $module)
      {
          $userlog    = Userlog::getInstance();
          $logsetsObj = $userlog->getHandler('setting')->getAll();
          $ret        = true;
      Severity: Minor
      Found in include/onupdate.php - About 25 mins 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 xoops_module_update_userlog has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

      function xoops_module_update_userlog(XoopsModule $module, $prev_version = null)
      {
          if ($prev_version == round($module->getInfo('version') * 100, 2)) {
              $module->setErrors('You have the latest ' . $module->getInfo('name') . ' module (' . $module->getInfo('dirname') . ' version ' . $module->getInfo('version') . ') and update is not necessary');
      //        print_r($module->getErrors());
      Severity: Minor
      Found in include/module.php - About 25 mins 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 update_userlog_v114 has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

      function update_userlog_v114(XoopsModule $module)
      {
          $userlog    = Userlog::getInstance();
          $logsetsObj = $userlog->getHandler('setting')->getAll();
          $ret        = true;
      Severity: Minor
      Found in include/module.php - About 25 mins 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 getModules has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

          public function getModules($dirnames = [], $otherCriteria = null, $asObj = false)
          {
              // get all dirnames
              /** @var XoopsModuleHandler $moduleHandler */
              $moduleHandler = xoops_getHandler('module');
      Severity: Minor
      Found in class/helper.php - About 25 mins 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 buildFileSelectEle has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

          public function buildFileSelectEle($currentFile = [], $multi = false, $size = 3)
          {
              // $modversion['config'][$i]['options'] = array(_AM_USERLOG_FILE_WORKING=>'0',_AM_USERLOG_STATS_FILEALL=>'all');
              if (0 == count($currentFile) || '0' == $currentFile[0]) {
                  $currentFile = $this->userlog->getWorkingFile();
      Severity: Minor
      Found in class/log.php - About 25 mins 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 exportLogsToCsv has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

          public function exportLogsToCsv($logs, $headers, $csvNamePrefix = 'list_', $delimiter = ';')
          {
              $csvFile = $this->userlog->getConfig('logfilepath') . '/' . USERLOG_DIRNAME . '/export/csv/' . $csvNamePrefix . '_' . date('Y-m-d_H-i-s') . '.csv';
              // file create/open/write
              /** @var \XoopsFileHandler $fileHandler */
      Severity: Minor
      Found in class/log.php - About 25 mins 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 xoops_module_update_userlog has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

      function xoops_module_update_userlog(XoopsModule $module, $prev_version = null)
      {
          if ($prev_version == round($module->getInfo('version') * 100, 2)) {
              $module->setErrors('You have the latest ' . $module->getInfo('name') . ' module (' . $module->getInfo('dirname') . ' version ' . $module->getInfo('version') . ') and update is not necessary');
              print_r($module->getErrors());
      Severity: Minor
      Found in include/onupdate.php - About 25 mins 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 userlog_views_show has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

      function userlog_views_show($options)
      {
          $loglogObj = UserlogLog::getInstance();
          $module    = [];
          if (!empty($options[1])) {
      Severity: Minor
      Found in blocks/views.php - About 25 mins 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 item has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

          public function item($subscribe_from)
          {
              if (empty($subscribe_from)) {
                  $script_arr             = [];
                  $script_arr['topic_id'] = ['viewtopic.php'];
      Severity: Minor
      Found in class/plugin/newbb.php - About 25 mins 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 mergeFiles has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

          public function mergeFiles($log_files = [], $mergeFileName = null)
          {
              $log_files = $this->parseFiles($log_files);
              if (0 == ($totalFiles = count($log_files))) {
                  $this->setErrors(_AM_USERLOG_FILE_SELECT_ONE);
      Severity: Minor
      Found in class/log.php - About 25 mins 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 preventSubmitEmptyInput has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

      function preventSubmitEmptyInput($prefix) {
          var eles = [];
          var inputs = document.getElementsByTagName("input");
          for (var i = 0; i < inputs.length; i++) {
              if (inputs[i].name.indexOf($prefix) == 0) {
      Severity: Minor
      Found in assets/js/scripts.js - About 25 mins 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