mambax7/marquee

View on GitHub

Showing 103 of 103 total issues

Method constructMarquee has 73 lines of code (exceeds 25 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: Major
Found in class/Marqueex.php - About 2 hrs to fix

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

        public static function checkVerModule(\Xmf\Module\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 admin/blocksadmin.php and 1 other location - About 2 hrs to fix
    admin/blockform.php on lines 92..104

    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

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

        [
            0       => _NOCACHE,
            30      => sprintf(_SECONDS, 30),
            60      => _MINUTE,
            300     => sprintf(_MINUTES, 5),
    Severity: Major
    Found in admin/blockform.php and 1 other location - About 2 hrs to fix
    admin/blocksadmin.php on lines 108..120

    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

    Method xoops_module_update_marquee has 69 lines of code (exceeds 25 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: Major
    Found in include/onupdate.php - About 2 hrs to fix

      Function XbMarquee has 69 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      function XbMarquee(id, height, width, scrollAmount, scrollDelay, direction, behavior, html) {
          this.id = id;
          this.scrollAmount = scrollAmount ? scrollAmount : 6;
          this.scrollDelay = scrollDelay ? scrollDelay : 85;
          this.direction = direction ? direction.toLowerCase() : 'left';
      Severity: Major
      Found in assets/js/xbMarquee.js - About 2 hrs to fix

        Function XbMarquee has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
        Open

        function XbMarquee(id, height, width, scrollAmount, scrollDelay, direction, behavior, html) {
            this.id = id;
            this.scrollAmount = scrollAmount ? scrollAmount : 6;
            this.scrollDelay = scrollDelay ? scrollDelay : 85;
            this.direction = direction ? direction.toLowerCase() : 'left';
        Severity: Minor
        Found in assets/js/xbMarquee.js - 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 AddEditMarqueeForm has 67 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        function AddEditMarqueeForm(
            $marqueeid,
            $action,
            $formTitle,
            $contentvalue,
        Severity: Major
        Found in admin/main.php - About 2 hrs to fix

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

              if (typeof (height) == 'number') {
                  this.height = height;
                  this.heightUnit = 'px';
              } else if (typeof (height) == 'string') {
                  this.height = parseInt('0' + height, 10);
          Severity: Major
          Found in assets/js/xbMarquee.js and 1 other location - About 2 hrs to fix
          assets/js/xbMarquee.js on lines 63..72

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

          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 (typeof (width) == 'number') {
                  this.width = width;
                  this.widthUnit = 'px';
              } else if (typeof (width) == 'string') {
                  this.width = parseInt('0' + width, 10);
          Severity: Major
          Found in assets/js/xbMarquee.js and 1 other location - About 2 hrs to fix
          assets/js/xbMarquee.js on lines 52..61

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

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

          function b_marquee_wfsection($limit, $dateFormat, $itemsSize)
          {
              //    require_once XOOPS_ROOT_PATH . '/modules/marquee/class/Utility.php';
              $block = [];
              $myts  = \MyTextSanitizer::getInstance();
          Severity: Minor
          Found in plugins/wfsection.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

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

              function isBlockCloned($bid, $bside, $bweight, $bvisible, $bcachetime, $bmodule, $options = null): void
              {
                  xoops_loadLanguage('admin', 'system');
                  xoops_loadLanguage('admin/blocksadmin', 'system');
                  xoops_loadLanguage('admin/groups', 'system');
          Severity: Minor
          Found in admin/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 truncateHtml has 62 lines of code (exceeds 25 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: Major
          Found in class/Common/SysUtility.php - About 2 hrs to fix

            Method b_marquee_comments has 61 lines of code (exceeds 25 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: Major
            Found in plugins/comments.php - About 2 hrs to fix

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

                  public static function deleteDirectory($src)
                  {
                      // 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 b_marquee_article has 60 lines of code (exceeds 25 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: Major
              Found in plugins/article.php - About 2 hrs to fix

                Method AddEditMarqueeForm has 18 arguments (exceeds 4 allowed). Consider refactoring.
                Open

                    $marqueeid,
                    $action,
                    $formTitle,
                    $contentvalue,
                    $bgcolorvalue,
                Severity: Major
                Found in admin/main.php - About 2 hrs to fix

                  Method isBlockCloned has 55 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      function isBlockCloned($bid, $bside, $bweight, $bvisible, $bcachetime, $bmodule, $options = null): void
                      {
                          xoops_loadLanguage('admin', 'system');
                          xoops_loadLanguage('admin/blocksadmin', 'system');
                          xoops_loadLanguage('admin/groups', 'system');
                  Severity: Major
                  Found in admin/blocksadmin.php - About 2 hrs to fix

                    Method b_marquee_tplleaguestats has 48 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                    function b_marquee_tplleaguestats($limit, $dateFormat, $itemsSize)
                    {
                        //    require_once XOOPS_ROOT_PATH . '/modules/marquee/class/Utility.php';
                        //######################## SETTINGS ######################
                        $displaySeason  = false; // display season name?
                    Severity: Minor
                    Found in plugins/tplleaguestats.php - About 1 hr to fix

                      Method b_marquee_catads has 48 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                      function b_marquee_catads($limit, $dateFormat, $itemsSize)
                      {
                          global $xoopsModule, $xoopsModuleConfig, $xoopsDB;
                          //    require_once XOOPS_ROOT_PATH . '/modules/catads/class/cat.php';
                          $block = [];
                      Severity: Minor
                      Found in plugins/catads.php - About 1 hr to fix
                        Severity
                        Category
                        Status
                        Source
                        Language