mambax7/marquee

View on GitHub

Showing 103 of 103 total issues

Function formMarkRequiredFields has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    public static function formMarkRequiredFields($sform)
    {
        $required = $elements = [];
        if (self::needsAsterisk()) {
            foreach ($sform->getRequired() as $item) {
Severity: Minor
Found in class/Utility.php - About 55 mins 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 b_marquee_comments has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

function b_marquee_comments($limit, $dateFormat, $itemsSize)
{
    //    require_once XOOPS_ROOT_PATH . '/modules/marquee/class/Utility.php';
    require XOOPS_ROOT_PATH . '/include/comment_constants.php';
    $block  = [];
Severity: Minor
Found in plugins/comments.php - About 55 mins 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 setOrder has 7 arguments (exceeds 4 allowed). Consider refactoring.
Open

    function setOrder($bid, $title, $weight, $visible, $side, $bcachetime, $bmodule = null)
Severity: Major
Found in admin/blocksadmin.php - About 50 mins to fix

    Method isBlockCloned has 7 arguments (exceeds 4 allowed). Consider refactoring.
    Open

        function isBlockCloned($bid, $bside, $bweight, $bvisible, $bcachetime, $bmodule, $options = null): void
    Severity: Major
    Found in admin/blocksadmin.php - About 50 mins to fix

      Function b_marquee_smartclient has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

      function b_marquee_smartclient($limit, $dateFormat, $itemsSize)
      {
          $block = [];
          if (!defined('SMARTCLIENT_DIRNAME')) {
              define('SMARTCLIENT_DIRNAME', 'smartclient');
      Severity: Minor
      Found in plugins/smartclient.php - About 45 mins 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 b_marquee_smartsection has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

      function b_marquee_smartsection($limit, $dateFormat, $itemsSize)
      {
      
          if (!class_exists('XoopsModules\Smartsection\Helper')) {
              return false;
      Severity: Minor
      Found in plugins/smartsection.php - About 45 mins 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 b_marquee_smartfaq has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

      function b_marquee_smartfaq($limit, $dateFormat, $itemsSize)
      {
          require_once XOOPS_ROOT_PATH . '/modules/smartfaq/include/functions.php';
          $block             = [];
          $smartModule       = &sf_getModuleInfo();
      Severity: Minor
      Found in plugins/smartfaq.php - About 45 mins 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 6 arguments (exceeds 4 allowed). Consider refactoring.
      Open

              $caption,
              $name,
              $value = '',
              $width = '100%',
              $height = '400px',
      Severity: Minor
      Found in class/Utility.php - About 45 mins to fix

        Function xoopspartners_random has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

        function xoopspartners_random($numberPartners, $random = true, $orden = '', $desc = '')
        {
            global $xoopsDB;
            $PartnersId  = [];
            $ArrayReturn = [];
        Severity: Minor
        Found in plugins/xoopspartners.php - About 45 mins 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

        Avoid deeply nested control flow statements.
        Open

                                    if (\is_file($templateFolder . $v)) {
                                        unlink($templateFolder . $v);
                                    }
        Severity: Major
        Found in include/onupdate.php - About 45 mins to fix

          Method truncateHtml has 5 arguments (exceeds 4 allowed). Consider refactoring.
          Open

              public static function truncateHtml($text, $length = 100, $ending = '...', $exact = false, $considerHtml = true)
          Severity: Minor
          Found in class/Common/SysUtility.php - About 35 mins to fix

            Function b_marquee_news has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
            Open

            function b_marquee_news($limit, $dateFormat, $itemsSize)
            {
                //    require_once XOOPS_ROOT_PATH . '/modules/marquee/class/Utility.php';
                require_once XOOPS_ROOT_PATH . '/modules/news/class/class.newsstory.php';
                $block      = $stories = [];
            Severity: Minor
            Found in plugins/news.php - About 35 mins 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 getEditor has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
            Open

                public static function getEditor($helper = null, $options = null)
                {
                    /** @var Helper $helper */
                    if (null === $options) {
                        $options           = [];
            Severity: Minor
            Found in class/Common/SysUtility.php - About 35 mins 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 b_marquee_article has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
            Open

            function b_marquee_article($limit, $dateFormat, $itemsSize)
            {
                global $xoopsDB;
                //    require_once XOOPS_ROOT_PATH . '/modules/marquee/class/Utility.php';
                require_once XOOPS_ROOT_PATH . '/modules/article/include/functions.php';
            Severity: Minor
            Found in plugins/article.php - About 35 mins 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 myglob has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
            Open

            function myglob($folder = '', $pattern = 'php')
            {
                $result = [];
            
                if (!($dir = opendir($folder))) {
            Severity: Minor
            Found in admin/functions.php - About 35 mins 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 b_marquee_wfdownloads has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
            Open

            function b_marquee_wfdownloads($limit, $dateFormat, $itemsSize)
            {
                $block = [];
                global $xoopsUser;
                /** @var \XoopsModuleHandler $moduleHandler */
            Severity: Minor
            Found in plugins/wfdownloads.php - About 35 mins 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

                            $block[] = [
                                'date'     => formatTimestamp($myrow['published'], $dateFormat),
                                'category' => '',
                                'author'   => \XoopsUser::getUnameFromId($myrow['uid']),
                                'title'    => $title,
            Severity: Minor
            Found in plugins/wfsection.php and 1 other location - About 30 mins to fix
            plugins/xfsection.php on lines 54..60

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

            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

                        $block[] = [
                            'date'     => formatTimestamp($myrow['published'], $dateFormat),
                            'category' => '',
                            'author'   => \XoopsUser::getUnameFromId($myrow['uid']),
                            'title'    => $title,
            Severity: Minor
            Found in plugins/xfsection.php and 1 other location - About 30 mins to fix
            plugins/wfsection.php on lines 59..65

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

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

            function b_marquee_mydownloads($limit, $dateFormat, $itemsSize)
            {
                //    require_once XOOPS_ROOT_PATH . '/modules/marquee/class/Utility.php';
                require XOOPS_ROOT_PATH . '/include/comment_constants.php';
                $block  = [];
            Severity: Minor
            Found in plugins/mydownloads.php - About 25 mins 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 b_marquee_show has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
            Open

            function b_marquee_show($options)
            {
                global $xoopsTpl;
                $marquee = null;
                //    require_once XOOPS_ROOT_PATH . '/modules/marquee/class/Utility.php';
            Severity: Minor
            Found in blocks/marquee_bloc.php - About 25 mins 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

            Severity
            Category
            Status
            Source
            Language