XoopsModules25x/tag

View on GitHub

Showing 1,477 of 1,477 total issues

Function checkVerModule has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
Open

    public static function checkVerModule(Helper $helper, ?string $source = 'github', ?string $default = 'master'): ?array
    {
        $moduleDirName      = \basename(\dirname(__DIR__, 2));
        $moduleDirNameUpper = \mb_strtoupper($moduleDirName);
        $update             = '';
Severity: Minor
Found in class/Common/VersionChecks.php - About 2 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

        $cachetimes = [
            0       => _NOCACHE,
            30      => \sprintf(_SECONDS, 30),
            60      => _MINUTE,
            300     => \sprintf(_MINUTES, 5),
Severity: Major
Found in class/Common/Blocksadmin.php and 1 other location - About 2 hrs to fix
class/Common/Blocksadmin.php on lines 670..682

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

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

    public function orderBlock(
        array $bid,
        array $oldtitle,
        array $oldside,
        array $oldweight,
Severity: Minor
Found in class/Common/Blocksadmin.php - About 2 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 tag_block_top_show has 71 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function tag_block_top_show(array $options, string $dirname = '', int $catid = 0)
{
    if (!xoops_isActiveModule('tag')) {
        return false;
    }
Severity: Major
Found in blocks/block.php - About 2 hrs to fix

    Method update_stats has 66 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function update_stats(int $tag_id, int $modid = 0, int $catid = 0): bool
        {
            if (0 === $tag_id) {
                return true;
            }
    Severity: Major
    Found in class/TagHandler.php - About 2 hrs to fix

      Function tag_synchronization has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
      Open

          function tag_synchronization(): bool
          {
              /** @var \XoopsModuleHandler $moduleHandler */
              $moduleHandler = xoops_getHandler('module');
              $criteria      = new \CriteriaCompo(new \Criteria('isactive', '1'));
      Severity: Minor
      Found in include/functions.recon.php - About 2 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 truncateHtml has 63 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public static function truncateHtml(
              string $text,
              ?int $length = 100,
              string $ending = '...',
              bool $exact = false,
      Severity: Major
      Found in class/Common/SysUtility.php - About 2 hrs to fix

        Function deleteDirectory has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
        Open

            public static function deleteDirectory(string $src): 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 2 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 xoops_module_update_tag has 58 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        function xoops_module_update_tag(\XoopsModule $module, $previousVersion = null): bool
        {
            global $xoopsDB;
            $moduleDirName = \basename(\dirname(__DIR__));
        
        
        Severity: Major
        Found in include/onupdate.php - About 2 hrs to fix

          Function render has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
          Open

              public function render(?array $block = null)
              {
                  \xoops_load('XoopsFormLoader');
                  \xoops_loadLanguage('common', $this->moduleDirNameUpper);
          
          
          Severity: Minor
          Found in class/Common/Blocksadmin.php - About 2 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 4 locations. Consider refactoring.
          Open

              foreach (array_keys($items) as $cat_id) {
                  foreach (array_keys($items[$cat_id]) as $item_id) {
                      $item_obj                 = $items_obj[$item_id];
                      $items[$cat_id][$item_id] = [
                          'title'   => $item_obj->getVar('item_title'),
          Severity: Major
          Found in sample.php and 3 other locations - About 2 hrs to fix
          plugin/article.php on lines 60..72
          plugin/newbb.php on lines 60..72
          plugin/publisher.php on lines 51..64

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

          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

              foreach (array_keys($items) as $cat_id) {
                  foreach (array_keys($items[$cat_id]) as $item_id) {
                      $item_obj                 = $items_obj[$item_id];
                      $items[$cat_id][$item_id] = [
                          'title'   => $item_obj->getVar('art_title'),
          Severity: Major
          Found in plugin/article.php and 3 other locations - About 2 hrs to fix
          plugin/newbb.php on lines 60..72
          plugin/publisher.php on lines 51..64
          sample.php on lines 99..111

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

          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

              foreach (array_keys($items) as $cat_id) {
                  foreach (array_keys($items[$cat_id]) as $item_id) {
                      $item_obj                 = $items_obj[$item_id];
                      $items[$cat_id][$item_id] = [
                          'title'   => $item_obj->getVar('title'),
          Severity: Major
          Found in plugin/publisher.php and 3 other locations - About 2 hrs to fix
          plugin/article.php on lines 60..72
          plugin/newbb.php on lines 60..72
          sample.php on lines 99..111

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

          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

              foreach (array_keys($items) as $cat_id) {
                  foreach (array_keys($items[$cat_id]) as $item_id) {
                      $item_obj                 = $items_obj[$item_id];
                      $items[$cat_id][$item_id] = [
                          'title'   => $item_obj->getVar('topic_title'),
          Severity: Major
          Found in plugin/newbb.php and 3 other locations - About 2 hrs to fix
          plugin/article.php on lines 60..72
          plugin/publisher.php on lines 51..64
          sample.php on lines 99..111

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

          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 getByLimit has 53 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              public function &getByLimit($limit = Constants::UNLIMITED, $start = Constants::BEGINNING, \CriteriaElement $criteria = null, $fields = null, $fromStats = true): ?array
              {//&getByLimit($criteria = null, $fromStats = true)
                  $ret = [];
                  if ($fromStats) {
                      $sql = "SELECT DISTINCT(o.{$this->keyName}), o.tag_term, o.tag_status, SUM(l.tag_count) AS count , l.tag_modid" . " FROM {$this->table} AS o LEFT JOIN {$this->table_stats} AS l ON l.{$this->keyName} = o.{$this->keyName}";
          Severity: Major
          Found in class/TagHandler.php - About 2 hrs to fix

            Function setType has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
            Open

                public function setType($value = ''): void
                {
                    if ('' !== $value) {
                        if (\is_array($value)) {
                            $value       = isset($value['type']) ? \mb_strtolower($value['type']) : 'text';
            Severity: Minor
            Found in class/FormValidatedInput.php - About 2 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 isBlockCloned has 52 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                public function isBlockCloned(int $bid, string $bside, string $bweight, string $bvisible, string $bcachetime, ?array $bmodule, ?array $options, ?array $groups): void
                {
                    \xoops_loadLanguage('admin', 'system');
                    \xoops_loadLanguage('admin/blocksadmin', 'system');
                    \xoops_loadLanguage('admin/groups', 'system');
            Severity: Major
            Found in class/Common/Blocksadmin.php - About 2 hrs to fix

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

              if ($result instanceof \mysqli_result) {
                  while (false !== ($myrow = $GLOBALS['xoopsDB']->fetchArray($result))) {
                      $counts_module[$myrow['tag_modid']] = $myrow['count_tag'];
                  }
                  if (!empty($counts_module)) {
              Severity: Major
              Found in admin/admin.tag.php and 1 other location - About 1 hr to fix
              admin/syn.tag.php on lines 42..53

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

              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 ($result instanceof \mysqli_result) {
                  while (false !== ($myrow = $GLOBALS['xoopsDB']->fetchArray($result))) {
                      $counts_module[$myrow['tag_modid']] = $myrow['count_tag'];
                  }
                  if (!empty($counts_module)) {
              Severity: Major
              Found in admin/syn.tag.php and 1 other location - About 1 hr to fix
              admin/admin.tag.php on lines 94..105

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

              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 orderBlock has 15 arguments (exceeds 4 allowed). Consider refactoring.
              Open

                      array $bid,
                      array $oldtitle,
                      array $oldside,
                      array $oldweight,
                      array $oldvisible,
              Severity: Major
              Found in class/Common/Blocksadmin.php - About 1 hr to fix
                Severity
                Category
                Status
                Source
                Language