XoopsModules25x/xoopspoll

View on GitHub

Showing 181 of 2,846 total issues

Function _getDateDatepicker has 33 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    $.datepicker._getDateDatepicker = function (target, noDefault) {
        var inst = this._getInst(target);
        if (!inst) {
            return;
        }
Severity: Minor
Found in assets/js/jquery-ui-timepicker-addon.js - About 1 hr to fix

    Method isResultVisible has 33 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function isResultVisible()
        {
            $visibleMsg = '';
            \xoops_loadLanguage('main', 'xoopspoll');
            switch ($this->getVar('visibility')) {
    Severity: Minor
    Found in class/Poll.php - About 1 hr to fix

      Method delete has 33 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function delete($post, $isDeleteOne = true, $force = false)
          {
              $retVal = false;
              if (($post instanceof Post) && ($post->getVar('post_id') > 0)) {
                  if ($isDeleteOne) {
      Severity: Minor
      Found in extras/newbb_5x/irmtfan/class/PostHandler.php - About 1 hr to fix

        Method processOrderBlockAction has 32 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public function processOrderBlockAction(BlockData $blockData)
            {
                $blockData->bid           = Request::getArray('bid', []);
                $blockData->oldtitle      = Request::getArray('oldtitle', [], 'POST');
                $blockData->oldside       = Request::getArray('oldside', [], 'POST');
        Severity: Minor
        Found in class/Common/BlockActionsHandler.php - About 1 hr to fix

          Function mailResults has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
          Open

              public function mailResults(mixed $pollObj = null): array
              {
                  $criteria = new \CriteriaCompo();
                  $criteria->add(new \Criteria('end_time', \time(), '<'));  // expired polls
                  $criteria->add(new \Criteria('mail_status', Constants::POLL_NOT_MAILED, '=')); // email not previously sent
          Severity: Minor
          Found in class/PollHandler.php - About 1 hr 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 rrmdir has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
          Open

              public static function rrmdir(string $src): bool
              {
                  // Only continue if user is a 'global' Admin
                  if (!($GLOBALS['xoopsUser'] instanceof \XoopsUser) || !$GLOBALS['xoopsUser']->isAdmin()) {
                      return false;
          Severity: Minor
          Found in class/Common/FilesManagement.php - About 1 hr 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 hasVoted has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
          Open

              public function hasVoted(?int $pid, string $ip, int $uid = 0): bool
              {
                  $uid        = (int)$uid;
                  $pid        = (int)$pid;
                  $voted      = true;
          Severity: Minor
          Found in class/LogHandler.php - About 1 hr 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 assignResults has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
          Open

              public function assignResults(\XoopsTpl $tpl): void
              {
                  $myts             = \MyTextSanitizer::getInstance();
                  $xuEndTimestamp   = \xoops_getUserTimestamp($this->pollObj->getVar('end_time'));
                  $xuEndFormatted   = \ucfirst(\date(_MEDIUMDATESTRING, (int)$xuEndTimestamp));
          Severity: Minor
          Found in class/Renderer.php - About 1 hr 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 getServerStats has 31 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              public static function getServerStats(): string
              {
                  //mb    $wfdownloads = WfdownloadsWfdownloads::getInstance();
                  $moduleDirName      = \basename(\dirname(__DIR__, 2));
                  $moduleDirNameUpper = \mb_strtoupper($moduleDirName);
          Severity: Minor
          Found in class/Common/ServerStats.php - About 1 hr to fix

            Function _setDateDatepicker has 30 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                $.datepicker._setDateDatepicker = function (target, _date) {
                    var inst = this._getInst(target);
                    var date = _date;
                    if (!inst) {
                        return;
            Severity: Minor
            Found in assets/js/jquery-ui-timepicker-addon.js - About 1 hr to fix

              Method loadTableFromArrayWithReplace has 30 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              function loadTableFromArrayWithReplace(string $table, array $data, string $search, $replace): int
              {
                  /** @var \XoopsMySQLDatabase $db */
                  $db = \XoopsDatabaseFactory::getDatabaseConnection();
              
              
              Severity: Minor
              Found in testdata/index.php - About 1 hr to fix

                Method setPostEdit has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    public function setPostEdit($poster_name = '')
                    {
                        global $xoopsUser;
                        /** @var Xoopspoll\Helper $helper */
                        $helper = Xoopspoll\Helper::getInstance();
                Severity: Minor
                Found in extras/newbb_5x/trunk_5_00/class/Post.php - About 1 hr to fix

                  Method b_marquee_xoopspoll has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  function b_marquee_xoopspoll($limit, $dateformat, $itemssize)
                  {
                      require_once $GLOBALS['xoops']->path('modules/marquee/include/functions.php');
                      $block = [];
                      $myts  = \MyTextSanitizer::getInstance();
                  Severity: Minor
                  Found in extras/marquee/plugins/xoopspoll.php - About 1 hr to fix

                    Function looseParse has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                            var looseParse = function (f, s, o) {
                                try {
                                    var d = new Date('2012-01-01 ' + s);
                                    if (isNaN(d.getTime())) {
                                        d = new Date('2012-01-01T' + s);
                    Severity: Minor
                    Found in assets/js/jquery-ui-timepicker-addon.js - About 1 hr to fix

                      Method isBlockCloned has 9 arguments (exceeds 4 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)
                      Severity: Major
                      Found in class/Common/Blocksadmin.php - About 1 hr to fix

                        Method updateBlock has 9 arguments (exceeds 4 allowed). Consider refactoring.
                        Open

                            public function updateBlock(int $bid, string $btitle, string $bside, string $bweight, string $bvisible, string $bcachetime, ?array $bmodule, ?array $options, ?array $groups)
                        Severity: Major
                        Found in class/Common/Blocksadmin.php - About 1 hr to fix

                          Method setPostEdit has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                              public function setPostEdit($poster_name = '', $post_editmsg = '')
                              {
                                  if ($this->getVar('approved') < 1
                                      || empty($GLOBALS['xoopsModuleConfig']['recordedit_timelimit'])
                                      || (\time() - $this->getVar('post_time')) < $GLOBALS['xoopsModuleConfig']['recordedit_timelimit'] * 60) {
                          Severity: Minor
                          Found in extras/newbb_5x/irmtfan/class/Post.php - About 1 hr to fix

                            Method setVoteCookie has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                                public static function setVoteCookie($index, string $value, int $expires = 0, string $cookieBaseName = 'voted_polls'): bool
                                {
                                    $pollDir = \basename(\dirname(__DIR__));
                                    $success = false;
                                    // do a little sanity check on $index and $cookieBaseName
                            Severity: Minor
                            Found in class/Utility.php - About 1 hr to fix

                              Method setVoteCookie has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                                  public static function setVoteCookie($index, string $value, int $expires = 0, string $cookieBaseName = 'voted_polls'): bool
                                  {
                                      $pollDir = \basename(\dirname(__DIR__));
                                      $success = false;
                                      // do a little sanity check on $index and $cookieBaseName
                              Severity: Minor
                              Found in class/PollUtility.php - About 1 hr to fix

                                Function deleteAttachment has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                                Open

                                    public function deleteAttachment($attach_array = null)
                                    {
                                        $attach_old = $this->getAttachment();
                                        if (!\is_array($attach_old) || \count($attach_old) < 1) {
                                            return true;
                                Severity: Minor
                                Found in extras/newbb_5x/irmtfan/class/Post.php - About 1 hr 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