XoopsModules25x/xoopstube

View on GitHub

Showing 2,792 of 2,792 total issues

File Utility.php has 2304 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php

namespace XoopsModules\Xoopstube;

/*
Severity: Major
Found in class/Utility.php - About 6 days to fix

    Method getSocialBookmarks has 672 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    function getSocialBookmarks($lid)
    {
        global $xoopsModule;
    
    //    $myts           = new Xoopstube\TextSanitizer();
    Severity: Major
    Found in sbookmarks.php - About 3 days to fix

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

      class Utility extends Common\SysUtility
      {
          //--------------- Custom module methods -----------------------------
      
          public const MODULE_NAME = 'xoopstube';
      Severity: Major
      Found in class/Utility.php - About 1 day to fix

        File xoops_version.php has 761 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        <?php
        
        /**
         * Module: XoopsTube
         *
        Severity: Major
        Found in xoops_version.php - About 1 day to fix

          File sbookmarks.php has 677 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          <?php
          
          /**
           * Module: XoopsTube
           *
          Severity: Major
          Found in sbookmarks.php - About 1 day to fix

            Method unhtml has 258 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                public static function unhtml($chaine)
                {
                    $search = $replace = [];
                    $chaine = \html_entity_decode($chaine);
            
            
            Severity: Major
            Found in class/Utility.php - About 1 day to fix

              Method listBlocks has 212 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)
                    {
                        if ($considerHtml) {
                            // if the plain text is shorter than the maximum length, return the whole text
                            if (mb_strlen(\preg_replace('/<.*?' . '>/', '', $text)) <= $length) {
                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

                  File admin.php has 488 lines of code (exceeds 250 allowed). Consider refactoring.
                  Open

                  <?php
                  
                  /**
                   * Module: XoopsTube
                   *
                  Severity: Minor
                  Found in language/english/admin.php - About 7 hrs to fix

                    Method edit has 192 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                    function edit($lid = 0)
                    {
                        global $myts, $mytree, $xtubeImageArray;
                    
                        $sql = 'SELECT * FROM ' . $GLOBALS['xoopsDB']->prefix('xoopstube_videos') . ' WHERE lid=' . $lid;
                    Severity: Major
                    Found in admin/main.php - About 7 hrs to fix

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

                      <?php
                      /**
                       * Module: XoopsTube
                       *
                       * You may not change or alter any portion of this comment or credits
                      Severity: Minor
                      Found in admin/main.php - About 7 hrs to fix

                        Method renderAdminMenu has 175 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            public static function renderAdminMenu($header = '', $menu = '', $extra = '', $scount = 4)
                            {
                                global $xoopsModule;
                        
                                $_named_vidid = \xoops_getenv('SCRIPT_NAME');
                        Severity: Major
                        Found in class/Utility.php - About 7 hrs to fix

                          Function renderAdminMenu has a Cognitive Complexity of 44 (exceeds 5 allowed). Consider refactoring.
                          Open

                              public static function renderAdminMenu($header = '', $menu = '', $extra = '', $scount = 4)
                              {
                                  global $xoopsModule;
                          
                                  $_named_vidid = \xoops_getenv('SCRIPT_NAME');
                          Severity: Minor
                          Found in class/Utility.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

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

                          $icons = [
                              'edit'    => "<img src='" . $pathIcon16 . "/edit.png'  alt=" . _EDIT . "' align='middle'>",
                              'delete'  => "<img src='" . $pathIcon16 . "/delete.png' alt='" . _DELETE . "' align='middle'>",
                              'clone'   => "<img src='" . $pathIcon16 . "/editcopy.png' alt='" . _CLONE . "' align='middle'>",
                              'preview' => "<img src='" . $pathIcon16 . "/view.png' alt='" . _PREVIEW . "' align='middle'>",
                          Severity: Major
                          Found in include/common.php and 1 other location - About 6 hrs to fix
                          config/icons.php on lines 10..20

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

                          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

                              'icons' => [
                                  'edit'    => "<img src='" . $pathIcon16 . "/edit.png'  alt=" . _EDIT . "' align='middle'>",
                                  'delete'  => "<img src='" . $pathIcon16 . "/delete.png' alt='" . _DELETE . "' align='middle'>",
                                  'clone'   => "<img src='" . $pathIcon16 . "/editcopy.png' alt='" . _CLONE . "' align='middle'>",
                                  'preview' => "<img src='" . $pathIcon16 . "/view.png' alt='" . _PREVIEW . "' align='middle'>",
                          Severity: Major
                          Found in config/icons.php and 1 other location - About 6 hrs to fix
                          include/common.php on lines 67..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 212.

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

                          Method createCategory has 154 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

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

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

                                    foreach ($mod_array as $key => $content) {
                                        if (in_array($key, $not_allowed)) {
                                            continue;
                                        }
                                        $lang_def = constant('_AM_XOOPSTUBE_MOD_' . mb_strtoupper($key));
                            Severity: Major
                            Found in admin/modifications.php and 1 other location - About 5 hrs to fix
                            admin/modifications.php on lines 55..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 193.

                            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

                                    foreach ($orig_array as $key => $content) {
                                        if (in_array($key, $not_allowed)) {
                                            continue;
                                        }
                                        $lang_def = constant('_AM_XOOPSTUBE_MOD_' . mb_strtoupper($key));
                            Severity: Major
                            Found in admin/modifications.php and 1 other location - About 5 hrs to fix
                            admin/modifications.php on lines 81..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 193.

                            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

                            Severity
                            Category
                            Status
                            Source
                            Language