mambax7/extgallery

View on GitHub

Showing 9,653 of 9,653 total issues

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

    switch ($photoHandlertype) {
        case 'RandomPhoto':

            $photos = $photoHandler->objectToArray($photoHandler->getRandomPhoto($param));

Severity: Major
Found in blocks/extgallery_blocks.php and 2 other locations - About 2 hrs to fix
blocks/extgallery_blocks.php on lines 100..126
blocks/extgallery_blocks.php on lines 797..823

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

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 3 locations. Consider refactoring.
Open

    switch ($photoHandlertype) {
        case 'RandomPhoto':

            $photos = $photoHandler->objectToArray($photoHandler->getRandomPhoto($param));

Severity: Major
Found in blocks/extgallery_blocks.php and 2 other locations - About 2 hrs to fix
blocks/extgallery_blocks.php on lines 100..126
blocks/extgallery_blocks.php on lines 359..385

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

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

    var Finger = function(elem, options) {

        // default options
        this.config = {
            start: 0,
Severity: Major
Found in assets/js/galleria/galleria-1.3.5.js - About 2 hrs to fix

    Function Finger has 53 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        var Finger = function(elem, options) {
    
            // default options
            this.config = {
                start: 0,
    Severity: Major
    Found in assets/js/galleria/galleria-1.3.3.js - About 2 hrs to fix

      Function _initSlidesFromContent has 53 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          function _initSlidesFromContent( $tos, $anchors, $wrpr, $sldr, opts )
          {
              $tos.children().each(
                  function( index )
                  {
      Severity: Major
      Found in assets/js/TosRUs/src/js/jquery.tosrus.js - About 2 hrs to fix

        Function close has 53 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            $.fancybox.close = function() {
                if (busy || wrap.is(':hidden')) {
                    return;
                }
        
        
        Severity: Major
        Found in assets/js/fancybox/fancybox.js - About 2 hrs to fix

          Method extgalleryList has 53 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          function extgalleryList($options)
          {
              global $xoopsConfig;
          
              /** @var Extgallery\PhotoHandler $photoHandler */
          Severity: Major
          Found in blocks/extgallery_blocks.php - About 2 hrs to fix

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

                addElement : function( id ) {
            
                    var dom = this._dom;
            
                    $.each( Utils.array(arguments), function( i, blueprint ) {
            Severity: Major
            Found in assets/js/galleria/galleria-1.3.3.js and 2 other locations - About 2 hrs to fix
            assets/js/galleria/galleria-1.1.js on lines 2392..2401
            assets/js/galleria/galleria-1.3.5.js on lines 4457..4466

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

            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 3 locations. Consider refactoring.
            Open

                addElement : function( id ) {
            
                    var dom = this._dom;
            
                    $.each( Utils.array(arguments), function( i, blueprint ) {
            Severity: Major
            Found in assets/js/galleria/galleria-1.1.js and 2 other locations - About 2 hrs to fix
            assets/js/galleria/galleria-1.3.3.js on lines 4439..4448
            assets/js/galleria/galleria-1.3.5.js on lines 4457..4466

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

            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 3 locations. Consider refactoring.
            Open

                addElement : function( id ) {
            
                    var dom = this._dom;
            
                    $.each( Utils.array(arguments), function( i, blueprint ) {
            Severity: Major
            Found in assets/js/galleria/galleria-1.3.5.js and 2 other locations - About 2 hrs to fix
            assets/js/galleria/galleria-1.1.js on lines 2392..2401
            assets/js/galleria/galleria-1.3.3.js on lines 4439..4448

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

            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 (settings.maxHeight) {
                        settings.mh = setSize(settings.maxHeight, 'y') - loadedHeight - interfaceHeight;
                        settings.mh = settings.h && settings.h < settings.mh ? settings.h : settings.mh;
                    }
            Severity: Major
            Found in assets/js/ml-slider/assets/colorbox/jquery.colorbox-min.js and 1 other location - About 2 hrs to fix
            assets/js/ml-slider/assets/colorbox/jquery.colorbox-min.js on lines 888..891

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

            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 (settings.maxWidth) {
                        settings.mw = setSize(settings.maxWidth, 'x') - loadedWidth - interfaceWidth;
                        settings.mw = settings.w && settings.w < settings.mw ? settings.w : settings.mw;
                    }
            Severity: Major
            Found in assets/js/ml-slider/assets/colorbox/jquery.colorbox-min.js and 1 other location - About 2 hrs to fix
            assets/js/ml-slider/assets/colorbox/jquery.colorbox-min.js on lines 892..895

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

            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 4 locations. Consider refactoring.
            Open

                public function getLastPhoto($param)
                {
                    $catHandler = Extgallery\Helper::getInstance()->getHandler('PublicCategory');
            
                    $criteria = new CriteriaCompo();
            Severity: Major
            Found in class/PhotoHandler.php and 3 other locations - About 2 hrs to fix
            class/PhotoHandler.php on lines 1089..1102
            class/PhotoHandler.php on lines 1109..1122
            class/PhotoHandler.php on lines 1129..1142

            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 4 locations. Consider refactoring.
            Open

                public function getTopViewPhoto($param)
                {
                    $catHandler = Extgallery\Helper::getInstance()->getHandler('PublicCategory');
            
                    $criteria = new CriteriaCompo();
            Severity: Major
            Found in class/PhotoHandler.php and 3 other locations - About 2 hrs to fix
            class/PhotoHandler.php on lines 1069..1082
            class/PhotoHandler.php on lines 1109..1122
            class/PhotoHandler.php on lines 1129..1142

            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

                            for ($i = 0; $i < $n; ++$i) {
                                TrFctMessage(__FILE__, __LINE__, 3, 'Read complete 512 bytes block number ' . ($i + 1));
                                if ('tar' === $p_tar_mode) {
                                    $v_content = fread($v_tar, 512);
                                    fwrite($v_temp_tar, $v_content, 512);
            Severity: Major
            Found in class/pcltar.lib.php and 1 other location - About 2 hrs to fix
            class/pcltar.lib.php on lines 3151..3160

            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 4 locations. Consider refactoring.
            Open

                public function getTopRatedPhoto($param)
                {
                    $catHandler = Extgallery\Helper::getInstance()->getHandler('PublicCategory');
            
                    $criteria = new CriteriaCompo();
            Severity: Major
            Found in class/PhotoHandler.php and 3 other locations - About 2 hrs to fix
            class/PhotoHandler.php on lines 1069..1082
            class/PhotoHandler.php on lines 1089..1102
            class/PhotoHandler.php on lines 1129..1142

            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 4 locations. Consider refactoring.
            Open

                public function getTopEcardPhoto($param)
                {
                    $catHandler = Extgallery\Helper::getInstance()->getHandler('PublicCategory');
            
                    $criteria = new CriteriaCompo();
            Severity: Major
            Found in class/PhotoHandler.php and 3 other locations - About 2 hrs to fix
            class/PhotoHandler.php on lines 1069..1082
            class/PhotoHandler.php on lines 1089..1102
            class/PhotoHandler.php on lines 1109..1122

            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

                            for ($j = 0; $j < $n; ++$j) {
                                TrFctMessage(__FILE__, __LINE__, 3, 'Read complete 512 bytes block number ' . ($j + 1));
                                if ('tar' === $p_tar_mode) {
                                    $v_content = fread($v_tar, 512);
                                    fwrite($v_temp_tar, $v_content, 512);
            Severity: Major
            Found in class/pcltar.lib.php and 1 other location - About 2 hrs to fix
            class/pcltar.lib.php on lines 2866..2875

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

                protected static function _dirToStruct($sPath, $maxinst, $aktinst = 0, $silent = false)
                {
                    $struct = ['dirs' => [], 'files' => []];
                    if (false === ($dir = @opendir($sPath))) {
                        if (!$silent) {
            Severity: Minor
            Found in class/pear/System.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

            Severity
            Category
            Status
            Source
            Language