mambax7/extgallery

View on GitHub

Showing 9,653 of 9,653 total issues

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

            navPrev.addClass('nav-prev').attr('src',theme_path+opts.nav_theme+'/prev.png').appendTo(j_gallery).css({
                'position':'absolute',
                'cursor':'pointer'
            }).click(showPrevItem);
Severity: Major
Found in assets/js/galleryview/galleryview.js and 1 other location - About 1 hr to fix
assets/js/galleryview/galleryview.js on lines 662..665

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

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

            navNext.addClass('nav-next').attr('src',theme_path+opts.nav_theme+'/next.png').appendTo(j_gallery).css({
                'position':'absolute',
                'cursor':'pointer'
            }).click(showNextItem);
Severity: Major
Found in assets/js/galleryview/galleryview.js and 1 other location - About 1 hr to fix
assets/js/galleryview/galleryview.js on lines 667..670

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

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 ( !this.anim ) {
                    // save animation parameters
                    this.anim = { start: this.pos, time: +new Date(), distance: distance, factor: factor, destination: this.to };
                }
Severity: Major
Found in assets/js/galleria/galleria-1.3.3.js and 1 other location - About 1 hr to fix
assets/js/galleria/galleria-1.3.5.js on lines 6771..6774

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

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

function ccmValidateBlockForm() {

    if ($('#magnific_type').val() == 'select1') {
        ccm_addError(ccm_t('selection-required'));
    }

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

function loadTableFromArrayWithReplace($table, $data, $search, $replace)
{
    /** @var \XoopsMySQLDatabase $db */
    $db = \XoopsDatabaseFactory::getDatabaseConnection();

Severity: Minor
Found in testdata/index.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 rotate has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

    public function rotate($angle, $options = null)
    {
        if (!($angle == $this->_rotation_angle($angle))) {
            // No rotation needed
            return true;
Severity: Minor
Found in class/pear/Image/Transform/Driver/NetPBM.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 PclTarHandlePathReduction has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

    function PclTarHandlePathReduction($p_dir)
    {
        TrFctStart(__FILE__, __LINE__, 'PclTarHandlePathReduction', "dir='$p_dir'");
        $v_result = '';

Severity: Minor
Found in class/pcltar.lib.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 _resize has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

    public function _resize($new_x, $new_y, $options = null)
    {
        // there's no technical reason why resize can't be called multiple
        // times...it's just silly to do so
        $scaleMethod = $this->_getOption('scaleMethod', $options, 'smooth');
Severity: Minor
Found in class/pear/Image/Transform/Driver/NetPBM.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 PclTarAddList has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

    function PclTarAddList($p_tarname, $p_filelist, $p_add_dir = '', $p_remove_dir = '', $p_mode = '')
    {
        TrFctStart(__FILE__, __LINE__, 'PclTarAddList', "tar=$p_tarname, file=$p_filelist, p_add_dir='$p_add_dir', p_remove_dir='$p_remove_dir', mode=$p_mode");
        $v_result      = 1;
        $p_list_detail = [];
Severity: Minor
Found in class/pcltar.lib.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 postPhotoTraitement has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

    public function postPhotoTraitement($file, $checkMd5 = false)
    {
        //        require_once XOOPS_ROOT_PATH.'/modules/extgallery/class/photoUploader.php';

        $catHandler = Extgallery\Helper::getInstance()->getHandler('PublicCategory');
Severity: Minor
Found in class/PhotoHandler.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 _largePhotoTreatment has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

    public function _largePhotoTreatment($photoName)
    {
        /** @var Extgallery\Helper $helper */
        $helper = Extgallery\Helper::getInstance();

Severity: Minor
Found in class/PhotoHandler.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 bind has 39 lines of code (exceeds 25 allowed). Consider refactoring.
Open

        bind: function( elem, value ) {

            // todo: revise if alternative tooltip is needed for mobile devices
            if (Galleria.TOUCH) {
                return;
Severity: Minor
Found in assets/js/galleria/galleria-1.3.3.js - About 1 hr to fix

    Function bind has 39 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

            bind: function( elem, value ) {
    
                // todo: revise if alternative tooltip is needed for mobile devices
                if (Galleria.TOUCH) {
                    return;
    Severity: Minor
    Found in assets/js/galleria/galleria-1.3.5.js - About 1 hr to fix

      Function raise has 39 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      Galleria.raise = function( msg, fatal ) {
      
          var type = fatal ? 'Fatal error' : 'Error',
      
              css = {
      Severity: Minor
      Found in assets/js/galleria/galleria-1.3.5.js - About 1 hr to fix

        Function raise has 39 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        Galleria.raise = function( msg, fatal ) {
        
            var type = fatal ? 'Fatal error' : 'Error',
        
                css = {
        Severity: Minor
        Found in assets/js/galleria/galleria-1.3.3.js - About 1 hr to fix

          Method _raiseError has 39 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              protected static function _raiseError(
                  $object,
                  $message = null,
                  $code = null,
                  $mode = null,
          Severity: Minor
          Found in class/pear/PEAR.php - About 1 hr to fix

            Method createCat has 39 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                public function createCat($data)
                {
                    /** @var Extgallery\PublicCategory $cat */
                    $cat = $this->create();
                    $cat->setVars($data);
            Severity: Minor
            Found in class/PublicCategoryHandler.php - About 1 hr to fix

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

                      addTimer : function() {
                          if( self._options.idleMode == 'hover' ) {
                              return;
                          }
                          self.addTimer( 'idle', function() {
              Severity: Major
              Found in assets/js/galleria/galleria-1.3.3.js and 1 other location - About 1 hr to fix
              assets/js/galleria/galleria-1.3.5.js on lines 2055..2062

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

              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

                      addTimer : function() {
                          if( self._options.idleMode == 'hover' ) {
                              return;
                          }
                          self.addTimer( 'idle', function() {
              Severity: Major
              Found in assets/js/galleria/galleria-1.3.5.js and 1 other location - About 1 hr to fix
              assets/js/galleria/galleria-1.3.3.js on lines 2050..2057

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

              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

                      moveTo: function( index ) {
                          if ( index != this.index ) {
                              this.pos = this.to = -( index*this.width );
                              this.index = index;
                          }
              Severity: Major
              Found in assets/js/galleria/galleria-1.3.3.js and 1 other location - About 1 hr to fix
              assets/js/galleria/galleria-1.3.5.js on lines 6745..6750

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

              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