XoopsModules25x/xoopspoll

View on GitHub

Showing 181 of 2,846 total issues

Method truncateHtml has 5 arguments (exceeds 4 allowed). Consider refactoring.
Open

        string $text,
        ?int $length = 100,
        ?string $ending = '...',
        ?bool $exact = false,
        ?bool $considerHtml = true
Severity: Minor
Found in class/Common/SysUtility.php - About 35 mins to fix

    Function checkIdentity has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

        public function checkIdentity($uid = -1)
        {
            //        $uid = ($uid > -1) ? $uid : (($GLOBALS['xoopsUser'] instanceof \XoopsUser) ? $GLOBALS['xoopsUser']->getVar('uid') : 0);
            if ($uid < 0 && $GLOBALS['xoopsUser'] instanceof \XoopsUser) {
                $uid = $GLOBALS['xoopsUser']->getVar('uid');
    Severity: Minor
    Found in extras/newbb_5x/irmtfan/class/Post.php - About 35 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 __construct has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

        public function __construct($id = null)
        {
            parent::__construct();
            //        $timestamp = xoops_getUserTimestamp(time());
            $currentTimestamp = \time();
    Severity: Minor
    Found in class/Poll.php - About 35 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 getEditor has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

        public static function getEditor(?\Xmf\Module\Helper $helper = null, ?array $options = null)
        {
            /** @var Helper $helper */
            if (null === $options) {
                $options           = [];
    Severity: Minor
    Found in class/Common/SysUtility.php - About 35 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

    Avoid too many return statements within this function.
    Open

                    return true;
    Severity: Major
    Found in assets/js/jquery-ui-timepicker-addon.js - About 30 mins to fix

      Avoid too many return statements within this method.
      Open

                          return false;
      Severity: Major
      Found in extras/newbb_5x/trunk_5_00/class/Post.php - About 30 mins to fix

        Avoid too many return statements within this method.
        Open

                return $post->getVar('post_id');
        Severity: Major
        Found in extras/newbb_5x/irmtfan/class/PostHandler.php - About 30 mins to fix

          Avoid too many return statements within this function.
          Open

                  return this._base_optionDatepicker.call($.datepicker, target, name_clone || name, value);
          Severity: Major
          Found in assets/js/jquery-ui-timepicker-addon.js - About 30 mins to fix

            Avoid too many return statements within this method.
            Open

                    return $post->getVar('post_id');
            Severity: Major
            Found in extras/newbb_5x/trunk_5_00/class/Post.php - About 30 mins to fix

              Avoid too many return statements within this method.
              Open

                              return false;
              Severity: Major
              Found in extras/newbb_5x/irmtfan/class/PostHandler.php - About 30 mins to fix

                Avoid too many return statements within this method.
                Open

                                    return false;
                Severity: Major
                Found in extras/newbb_5x/irmtfan/class/PostHandler.php - About 30 mins to fix

                  Avoid too many return statements within this function.
                  Open

                              return this._base_optionDatepicker.call($.datepicker, target, name);
                  Severity: Major
                  Found in assets/js/jquery-ui-timepicker-addon.js - About 30 mins to fix

                    Avoid too many return statements within this function.
                    Open

                                            return obj.slider(opts, val);
                    Severity: Major
                    Found in assets/js/jquery-ui-timepicker-addon.js - About 30 mins to fix

                      Avoid too many return statements within this method.
                      Open

                                      return false;
                      Severity: Major
                      Found in extras/newbb_5x/trunk_5_00/class/Post.php - About 30 mins to fix

                        Avoid too many return statements within this method.
                        Open

                                        return false;
                        Severity: Major
                        Found in extras/newbb_5x/irmtfan/class/PostHandler.php - About 30 mins to fix

                          Avoid too many return statements within this method.
                          Open

                                          return false;
                          Severity: Major
                          Found in extras/newbb_5x/trunk_5_00/class/Post.php - About 30 mins to fix

                            Avoid too many return statements within this function.
                            Open

                                                return obj.slider(opts);
                            Severity: Major
                            Found in assets/js/jquery-ui-timepicker-addon.js - About 30 mins to fix

                              Function loadSampleData has a Cognitive Complexity of 6 (exceeds 5 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 25 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 convertIPAddresses has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                              Open

                                  private function convertIPAddresses(string $tableName, string $columnName): void
                                  {
                                      if ($this->tableHandler->useTable($tableName)) {
                                          $attributes = $this->tableHandler->getColumnAttributes($tableName, $columnName);
                                          if (false !== mb_strpos($attributes, ' int(')) {
                              Severity: Minor
                              Found in class/Common/Migrate.php - About 25 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 assignForm has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                              Open

                                  public function assignForm(\XoopsTpl $tpl): void
                                  {
                                      $myts       = \MyTextSanitizer::getInstance();
                                      $optionObjs = $this->optionHandler->getAllByPollId($this->pollObj->getVar('poll_id'));
                              
                              
                              Severity: Minor
                              Found in class/Renderer.php - About 25 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