mambax7/wflinks

View on GitHub

Showing 201 of 201 total issues

Function list_blocks has a Cognitive Complexity of 49 (exceeds 5 allowed). Consider refactoring.
Open

function list_blocks()
{
    global $query4redirect, $block_arr;
    // cachetime options
    $cachetimes = [
Severity: Minor
Found in admin/myblocksadmin.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 (!defined('XOOPS_ORETEKI') && '' !== $block['template']) {
        /** @var \XoopsTplfileHandler $tplfileHandler */
        $tplfileHandler = xoops_getHandler('tplfile');
        $btemplate      = $tplfileHandler->find($GLOBALS['xoopsConfig']['template_set'], 'block', $block['bid']);
        if (count($btemplate) > 0) {
Severity: Major
Found in admin/myblockform.php and 1 other location - About 7 hrs to fix
admin/blockform.php on lines 71..84

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

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 ('' !== $block['template']) {
        /** @var \XoopsTplfileHandler $tplfileHandler */
        $tplfileHandler = xoops_getHandler('tplfile');
        /** @var \XoopsTplfile[] $btemplate */
        $btemplate = $tplfileHandler->find($GLOBALS['xoopsConfig']['template_set'], 'block', $block['bid']);
Severity: Major
Found in admin/blockform.php and 1 other location - About 7 hrs to fix
admin/myblockform.php on lines 61..73

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

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 admin.php has 441 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php

/**
 * Module: WF-links
 * Version: v1.0.3
Severity: Minor
Found in language/english/admin.php - About 6 hrs to fix

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

        function listBlocks()
        {
            global $xoopsModule, $pathIcon16;
            require_once XOOPS_ROOT_PATH . '/class/xoopslists.php';
            $moduleDirName      = basename(dirname(__DIR__));
    Severity: Minor
    Found in admin/blocksadmin.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

    Utility has 42 functions (exceeds 20 allowed). Consider refactoring.
    Open

    class Utility extends Common\SysUtility
    {
        //--------------- Custom module methods -----------------------------
        /**
         * getHandler()
    Severity: Minor
    Found in class/Utility.php - About 5 hrs to fix

      Method createCat has 140 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      function createCat($cid = 0)
      {
          // require_once  dirname(__DIR__) . '/class/wfllists.php';
          require_once XOOPS_ROOT_PATH . '/class/xoopsformloader.php';
      
      
      Severity: Major
      Found in admin/category.php - About 5 hrs to fix

        Function displayIcons has a Cognitive Complexity of 36 (exceeds 5 allowed). Consider refactoring.
        Open

            public static function displayIcons($time, $status = 0, $counter = 0)
            {
                global $xoopsModule;
                /** @var Wflinks\Helper $helper */
                $helper = Wflinks\Helper::getInstance();
        Severity: Minor
        Found in class/Utility.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 ($block['is_custom']) {
            $textarea = new \XoopsFormDhtmlTextArea(_AM_CONTENT, 'bcontent', $block['content'], 15, 70);
            $textarea->setDescription('<span style="font-size:x-small;font-weight:bold;">' . _AM_USEFULTAGS . '</span><br><span style="font-size:x-small;font-weight:normal;">' . sprintf(_AM_BLOCKTAG1, '{X_SITEURL}', XOOPS_URL . '/') . '</span>');
            $form->addElement($textarea, true);
            $ctype_select = new \XoopsFormSelect(_AM_CTYPE, 'bctype', $block['ctype']);
        Severity: Major
        Found in admin/myblockform.php and 1 other location - About 4 hrs to fix
        admin/blockform.php on lines 56..88

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

        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 ($block['is_custom']) {
            $textarea = new \XoopsFormDhtmlTextArea(_AM_SYSTEM_BLOCKS_CONTENT, 'bcontent', $block['content'], 15, 70);
            $textarea->setDescription('<span style="font-size:x-small;font-weight:bold;">' . _AM_SYSTEM_BLOCKS_USEFULTAGS . '</span><br><span style="font-size:x-small;font-weight:normal;">' . sprintf(_AM_BLOCKTAG1, '{X_SITEURL}', XOOPS_URL . '/') . '</span>');
            $form->addElement($textarea, true);
            $ctype_select = new \XoopsFormSelect(_AM_SYSTEM_BLOCKS_CTYPE, 'bctype', $block['ctype']);
        Severity: Major
        Found in admin/blockform.php and 1 other location - About 4 hrs to fix
        admin/myblockform.php on lines 53..77

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

        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 (class_exists('XoopsFormEditor')) {
                    $options['name']   = 'descriptionb';
                    $options['value']  = $descriptionb;
                    $options['rows']   = 5;
                    $options['cols']   = '100%';
        Severity: Major
        Found in submit.php and 1 other location - About 4 hrs to fix
        admin/main.php on lines 155..167

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

        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 (class_exists('XoopsFormEditor')) {
                $options['name']   = 'descriptionb';
                $options['value']  = $descriptionb;
                $options['rows']   = 5;
                $options['cols']   = '100%';
        Severity: Major
        Found in admin/main.php and 1 other location - About 4 hrs to fix
        submit.php on lines 296..308

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

        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 blocksadmin.inc.php has 357 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 include/blocksadmin.inc.php - About 4 hrs to fix

          Function getWysiwygForm has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring.
          Open

              public static function getWysiwygForm($caption, $name, $value)
              {
                  global $xoopsUser, $xoopsModule;
                  /** @var Wflinks\Helper $helper */
                  $helper = Wflinks\Helper::getInstance();
          Severity: Minor
          Found in class/Utility.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

          Function getSubstring has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring.
          Open

              public static function getSubstring($str, $start, $length, $trimmarker = '...')
              {
                  $configHandler          = \xoops_getHandler('config');
                  $im_multilanguageConfig = $configHandler->getConfigsByCat(IM_CONF_MULILANGUAGE);
          
          
          Severity: Minor
          Found in class/Utility.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

          Function updateBlock has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring.
          Open

              function updateBlock($bid, $btitle, $bside, $bweight, $bvisible, $bcachetime, $bmodule, $options, $groups)
              {
                  $myblock = new XoopsBlock($bid);
                  $myblock->setVar('title', $btitle);
                  $myblock->setVar('weight', $bweight);
          Severity: Minor
          Found in admin/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 getWysiwygForm has 108 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              public static function getWysiwygForm($caption, $name, $value)
              {
                  global $xoopsUser, $xoopsModule;
                  /** @var Wflinks\Helper $helper */
                  $helper = Wflinks\Helper::getInstance();
          Severity: Major
          Found in class/Utility.php - About 4 hrs to fix

            File category.php has 343 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            <?php
            /**
             * Module: WF-Links
             * Version: v1.0.3
             * Release Date: 21 June 2005
            Severity: Minor
            Found in admin/category.php - About 4 hrs to fix

              Function myblocksadmin_update_block has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring.
              Open

              function myblocksadmin_update_block(
                  $bid,
                  $bside,
                  $bweight,
                  $bvisible,
              Severity: Minor
              Found in include/blocksadmin.inc.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

              File submit.php has 327 lines of code (exceeds 250 allowed). Consider refactoring.
              Open

              <?php
              /**
               * Module: WF-Links
               * Version: v1.0.3
               * Release Date: 21 June 2005
              Severity: Minor
              Found in submit.php - About 3 hrs to fix
                Severity
                Category
                Status
                Source
                Language