XoopsModules25x/xoopspoll

View on GitHub

Showing 2,846 of 2,846 total issues

Similar blocks of code found in 2 locations. Consider refactoring.
Open

} elseif ('compact' === $viewmode) {
    $viewmode_options[] = [
        'link'  => XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname', 'n') . '/viewtopic.php?viewmode=thread&topic_id=' . $topic_id,
        'title' => _THREADED,
    ];
Severity: Major
Found in extras/newbb_5x/trunk_5_00/viewtopic.php and 1 other location - About 6 hrs to fix
extras/newbb_5x/trunk_5_00/viewtopic.php on lines 550..570

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 217.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Function _injectTimePicker has 165 lines of code (exceeds 25 allowed). Consider refactoring.
Open

        _injectTimePicker: function () {
            var $dp = this.inst.dpDiv,
                o = this.inst.settings,
                tp_inst = this,
                litem = '',
Severity: Major
Found in assets/js/jquery-ui-timepicker-addon.js - About 6 hrs to fix

    Function showPost has a Cognitive Complexity of 42 (exceeds 5 allowed). Consider refactoring.
    Open

        public function showPost($isadmin)
        {
            global $myts;
            global $forumUrl, $forumImage;
            global $viewtopic_users, $viewtopic_posters, $forum_obj, $topic_obj, $online, $user_karma, $viewmode, $order, $start, $total_posts, $topic_status;
    Severity: Minor
    Found in extras/newbb_5x/irmtfan/class/Post.php - About 6 hrs 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 listBlocks has 156 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function listBlocks(): void
        {
            $pathIcon16 = Admin::iconUrl('', '16');
    
            require_once XOOPS_ROOT_PATH . '/class/xoopslists.php';
    Severity: Major
    Found in class/Common/Blocksadmin.php - About 6 hrs to fix

      File PostHandler.php has 417 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      <?php declare(strict_types=1);
      
      namespace XoopsModules\Newbb;
      
      /*
      Severity: Minor
      Found in extras/newbb_5x/irmtfan/class/PostHandler.php - About 6 hrs to fix

        Function parseTime has 149 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            $.datepicker.parseTime = function (timeFormat, timeString, options) {
                var o = extendRemove(extendRemove({}, $.timepicker._defaults), options || {}),
                    iso8601 = (timeFormat.replace(/\'.*?\'/g, '').indexOf('Z') !== -1);
        
                // Strict parse requires the timeString to match the timeFormat exactly
        Severity: Major
        Found in assets/js/jquery-ui-timepicker-addon.js - About 5 hrs to fix

          Function insert has a Cognitive Complexity of 38 (exceeds 5 allowed). Consider refactoring.
          Open

              public function insert(\XoopsObject $post, $force = true)
              {
                  // Set the post time
                  // The time should be 'publish' time. To be adjusted later
                  if (!$post->getVar('post_time')) {
          Severity: Minor
          Found in extras/newbb_5x/irmtfan/class/PostHandler.php - About 5 hrs 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 insert has a Cognitive Complexity of 38 (exceeds 5 allowed). Consider refactoring.
          Open

              public function insert(\XoopsObject $post, $force = true)
              {
                  global $xoopsUser;
          
                  // Set the post time
          Severity: Minor
          Found in extras/newbb_5x/trunk_5_00/class/Post.php - About 5 hrs 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

          File main.php has 396 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          <?php declare(strict_types=1);
          
          if (defined('MAIN_DEFINED')) {
              return;
          }
          Severity: Minor
          Found in extras/newbb_5x/trunk_5_00/language/main.php - About 5 hrs to fix

            Identical blocks of code found in 2 locations. Consider refactoring.
            Open

                public function &getByLimit($topic_id, $limit, $approved = 1)
                {
                    $sql    = 'SELECT p.*, t.*, tp.topic_status FROM '
                              . $this->db->prefix('bb_posts')
                              . ' p LEFT JOIN '
            Severity: Major
            Found in extras/newbb_5x/trunk_5_00/class/Post.php and 1 other location - About 5 hrs to fix
            extras/newbb_5x/irmtfan/class/PostHandler.php on lines 67..93

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 192.

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

            Identical blocks of code found in 2 locations. Consider refactoring.
            Open

                public function &getByLimit($topic_id, $limit, $approved = 1)
                {
                    $sql    = 'SELECT p.*, t.*, tp.topic_status FROM '
                              . $this->db->prefix('bb_posts')
                              . ' p LEFT JOIN '
            Severity: Major
            Found in extras/newbb_5x/irmtfan/class/PostHandler.php and 1 other location - About 5 hrs to fix
            extras/newbb_5x/trunk_5_00/class/Post.php on lines 638..664

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 192.

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

            Function showPost has a Cognitive Complexity of 35 (exceeds 5 allowed). Consider refactoring.
            Open

                public function showPost($isadmin)
                {
                    global $xoopsConfig, $xoopsModule, $xoopsUser, $myts;
                    /** @var Xoopspoll\Helper $helper */
                    $helper = Xoopspoll\Helper::getInstance();
            Severity: Minor
            Found in extras/newbb_5x/trunk_5_00/class/Post.php - About 5 hrs 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 showPost has 124 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                public function showPost($isadmin)
                {
                    global $xoopsConfig, $xoopsModule, $xoopsUser, $myts;
                    /** @var Xoopspoll\Helper $helper */
                    $helper = Xoopspoll\Helper::getInstance();
            Severity: Major
            Found in extras/newbb_5x/trunk_5_00/class/Post.php - About 4 hrs to fix

              Function _newInst has 123 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                      _newInst: function ($input, opts) {
                          var tp_inst = new Timepicker(),
                              inlineSettings = {},
                              fns = {},
                              overrides, i;
              Severity: Major
              Found in assets/js/jquery-ui-timepicker-addon.js - About 4 hrs to fix

                Function xoopspollBlockMultiShow has a Cognitive Complexity of 33 (exceeds 5 allowed). Consider refactoring.
                Open

                function xoopspollBlockMultiShow(array $options): array
                {
                    $block           = [];
                    $pollOptionArray = [];
                    /** @var \XoopsModuleHandler $moduleHandler */
                Severity: Minor
                Found in blocks/multipoll.php - About 4 hrs 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

                Identical blocks of code found in 2 locations. Consider refactoring.
                Open

                        if ($newbbModule instanceof \XoopsModule && $newbbModule->isactive()) {
                            /** @var Newbb\TopicHandler $topicHandler */
                            $topicHandler = Newbb\Helper::getInstance()->getHandler('Topic');
                            $tFields      = ['topic_id', 'poll_id'];
                            $tArray       = $topicHandler->getAll(new \Criteria('topic_haspoll', 0, '>'), $tFields, false);
                Severity: Major
                Found in blocks/singlepoll.php and 1 other location - About 4 hrs to fix
                index.php on lines 100..116

                Duplicated Code

                Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                Tuning

                This issue has a mass of 180.

                We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                Refactorings

                Further Reading

                Identical blocks of code found in 2 locations. Consider refactoring.
                Open

                        if ($newbbModule instanceof \XoopsModule && $newbbModule->isactive()) {
                            /** @var Newbb\TopicHandler $topicHandler */
                            $topicHandler = Newbb\Helper::getInstance()->getHandler('Topic');
                            $tFields      = ['topic_id', 'poll_id'];
                            $tArray       = $topicHandler->getAll(new \Criteria('topic_haspoll', 0, '>'), $tFields, false);
                Severity: Major
                Found in index.php and 1 other location - About 4 hrs to fix
                blocks/singlepoll.php on lines 267..283

                Duplicated Code

                Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                Tuning

                This issue has a mass of 180.

                We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                Refactorings

                Further Reading

                Function listBlocks has a Cognitive Complexity of 32 (exceeds 5 allowed). Consider refactoring.
                Open

                    public function listBlocks(): void
                    {
                        $pathIcon16 = Admin::iconUrl('', '16');
                
                        require_once XOOPS_ROOT_PATH . '/class/xoopslists.php';
                Severity: Minor
                Found in class/Common/Blocksadmin.php - About 4 hrs 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 xoopspollBlockSinglepollShow has 114 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                function xoopspollBlockSinglepollShow(mixed $options): array
                {
                    $block = [];
                
                    /** @var \XoopsConfigHandler $configHandler */
                Severity: Major
                Found in blocks/singlepoll.php - About 4 hrs to fix

                  Method xoopspollBlockMultiShow has 114 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  function xoopspollBlockMultiShow(array $options): array
                  {
                      $block           = [];
                      $pollOptionArray = [];
                      /** @var \XoopsModuleHandler $moduleHandler */
                  Severity: Major
                  Found in blocks/multipoll.php - About 4 hrs to fix
                    Severity
                    Category
                    Status
                    Source
                    Language