XoopsModules25x/xoopspoll

View on GitHub

Showing 4,407 of 4,407 total issues

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

        if ($postcount_toupdate > 0) {

            // Update user stats
            if ($post->getVar('uid') > 0) {
                $memberHandler = xoops_getHandler('member');
Severity: Major
Found in extras/newbb_4x/trunk_4_00/class/post.php and 1 other location - About 5 hrs to fix
extras/newbb_5x/trunk_5_00/class/Post.php on lines 963..979

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

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 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_4x/trunk_4_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

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

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

        if ($GLOBALS['xoopsModuleConfig']['enable_permcheck']) {
            /** @var NewbbTopicHandler $topicHandler */
            $topicHandler = \XoopsModules\Newbb\Helper::getInstance()->getHandler('Topic');
            $topic_status = $topic_obj->getVar('topic_status');
            if ($topicHandler->getPermission($forum_id, $topic_status, 'edit')) {
Severity: Major
Found in extras/newbb_4x/trunk_4_00/class/post.php and 1 other location - About 5 hrs to fix
extras/newbb_5x/trunk_5_00/class/Post.php on lines 499..543

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

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 ($GLOBALS['xoopsModuleConfig']['enable_permcheck']) {
            /** @var Newbb\TopicHandler $topicHandler */
            $topicHandler = Newbb\Helper::getInstance()->getHandler('Topic');
            $topic_status = $topic_obj->getVar('topic_status');
            if ($topicHandler->getPermission($forum_id, $topic_status, 'edit')) {
Severity: Major
Found in extras/newbb_5x/trunk_5_00/class/Post.php and 1 other location - About 5 hrs to fix
extras/newbb_4x/trunk_4_00/class/post.php on lines 497..541

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

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

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

<?php
//
if (defined('MAIN_DEFINED')) {
    return;
}
Severity: Minor
Found in extras/newbb_4x/trunk_4_00/language/main.php - About 5 hrs to fix

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

    <?php
    
    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 setAttachment($name_saved = '', $name_display = '', $mimetype = '', $num_download = 0)
          {
              static $counter = 0;
              $this->attachment_array = $this->getAttachment();
              if ($name_saved) {
      Severity: Major
      Found in extras/newbb_4x/irmtfan/class/post.php and 1 other location - About 5 hrs to fix
      extras/newbb_4x/trunk_4_00/class/post.php on lines 159..180

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

      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 setAttachment($name_saved = '', $name_display = '', $mimetype = '', $num_download = 0)
          {
              static $counter = 0;
              $this->attachment_array = $this->getAttachment();
              if ($name_saved) {
      Severity: Major
      Found in extras/newbb_4x/trunk_4_00/class/post.php and 1 other location - About 5 hrs to fix
      extras/newbb_4x/irmtfan/class/post.php on lines 172..193

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

      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, $xoopsModuleConfig, $xoopsUser, $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_4x/trunk_4_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

      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

      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 71..95

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

      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 614..638

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

      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

      Method showPost has 124 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function showPost($isadmin)
          {
              global $xoopsConfig, $xoopsModule, $xoopsModuleConfig, $xoopsUser, $myts;
              global $forumUrl, $forumImage;
              global $viewtopic_users, $viewtopic_posters, $forum_obj, $topic_obj, $online, $user_karma, $viewmode, $order, $start, $total_posts, $topic_status;
      Severity: Major
      Found in extras/newbb_4x/trunk_4_00/class/post.php - About 4 hrs to fix

        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($options)
            {
                $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 index.php and 1 other location - About 4 hrs to fix
            blocks/singlepoll.php on lines 265..281

            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

                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_4x/trunk_4_00/class/post.php and 1 other location - About 4 hrs to fix
            extras/newbb_4x/irmtfan/class/post.php on lines 709..724

            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

            Severity
            Category
            Status
            Source
            Language