XoopsModules25x/xoopspoll

View on GitHub

Showing 181 of 2,846 total issues

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 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 _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 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 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

        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

          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

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

                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

                  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

                    Avoid deeply nested control flow statements.
                    Open

                                                if (this.second <= this._defaults.secondMin) {
                                                    this.second = this._defaults.secondMin;
                                                    this._defaults.millisecMin = minDateTime.getMilliseconds();
                                                    if (this.millisec <= this._defaults.millisecMin) {
                                                        this.millisec = this._defaults.millisecMin;
                    Severity: Major
                    Found in assets/js/jquery-ui-timepicker-addon.js - About 45 mins to fix

                      Avoid deeply nested control flow statements.
                      Open

                                          if (overrides.hasOwnProperty(prop) && name[prop]) {
                                              fns[prop] = name[prop];
                                          }
                      Severity: Major
                      Found in assets/js/jquery-ui-timepicker-addon.js - About 45 mins to fix
                        Severity
                        Category
                        Status
                        Source
                        Language