XoopsModules25x/xoopspoll

View on GitHub

Showing 4,407 of 4,407 total issues

Function _delete has a Cognitive Complexity of 54 (exceeds 5 allowed). Consider refactoring.
Open

    public function _delete(&$post, $force = false)
    {
        global $xoopsModule;

        if (!is_object($post) || $post->getVar('post_id') == 0) {
Severity: Minor
Found in extras/newbb_4x/trunk_4_00/class/post.php - About 1 day 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 54 (exceeds 5 allowed). Consider refactoring.
Open

    public function _delete($post, $force = false)
    {
        global $xoopsModule;

        if (!is_object($post) || 0 == $post->getVar('post_id')) {
Severity: Minor
Found in extras/newbb_5x/trunk_5_00/class/Post.php - About 1 day 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 truncateHtml has a Cognitive Complexity of 53 (exceeds 5 allowed). Consider refactoring.
Open

    public static function truncateHtml($text, $length = 100, $ending = '...', $exact = false, $considerHtml = true)
    {
        if ($considerHtml) {
            // if the plain text is shorter than the maximum length, return the whole text
            if (mb_strlen(\preg_replace('/<.*?' . '>/', '', $text)) <= $length) {
Severity: Minor
Found in class/Common/SysUtility.php - About 1 day 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 Post.php has 506 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php

namespace XoopsModules\Newbb;

/*
Severity: Major
Found in extras/newbb_5x/irmtfan/class/Post.php - About 1 day to fix

    Method showPost has 203 lines of code (exceeds 25 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: Major
    Found in extras/newbb_4x/irmtfan/class/post.php - About 1 day to fix

      File polls.php has 502 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      <?php
      /*
       * Newbb module
       *
       * You may not change or alter any portion of this comment or credits
      Severity: Major
      Found in extras/newbb_4x/irmtfan/polls.php - About 1 day to fix

        Method showPost has 201 lines of code (exceeds 25 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: Major
        Found in extras/newbb_5x/irmtfan/class/Post.php - About 1 day to fix

          File polls.php has 494 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          <?php
          /*
           * Newbb module
           *
           * You may not change or alter any portion of this comment or credits
          Severity: Minor
          Found in extras/newbb_5x/irmtfan/polls.php - About 7 hrs to fix

            File blocksadmin.php has 489 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            <?php
            /**
             * You may not change or alter any portion of this comment or credits
             * of supporting developers from this source code or any supporting source code
             * which is considered copyrighted (c) material of the original comment or credit authors.
            Severity: Minor
            Found in admin/blocksadmin.php - About 7 hrs to fix

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

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

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

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

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

                              if ($topicHandler->getPermission($forum_id, $topic_status, 'edit')) {
                                  $edit_ok = ($isadmin || ($this->checkIdentity() && $this->checkTimelimit('edit_timelimit')));
                                  if ($edit_ok) {
                                      $thread_buttons['edit']['image'] = newbb_displayImage('p_edit', _EDIT);
                                      $thread_buttons['edit']['link']  = $GLOBALS['xoops']->url('modules/' . $GLOBALS['xoopsModule']->getVar('dirname') . "/edit.php?{$page_query}");
                  Severity: Major
                  Found in extras/newbb_5x/irmtfan/class/Post.php and 3 other locations - About 7 hrs to fix
                  extras/newbb_4x/irmtfan/class/post.php on lines 529..539
                  extras/newbb_4x/irmtfan/class/post.php on lines 541..552
                  extras/newbb_5x/irmtfan/class/Post.php on lines 552..563

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

                  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

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

                              if ($topicHandler->getPermission($forum_id, $topic_status, 'delete')) {
                                  $delete_ok = ($isadmin || ($this->checkIdentity() && $this->checkTimelimit('delete_timelimit')));
                  
                                  if ($delete_ok) {
                                      $thread_buttons['delete']['image'] = newbb_displayImage('p_delete', _DELETE);
                  Severity: Major
                  Found in extras/newbb_5x/irmtfan/class/Post.php and 3 other locations - About 7 hrs to fix
                  extras/newbb_4x/irmtfan/class/post.php on lines 529..539
                  extras/newbb_4x/irmtfan/class/post.php on lines 541..552
                  extras/newbb_5x/irmtfan/class/Post.php on lines 540..550

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

                  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

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

                              if ($topicHandler->getPermission($forum_id, $topic_status, 'edit')) {
                                  $edit_ok = ($isadmin || ($this->checkIdentity() && $this->checkTimelimit('edit_timelimit')));
                                  if ($edit_ok) {
                                      $thread_buttons['edit']['image'] = newbb_displayImage('p_edit', _EDIT);
                                      $thread_buttons['edit']['link']  = $GLOBALS['xoops']->url('modules/' . $GLOBALS['xoopsModule']->getVar('dirname') . "/edit.php?{$page_query}");
                  Severity: Major
                  Found in extras/newbb_4x/irmtfan/class/post.php and 3 other locations - About 7 hrs to fix
                  extras/newbb_4x/irmtfan/class/post.php on lines 541..552
                  extras/newbb_5x/irmtfan/class/Post.php on lines 540..550
                  extras/newbb_5x/irmtfan/class/Post.php on lines 552..563

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

                  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

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

                              if ($topicHandler->getPermission($forum_id, $topic_status, 'delete')) {
                                  $delete_ok = ($isadmin || ($this->checkIdentity() && $this->checkTimelimit('delete_timelimit')));
                  
                                  if ($delete_ok) {
                                      $thread_buttons['delete']['image'] = newbb_displayImage('p_delete', _DELETE);
                  Severity: Major
                  Found in extras/newbb_4x/irmtfan/class/post.php and 3 other locations - About 7 hrs to fix
                  extras/newbb_4x/irmtfan/class/post.php on lines 529..539
                  extras/newbb_5x/irmtfan/class/Post.php on lines 540..550
                  extras/newbb_5x/irmtfan/class/Post.php on lines 552..563

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

                  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 xoops_module_update_xoopspoll has a Cognitive Complexity of 47 (exceeds 5 allowed). Consider refactoring.
                  Open

                  function xoops_module_update_xoopspoll(\XoopsModule $module, $prev_version)
                  {
                      // referer check
                      $success = false;
                      $ref     = xoops_getenv('HTTP_REFERER');
                  Severity: Minor
                  Found in include/onupdate.php - About 7 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

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

                          if ($post->getVar('approved') > 0 && empty($force)) {
                              $sql = 'UPDATE ' . $this->db->prefix('bb_posts') . ' SET approved = -1 WHERE post_id = ' . $post->getVar('post_id');
                              if (!$result = $this->db->queryF($sql)) {
                              }
                              /* delete pending post directly */
                  Severity: Major
                  Found in extras/newbb_4x/trunk_4_00/class/post.php and 1 other location - About 7 hrs to fix
                  extras/newbb_5x/trunk_5_00/class/Post.php on lines 888..908

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

                  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 (!empty($xoopsModuleConfig['rating_enabled'])) {
                      $xoopsTpl->assign('votes', $topic_obj->getVar('votes'));
                      $rating = number_format($topic_obj->getVar('rating') / 2, 0);
                      if ($rating < 1) {
                          $rating_img = newbb_displayImage('blank');
                  Severity: Major
                  Found in extras/newbb_4x/trunk_4_00/viewtopic.php and 1 other location - About 7 hrs to fix
                  extras/newbb_5x/trunk_5_00/viewtopic.php on lines 481..495

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

                  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

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

                          if ($post->getVar('approved') > 0 && empty($force)) {
                              $sql = 'UPDATE ' . $this->db->prefix('bb_posts') . ' SET approved = -1 WHERE post_id = ' . $post->getVar('post_id');
                              if (!$result = $this->db->queryF($sql)) {
                              }
                              /* delete pending post directly */
                  Severity: Major
                  Found in extras/newbb_5x/trunk_5_00/class/Post.php and 1 other location - About 7 hrs to fix
                  extras/newbb_4x/trunk_4_00/class/post.php on lines 891..911

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

                  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 (!empty($helper->getConfig('rating_enabled'))) {
                      $xoopsTpl->assign('votes', $topic_obj->getVar('votes'));
                      $rating = number_format($topic_obj->getVar('rating') / 2, 0);
                      if ($rating < 1) {
                          $rating_img = newbb_displayImage('blank');
                  Severity: Major
                  Found in extras/newbb_5x/trunk_5_00/viewtopic.php and 1 other location - About 7 hrs to fix
                  extras/newbb_4x/trunk_4_00/viewtopic.php on lines 478..492

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

                  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