XoopsModules25x/xoopstube

View on GitHub

Showing 2,792 of 2,792 total issues

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

    public static function setPageNavigationCategoryList(
        $pubrowamount,
        $start,
        $art,
        $_this,
Severity: Major
Found in class/Utility.php and 1 other location - About 2 hrs to fix
class/Utility.php on lines 2587..2598

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

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

    public static function setPageNavigationVideoList($pubrowamount, $start, $art, $_this, $align)
    {
        if ($pubrowamount < $GLOBALS['xoopsModuleConfig']['admin_perpage']) {
            return false;
        }
Severity: Major
Found in class/Utility.php and 1 other location - About 2 hrs to fix
class/Utility.php on lines 2456..2472

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

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 isBlockCloned has 54 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    function isBlockCloned($bid, $bside, $bweight, $bvisible, $bcachetime, $bmodule, $options = null)
    {
        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 getRandomVideoForHorizontalBlock has 53 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    function getRandomVideoForHorizontalBlock($options)
    {
        global $myts;
        $moduleDirName = \basename(\dirname(__DIR__));
        $block         = [];
    Severity: Major
    Found in blocks/xoopstube_top.php - About 2 hrs to fix

      File modinfo.php has 255 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

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

        File video.php has 254 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        <?php
        
        /**
         * Module: XoopsTube
         *
        Severity: Minor
        Found in include/video.php - About 2 hrs to fix

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

          function getXtubeAlphabet()
          {
              $xtubeAlphabet = [
                  '0',
                  '1',
          Severity: Major
          Found in language/english/main.php and 1 other location - About 2 hrs to fix
          language/english/common.php on lines 94..136

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

          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

          function getLocalAlphabet()
          {
              $alphabet = [
                  '0',
                  '1',
          Severity: Major
          Found in language/english/common.php and 1 other location - About 2 hrs to fix
          language/english/main.php on lines 237..279

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

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

              public static function updateCache()
              {
                  global $xoopsModule;
                  $folder  = $xoopsModule->getVar('dirname');
                  $tpllist = [];
          Severity: Minor
          Found in class/Utility.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 getRandomVideo has 52 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          function getRandomVideo($options)
          {
              global $myts;
              $utility       = new Utility();
              $moduleDirName = \basename(\dirname(__DIR__));
          Severity: Major
          Found in blocks/xoopstube_top.php - About 2 hrs to fix

            Method sendEmailFromTpl has 51 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                public static function sendEmailFromTpl($tplName, $recipients, $subject, $variables)
                {
                    global $xoopsConfig;
                    require_once XOOPS_ROOT_PATH . '/class/xoopsmailer.php';
                    if (!\is_array($recipients)) {
            Severity: Major
            Found in class/Utility.php - About 2 hrs to fix

              Method xtubeReturnSource has 51 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              function xtubeReturnSource($returnsource)
              {
                  switch ($returnsource) {
                      case 0:
                          $returnsource = _AM_XOOPSTUBE_YOUTUBE;
              Severity: Major
              Found in include/video.php - About 2 hrs to fix

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

                        switch ($orderby) {
                            case 'title ASC':
                                $orderby = 'titleA';
                                break;
                            case 'published ASC':
                Severity: Major
                Found in class/Utility.php and 1 other location - About 2 hrs to fix
                class/Utility.php on lines 1690..1721

                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

                        switch (\trim($orderby)) {
                            case 'titleA':
                                $orderby = 'title ASC';
                                break;
                            case 'dateA':
                Severity: Major
                Found in class/Utility.php and 1 other location - About 2 hrs to fix
                class/Utility.php on lines 1776..1807

                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

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

                    public static function getBannerFromBannerId($banner_id)
                    {
                        ###### Hack by www.stefanosilvestrini.com ######
                        $db      = \XoopsDatabaseFactory::getDatabaseConnection();
                        $bresult = $db->query('SELECT COUNT(*) FROM ' . $db->prefix('banner') . ' WHERE bid=' . $banner_id);
                Severity: Minor
                Found in class/Utility.php - About 1 hr to fix

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

                      public static function getBannerFromClientId($client_id)
                      {
                          ###### Hack by www.stefanosilvestrini.com ######
                          $db      = \XoopsDatabaseFactory::getDatabaseConnection();
                          $bresult = $db->query('SELECT COUNT(*) FROM ' . $db->prefix('banner') . ' WHERE cid=' . $client_id);
                  Severity: Minor
                  Found in class/Utility.php - About 1 hr to fix

                    Function edit has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
                    Open

                    function edit($lid = 0)
                    {
                        global $myts, $mytree, $xtubeImageArray;
                    
                        $sql = 'SELECT * FROM ' . $GLOBALS['xoopsDB']->prefix('xoopstube_videos') . ' WHERE lid=' . $lid;
                    Severity: Minor
                    Found in admin/main.php - About 1 hr 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 getRandomVideoForHorizontalBlock has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
                    Open

                    function getRandomVideoForHorizontalBlock($options)
                    {
                        global $myts;
                        $moduleDirName = \basename(\dirname(__DIR__));
                        $block         = [];
                    Severity: Minor
                    Found in blocks/xoopstube_top.php - About 1 hr 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 getRandomVideo has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
                    Open

                    function getRandomVideo($options)
                    {
                        global $myts;
                        $utility       = new Utility();
                        $moduleDirName = \basename(\dirname(__DIR__));
                    Severity: Minor
                    Found in blocks/xoopstube_top.php - About 1 hr 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 sendEmailFromTpl has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
                    Open

                        public static function sendEmailFromTpl($tplName, $recipients, $subject, $variables)
                        {
                            global $xoopsConfig;
                            require_once XOOPS_ROOT_PATH . '/class/xoopsmailer.php';
                            if (!\is_array($recipients)) {
                    Severity: Minor
                    Found in class/Utility.php - About 1 hr 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