XoopsModules25x/xoopspoll

View on GitHub

Showing 2,846 of 2,846 total issues

Function sliderAccess has 59 lines of code (exceeds 25 allowed). Consider refactoring.
Open

        sliderAccess: function(options){
            options = options || {};
            options.touchonly = options.touchonly !== undefined? options.touchonly : true; // by default only show it if touch device

            if(options.touchonly === true && !("ontouchend" in document)){
Severity: Major
Found in assets/js/jquery-ui-sliderAccess.js - About 2 hrs to fix

    Function notifyVoter has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
    Open

        public function notifyVoter(\XoopsUser $user = null): bool
        {
            if (($user instanceof \XoopsUser) && (Constants::MAIL_POLL_TO_VOTER === $this->getVar('mail_voter'))) {
                \xoops_loadLanguage('main', 'xoopspoll');
                $xoopsMailer = \xoops_getMailer();
    Severity: Minor
    Found in class/Poll.php - About 2 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

    Method notifyVoter has 56 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function notifyVoter(\XoopsUser $user = null): bool
        {
            if (($user instanceof \XoopsUser) && (Constants::MAIL_POLL_TO_VOTER === $this->getVar('mail_voter'))) {
                \xoops_loadLanguage('main', 'xoopspoll');
                $xoopsMailer = \xoops_getMailer();
    Severity: Major
    Found in class/Poll.php - About 2 hrs to fix

      Method xoops_module_update_xoopspoll has 55 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      function xoops_module_update_xoopspoll(\XoopsModule $module, $prev_version): bool
      {
          // referer check
          $success = false;
          $ref     = xoops_getenv('HTTP_REFERER');
      Severity: Major
      Found in include/onupdate.php - About 2 hrs to fix

        Function formatTime has 55 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            $.datepicker.formatTime = function (format, time, options) {
                options = options || {};
                options = $.extend({}, $.timepicker._defaults, options);
                time = $.extend({
                    hour: 0,
        Severity: Major
        Found in assets/js/jquery-ui-timepicker-addon.js - About 2 hrs to fix

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

                          if (this.hourMinOriginal === null || this.minuteMinOriginal === null || this.secondMinOriginal === null || this.millisecMinOriginal === null || this.microsecMinOriginal === null) {
                              this.hourMinOriginal = o.hourMin;
                              this.minuteMinOriginal = o.minuteMin;
                              this.secondMinOriginal = o.secondMin;
                              this.millisecMinOriginal = o.millisecMin;
          Severity: Major
          Found in assets/js/jquery-ui-timepicker-addon.js and 1 other location - About 2 hrs to fix
          assets/js/jquery-ui-timepicker-addon.js on lines 654..660

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

          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

                          if (this.hourMaxOriginal === null || this.minuteMaxOriginal === null || this.secondMaxOriginal === null || this.millisecMaxOriginal === null) {
                              this.hourMaxOriginal = o.hourMax;
                              this.minuteMaxOriginal = o.minuteMax;
                              this.secondMaxOriginal = o.secondMax;
                              this.millisecMaxOriginal = o.millisecMax;
          Severity: Major
          Found in assets/js/jquery-ui-timepicker-addon.js and 1 other location - About 2 hrs to fix
          assets/js/jquery-ui-timepicker-addon.js on lines 598..604

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

          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

          $xoopsTpl->assign(
              [
                  'lang_forum_index' => sprintf(_MD_FORUMINDEX, htmlspecialchars($xoopsConfig['sitename'], ENT_QUOTES)),
                  'lang_from'        => _MD_FROM,
                  'lang_joined'      => _MD_JOINED,
          Severity: Major
          Found in extras/newbb_5x/irmtfan/viewtopic.php and 1 other location - About 2 hrs to fix
          extras/newbb_5x/trunk_5_00/viewtopic.php on lines 504..518

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

          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

          $xoopsTpl->assign(
              [
                  'lang_forum_index' => sprintf(_MD_FORUMINDEX, htmlspecialchars($xoopsConfig['sitename'], ENT_QUOTES)),
                  'lang_from'        => _MD_FROM,
                  'lang_joined'      => _MD_JOINED,
          Severity: Major
          Found in extras/newbb_5x/trunk_5_00/viewtopic.php and 1 other location - About 2 hrs to fix
          extras/newbb_5x/irmtfan/viewtopic.php on lines 683..697

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

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

              public function isBlockCloned(int $bid, string $bside, string $bweight, string $bvisible, string $bcachetime, ?array $bmodule, ?array $options, ?array $groups, bool $redirect = true)
              {
                  \xoops_loadLanguage('admin', 'system');
                  \xoops_loadLanguage('admin/blocksadmin', 'system');
                  \xoops_loadLanguage('admin/groups', 'system');
          Severity: Major
          Found in class/Common/Blocksadmin.php - About 2 hrs to fix

            Method getUserbar has 53 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                public function getUserbar()
                {
                    global $xoopsModuleConfig, $xoopsUser, $isadmin;
                    if (empty($GLOBALS['xoopsModuleConfig']['userbar_enabled'])) {
                        return null;
            Severity: Major
            Found in extras/newbb_5x/irmtfan/class/UserLanguage.php - About 2 hrs to fix

              Function _updateDateTime has 53 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                      _updateDateTime: function (dp_inst) {
                          dp_inst = this.inst || dp_inst;
                          var dtTmp = (dp_inst.currentYear > 0?
                                          new Date(dp_inst.currentYear, dp_inst.currentMonth, dp_inst.currentDay) :
                                          new Date(dp_inst.selectedYear, dp_inst.selectedMonth, dp_inst.selectedDay)),
              Severity: Major
              Found in assets/js/jquery-ui-timepicker-addon.js - About 2 hrs to fix

                Method displayAttachment has 53 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    public function displayAttachment($asSource = false)
                    {
                        global $xoopsModule;
                        /** @var Xoopspoll\Helper $helper */
                        $helper = Xoopspoll\Helper::getInstance();
                Severity: Major
                Found in extras/newbb_5x/trunk_5_00/class/Post.php - About 2 hrs to fix

                  Method displayAttachment has 52 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      public function displayAttachment($asSource = false)
                      {
                          $post_attachment = '';
                          $attachments     = $this->getAttachment();
                          if ($attachments && \is_array($attachments)) {
                  Severity: Major
                  Found in extras/newbb_5x/irmtfan/class/Post.php - About 2 hrs to fix

                    Method xoopspoll_search has 52 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                    function xoopspoll_search($queryArray, mixed $andor, mixed $limit, mixed $offset, $uid): array
                    {
                        $ret = [];
                        if (0 === (int)$uid) {
                            $pollHandler = Helper::getInstance()->getHandler('Poll');
                    Severity: Major
                    Found in include/search.php - About 2 hrs to fix

                      Method xoopspollBlockMultiEdit has 51 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                      function xoopspollBlockMultiEdit(mixed $options): string
                      {
                          /**
                           * Options[]
                           *        [0]    0|1 = show as option|select
                      Severity: Major
                      Found in blocks/multipoll.php - About 2 hrs to fix

                        Method approve has 51 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            public function approve(&$post, $force = false)
                            {
                                if (empty($post)) {
                                    return false;
                                }
                        Severity: Major
                        Found in extras/newbb_5x/trunk_5_00/class/Post.php - About 2 hrs to fix

                          Method approve has 49 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                              public function approve(&$post, $force = false)
                              {
                                  if (empty($post)) {
                                      return false;
                                  }
                          Severity: Minor
                          Found in extras/newbb_5x/irmtfan/class/PostHandler.php - About 1 hr to fix

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

                                public static function deleteByPollId(int $pid): mixed
                                {
                                    $trace = \debug_backtrace(\DEBUG_BACKTRACE_IGNORE_ARGS, 1);
                                    $GLOBALS['xoopsLogger']->addDeprecated(__CLASS__ . '::' . __FUNCTION__ . ' is deprecated since Xoopspoll 1.40, please use Log and LogHandler methods instead.' . " Called from {$trace[0]['file']}line {$trace[0]['line']}");
                                    /** @var LogHandler $slogHandler */
                            Severity: Major
                            Found in class/Log.php and 1 other location - About 1 hr to fix
                            class/Log.php on lines 99..109

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

                            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

                                public static function deleteByOptionId(int $opt_id): mixed
                                {
                                    $trace = \debug_backtrace(\DEBUG_BACKTRACE_IGNORE_ARGS, 1);
                                    $GLOBALS['xoopsLogger']->addDeprecated(__CLASS__ . '::' . __FUNCTION__ . ' is deprecated since Xoopspoll 1.40, please use Log and LogHandler methods instead.' . " Called from {$trace[0]['file']}line {$trace[0]['line']}");
                            
                            
                            Severity: Major
                            Found in class/Log.php and 1 other location - About 1 hr to fix
                            class/Log.php on lines 84..93

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

                            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