XoopsModules25x/xoopspoll

View on GitHub

Showing 300 of 2,846 total issues

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

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

                            public function deleteAttachment($attach_array = null)
                            {
                                /** @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

                        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 isResultVisible has a Cognitive Complexity of 10 (exceeds 5 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

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

                                _parseTime: function (timeString, withDate) {
                                    if (!this.inst) {
                                        this.inst = $.datepicker._getInst(this.$input[0]);
                                    }
                        
                        
                        Severity: Minor
                        Found in assets/js/jquery-ui-timepicker-addon.js - About 1 hr to fix

                          Method loadSampleData has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                          function loadSampleData(): void
                          {
                              global $xoopsConfig;
                              $moduleDirName      = \basename(\dirname(__DIR__));
                              $moduleDirNameUpper = \mb_strtoupper($moduleDirName);
                          Severity: Minor
                          Found in testdata/index.php - About 1 hr to fix

                            Method displayPostEdit has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                                public function displayPostEdit()
                                {
                                    global $myts;
                            
                                    if (empty($GLOBALS['xoopsModuleConfig']['recordedit_timelimit'])) {
                            Severity: Minor
                            Found in extras/newbb_5x/irmtfan/class/Post.php - About 1 hr to fix

                              Method deleteAttachment has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                                  public function deleteAttachment($attach_array = null)
                                  {
                                      /** @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

                                Function _updateAlternate has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                    $.datepicker._updateAlternate = function (inst) {
                                        var tp_inst = this._get(inst, 'timepicker');
                                        if (tp_inst) {
                                            var altField = tp_inst._defaults.altField;
                                            if (altField) { // update alternate field too
                                Severity: Minor
                                Found in assets/js/jquery-ui-timepicker-addon.js - About 1 hr to fix

                                  Consider simplifying this complex logical expression.
                                  Open

                                          if (('add' === $op || 'save' === $op || 'update' === $op)
                                              && !$topic_obj->getVar('topic_haspoll')
                                              && ($GLOBALS['xoopsUser'] instanceof \XoopsUser)
                                              && ($GLOBALS['xoopsUser']->getVar('uid') === $topic_obj->getVar('topic_poster'))) {
                                              $perm = true;
                                  Severity: Major
                                  Found in extras/newbb_5x/trunk_5_00/polls.php - About 1 hr to fix
                                    Severity
                                    Category
                                    Status
                                    Source
                                    Language