mambax7/marquee

View on GitHub

Showing 100 of 100 total issues

Function start has a Cognitive Complexity of 64 (exceeds 5 allowed). Consider refactoring.
Open

XbMarquee.prototype.start = function () {
    var markup = '';

    this.stop();

Severity: Minor
Found in assets/js/xbMarquee.js - 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 xoops_module_update_marquee has a Cognitive Complexity of 58 (exceeds 5 allowed). Consider refactoring.
Open

function xoops_module_update_marquee(\XoopsModule $module, $previousVersion = null)
{
    $moduleDirName      = \basename(\dirname(__DIR__));
    $moduleDirNameUpper = mb_strtoupper($moduleDirName);
    /** @var Marquee\Helper $helper */ /** @var Marquee\Utility $utility */
Severity: Minor
Found in include/onupdate.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

Method listBlocks has 214 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    function listBlocks()
    {
        global $xoopsModule, $pathIcon16;
        require_once XOOPS_ROOT_PATH . '/class/xoopslists.php';
        $moduleDirName      = \basename(\dirname(__DIR__));
Severity: Major
Found in admin/blocksadmin.php - About 1 day to fix

    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)
        {
            $openTags = [];
            if ($considerHtml) {
                // if the plain text is shorter than the maximum length, return the whole text
    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 blocksadmin.php has 500 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 1 day 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

      Function start has 129 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      XbMarquee.prototype.start = function () {
          var markup = '';
      
          this.stop();
      
      
      Severity: Major
      Found in assets/js/xbMarquee.js - About 5 hrs to fix

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

                markup = '<div id="' + this.id + 'container" name="' + this.id + 'container" ' +
                    'style="position: relative; overflow: scroll; ' +
                    'height: ' + this.height + this.heightUnit + '; ' +
                    'width: ' + this.width + this.widthUnit + '; ' +
                    'clip: rect(0px, ' + this.width + this.widthUnit + ', ' + this.height + this.heightUnit + ', 0px); ' +
        Severity: Major
        Found in assets/js/xbMarquee.js and 1 other location - About 4 hrs to fix
        assets/js/xbMarquee.js on lines 107..114

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

        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

                markup = '<div id="' + this.id + 'container" name="' +
                    this.id + 'container" ' +
                    'style="position: relative; overflow: hidden; ' +
                    'height: ' + this.height + this.heightUnit + '; ' +
                    'width: ' + this.width + this.widthUnit + '; ' +
        Severity: Major
        Found in assets/js/xbMarquee.js and 1 other location - About 4 hrs to fix
        assets/js/xbMarquee.js on lines 92..98

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

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

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

                    case 'down':
                        this.dirsign = 1;
                        this.startAt = -XbMarquee._getInnerSize(this.div, 'height');
                        this._setTop(this.startAt);
        
        
        Severity: Major
        Found in assets/js/xbMarquee.js and 1 other location - About 4 hrs to fix
        assets/js/xbMarquee.js on lines 296..306

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

        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

                    case 'right':
                        this.dirsign = 1;
                        this.startAt = -XbMarquee._getInnerSize(this.div, 'width');
                        this._setLeft(this.startAt);
        
        
        Severity: Major
        Found in assets/js/xbMarquee.js and 1 other location - About 4 hrs to fix
        assets/js/xbMarquee.js on lines 271..281

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 121.

        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

                    default:
                        this.dirsign = -1;
        
                        if (this.widthUnit == '%')
                            this.startAt = this.width * XbMarquee._getInnerSize(this.containerDiv, 'width') / 100;
        Severity: Major
        Found in assets/js/xbMarquee.js and 1 other location - About 4 hrs to fix
        assets/js/xbMarquee.js on lines 283..294

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

        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

                    case 'up':
                        this.dirsign = -1;
        
                        if (this.heightUnit == '%')
                            this.startAt = this.height * XbMarquee._getInnerSize(this.containerDiv, 'height') / 100;
        Severity: Major
        Found in assets/js/xbMarquee.js and 1 other location - About 4 hrs to fix
        assets/js/xbMarquee.js on lines 309..320

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

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

        function b_marquee_newbb($limit, $dateFormat, $itemsSize)
        {
            //    require_once XOOPS_ROOT_PATH . '/modules/marquee/class/Utility.php';
            $block = [];
            /** @var \XoopsModuleHandler $moduleHandler */
        Severity: Minor
        Found in plugins/newbb.php - About 3 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 constructMarquee has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring.
        Open

            public function constructMarquee($uniqid = '')
            {
                //        require_once XOOPS_ROOT_PATH . '/modules/marquee/class/Utility.php';
                $tblalign     = ['top', 'bottom', 'middle'];
                $tblbehaviour = ['scroll', 'slide', 'alternate'];
        Severity: Minor
        Found in class/Marqueex.php - About 3 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 b_marquee_newbb has 95 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        function b_marquee_newbb($limit, $dateFormat, $itemsSize)
        {
            //    require_once XOOPS_ROOT_PATH . '/modules/marquee/class/Utility.php';
            $block = [];
            /** @var \XoopsModuleHandler $moduleHandler */
        Severity: Major
        Found in plugins/newbb.php - About 3 hrs to fix

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

          <?php
          /**
           * ****************************************************************************
           * marquee - MODULE FOR XOOPS
           * Copyright (c) Hervé Thouzard (http://www.herve-thouzard.com)
          Severity: Minor
          Found in admin/main.php - About 3 hrs to fix

            Function b_marquee_smartpartner has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
            Open

            function b_marquee_smartpartner($limit, $dateFormat, $itemsSize)
            {
                $block = $newObjects = [];
                if (!defined('SMARTPARTNER_DIRNAME')) {
                    define('SMARTPARTNER_DIRNAME', 'smartpartner');
            Severity: Minor
            Found in plugins/smartpartner.php - About 3 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 xbMarquee.js has 291 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            /* ***** BEGIN LICENSE BLOCK *****
             * The contents of this file are subject to the Mozilla Public License Version
             * 1.1 (the "License"); you may not use this file except in compliance with
             * the License. You may obtain a copy of the License at
             * http://www.mozilla.org/MPL/
            Severity: Minor
            Found in assets/js/xbMarquee.js - About 3 hrs to fix
              Severity
              Category
              Status
              Source
              Language