XoopsModules25x/xoopspoll

View on GitHub

Showing 181 of 2,846 total issues

Function displayPostEdit has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

    public function displayPostEdit()
    {
        global $myts;
        /** @var Xoopspoll\Helper $helper */
        $helper = Xoopspoll\Helper::getInstance();
Severity: Minor
Found in extras/newbb_5x/trunk_5_00/class/Post.php - About 45 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

Avoid deeply nested control flow statements.
Open

                    if (false === $success) {
                        $module->setErrors(_AM_XOOPSPOLL_ERROR_COLUMN . 'visibility');
                    }
Severity: Major
Found in include/onupdate.php - About 45 mins to fix

    Avoid deeply nested control flow statements.
    Open

                                for (var h = o[litem + 'Min']; h <= max[litem]; h += parseInt(o[litem + 'Grid'], 10)) {
                                    gridSize[litem]++;
                                    var tmph = $.datepicker.formatTime(this.support.ampm ? 'hht' : 'HH', {hour: h}, o);
                                    html += '<td data-for="' + litem + '">' + tmph + '</td>';
                                }
    Severity: Major
    Found in assets/js/jquery-ui-timepicker-addon.js - About 45 mins to fix

      Avoid deeply nested control flow statements.
      Open

                                  for (var m = o[litem + 'Min']; m <= max[litem]; m += parseInt(o[litem + 'Grid'], 10)) {
                                      gridSize[litem]++;
                                      html += '<td data-for="' + litem + '">' + ((m < 10) ? '0' : '') + m + '</td>';
                                  }
      Severity: Major
      Found in assets/js/jquery-ui-timepicker-addon.js - About 45 mins to fix

        Avoid deeply nested control flow statements.
        Open

                                            if (ap.indexOf('p') !== -1 && n < 12) {
                                                n += 12;
                                            }
                                            else {
                                                if (ap.indexOf('a') !== -1 && n === 12) {
        Severity: Major
        Found in assets/js/jquery-ui-timepicker-addon.js - About 45 mins to fix

          Avoid deeply nested control flow statements.
          Open

                                      if (this.second >= this._defaults.secondMax) {
                                          this.second = this._defaults.secondMax;
                                          this._defaults.millisecMax = maxDateTime.getMilliseconds();
                                          if (this.millisec >= this._defaults.millisecMax) {
                                              this.millisec = this._defaults.millisecMax;
          Severity: Major
          Found in assets/js/jquery-ui-timepicker-addon.js - About 45 mins to fix

            Function getPostsByLimit has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
            Open

                public function &getPostsByLimit($criteria = null, $limit = 1, $start = 0, $join = null)
                {
                    $ret = [];
                    $sql = 'SELECT p.*, t.* ' . 'FROM ' . $this->db->prefix('bb_posts') . ' AS p ' . 'LEFT JOIN ' . $this->db->prefix('bb_posts_text') . ' AS t ON t.post_id = p.post_id';
                    if (!empty($join)) {
            Severity: Minor
            Found in extras/newbb_5x/irmtfan/class/PostHandler.php - About 45 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 getPostsByLimit has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
            Open

                public function &getPostsByLimit($criteria = null, $limit = 1, $start = 0, $join = null)
                {
                    $ret = [];
                    $sql = 'SELECT p.*, t.* ' . ' FROM ' . $this->db->prefix('bb_posts') . ' AS p' . ' LEFT JOIN ' . $this->db->prefix('bb_posts_text') . ' AS t ON t.post_id = p.post_id';
                    if (!empty($join)) {
            Severity: Minor
            Found in extras/newbb_5x/trunk_5_00/class/Post.php - About 45 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 getHostByAddrWithCache has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
            Open

                public static function getHostByAddrWithCache(string &$ipAddr): string
                {
                    static $ipArray = [];
                    $retVal  = &$ipAddr;
                    $options = ['flags' => \FILTER_FLAG_NO_PRIV_RANGE, \FILTER_FLAG_NO_RES_RANGE];
            Severity: Minor
            Found in class/PollUtility.php - About 45 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 getHostByAddrWithCache has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
            Open

                public static function getHostByAddrWithCache(string &$ipAddr): string
                {
                    static $ipArray = [];
                    $retVal  = &$ipAddr;
                    $options = ['flags' => \FILTER_FLAG_NO_PRIV_RANGE, \FILTER_FLAG_NO_RES_RANGE];
            Severity: Minor
            Found in class/Utility.php - About 45 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

            Consider simplifying this complex logical expression.
            Open

                    if (newbb_isAdmin($this->getVar('forum_id')) || $this->checkIdentity()) {
                        $post['text'] = $post_text . '<br>' . $this->displayAttachment();
                    } elseif ($helper->getConfig('enable_karma') && $this->getVar('post_karma') > $user_karma) {
                        $post['text'] = sprintf(_MD_KARMA_REQUIREMENT, $user_karma, $this->getVar('post_karma'));
                    } elseif ($helper->getConfig('allow_require_reply') && $this->getVar('require_reply')
            Severity: Major
            Found in extras/newbb_5x/trunk_5_00/class/Post.php - About 40 mins to fix

              Consider simplifying this complex logical expression.
              Open

                      if ($isadmin || $this->checkIdentity()) {
                          $post_text       = $this->getVar('post_text');
                          $post_attachment = $this->displayAttachment();
                      } elseif ($helper->getConfig('enable_karma') && $this->getVar('post_karma') > $user_karma) {
                          $post_text       = "<div class='karma'>" . sprintf(_MD_KARMA_REQUIREMENT, $user_karma, $this->getVar('post_karma')) . '</div>';
              Severity: Major
              Found in extras/newbb_5x/trunk_5_00/class/Post.php - About 40 mins to fix

                Consider simplifying this complex logical expression.
                Open

                        if (newbb_isAdmin($this->getVar('forum_id')) || $this->checkIdentity()) {
                            $post['text'] = $post_text . '<br>' . $this->displayAttachment();
                        } elseif ($GLOBALS['xoopsModuleConfig']['enable_karma'] && $this->getVar('post_karma') > $user_karma) {
                            $post['text'] = \sprintf(_MD_KARMA_REQUIREMENT, $user_karma, $this->getVar('post_karma'));
                        } elseif ($GLOBALS['xoopsModuleConfig']['allow_require_reply'] && $this->getVar('require_reply')
                Severity: Major
                Found in extras/newbb_5x/irmtfan/class/Post.php - About 40 mins to fix

                  Consider simplifying this complex logical expression.
                  Open

                          if ($isadmin || $this->checkIdentity()) {
                              $post_text       = $this->getVar('post_text');
                              $post_attachment = $this->displayAttachment();
                          } elseif ($GLOBALS['xoopsModuleConfig']['enable_karma'] && $this->getVar('post_karma') > $user_karma) {
                              $post_text       = "<div class='karma'>" . \sprintf(_MD_KARMA_REQUIREMENT, $user_karma, $this->getVar('post_karma')) . '</div>';
                  Severity: Major
                  Found in extras/newbb_5x/irmtfan/class/Post.php - About 40 mins to fix

                    Consider simplifying this complex logical expression.
                    Open

                                if ($oldtitle[$i] !== $title[$i]
                                    || $oldweight[$i] !== $weight[$i]
                                    || $oldvisible[$i] !== $visible[$i]
                                    || $oldside[$i] !== $side[$i]
                                    || $oldbcachetime[$i] !== $bcachetime[$i]
                    Severity: Major
                    Found in class/Common/Blocksadmin.php - About 40 mins to fix

                      Function options has 5 arguments (exceeds 4 allowed). Consider refactoring.
                      Open

                                      options: function (tp_inst, obj, unit, opts, val) {
                      Severity: Minor
                      Found in assets/js/jquery-ui-timepicker-addon.js - About 35 mins to fix

                        Function options has 5 arguments (exceeds 4 allowed). Consider refactoring.
                        Open

                                        options: function (tp_inst, obj, unit, opts, val) {
                        Severity: Minor
                        Found in assets/js/jquery-ui-timepicker-addon.js - About 35 mins to fix

                          Function parseDateTimeInternal has 5 arguments (exceeds 4 allowed). Consider refactoring.
                          Open

                              var parseDateTimeInternal = function (dateFormat, timeFormat, dateTimeString, dateSettings, timeSettings) {
                          Severity: Minor
                          Found in assets/js/jquery-ui-timepicker-addon.js - About 35 mins to fix

                            Function parseDateTime has 5 arguments (exceeds 4 allowed). Consider refactoring.
                            Open

                                $.datepicker.parseDateTime = function (dateFormat, timeFormat, dateTimeString, dateSettings, timeSettings) {
                            Severity: Minor
                            Found in assets/js/jquery-ui-timepicker-addon.js - About 35 mins to fix

                              Method xoopspoll_search has 5 arguments (exceeds 4 allowed). Consider refactoring.
                              Open

                              function xoopspoll_search($queryArray, mixed $andor, mixed $limit, mixed $offset, $uid): array
                              Severity: Minor
                              Found in include/search.php - About 35 mins to fix
                                Severity
                                Category
                                Status
                                Source
                                Language