XoopsModules25x/xoopspoll

View on GitHub

Showing 181 of 2,846 total issues

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

              Function delete has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
              Open

                  public function delete(\XoopsObject $post, $isDeleteOne = true, $force = false)
                  {
                      if (!is_object($post) || 0 == $post->getVar('post_id')) {
                          return false;
                      }
              Severity: Minor
              Found in extras/newbb_5x/trunk_5_00/class/Post.php - About 55 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 setPostEdit has a Cognitive Complexity of 9 (exceeds 5 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 55 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 setPostEdit has a Cognitive Complexity of 9 (exceeds 5 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 55 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 getUserbar has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
              Open

                  public function getUserbar()
                  {
                      global $xoopsModuleConfig, $xoopsUser, $isadmin;
                      if (empty($GLOBALS['xoopsModuleConfig']['userbar_enabled'])) {
                          return null;
              Severity: Minor
              Found in extras/newbb_5x/irmtfan/class/UserLanguage.php - About 55 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 recurseCopy has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
              Open

                  public static function recurseCopy(string $src, string $dst): void
                  {
                      $dir = \opendir($src);
                      //        @mkdir($dst);
                      if (!@\mkdir($dst) && !\is_dir($dst)) {
              Severity: Minor
              Found in class/Common/FilesManagement.php - About 55 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 rmove has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
              Open

                  public static function rmove(string $src, string $dest): 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 55 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 rcopy has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
              Open

                  public static function rcopy(string $src, string $dest): 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 55 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 create has 7 arguments (exceeds 4 allowed). Consider refactoring.
              Open

                              create: function (tp_inst, obj, unit, val, min, max, step) {
              Severity: Major
              Found in assets/js/jquery-ui-timepicker-addon.js - About 50 mins to fix

                Function create has 7 arguments (exceeds 4 allowed). Consider refactoring.
                Open

                                create: function (tp_inst, obj, unit, val, min, max, step) {
                Severity: Major
                Found in assets/js/jquery-ui-timepicker-addon.js - About 50 mins to fix

                  Method setOrder has 7 arguments (exceeds 4 allowed). Consider refactoring.
                  Open

                      public function setOrder(string $bid, string $title, string $weight, string $visible, string $side, string $bcachetime, ?array $bmodule = null): void
                  Severity: Major
                  Found in class/Common/Blocksadmin.php - About 50 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

                      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

                      Severity
                      Category
                      Status
                      Source
                      Language