Undev/redmine_lightbox

View on GitHub

Showing 74 of 74 total issues

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

                if (allowY) {
                    distanceY = (-Math.abs(_$el.attr('data-y'))) + (endCoords.y - startCoords.y);
                } else {
                    distanceY = -Math.abs(_$el.attr('data-y'));
                }
Severity: Major
Found in assets/javascripts/lightgallery-all.js and 3 other locations - About 2 hrs to fix
assets/javascripts/lightgallery-all.js on lines 2700..2704
assets/javascripts/lightgallery-all.js on lines 2706..2710
assets/javascripts/lightgallery-all.js on lines 2798..2802

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

                if (allowX) {
                    distanceX = (-Math.abs(_$el.attr('data-x'))) + (endCoords.x - startCoords.x);
                } else {
                    distanceX = -Math.abs(_$el.attr('data-x'));
                }
Severity: Major
Found in assets/javascripts/lightgallery-all.js and 3 other locations - About 2 hrs to fix
assets/javascripts/lightgallery-all.js on lines 2700..2704
assets/javascripts/lightgallery-all.js on lines 2706..2710
assets/javascripts/lightgallery-all.js on lines 2792..2796

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

Function enableThumbDrag has 50 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    Thumbnail.prototype.enableThumbDrag = function() {

        var _this = this;
        var startCoords = 0;
        var endCoords = 0;
Severity: Minor
Found in assets/javascripts/lightgallery-all.js - About 2 hrs to fix

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

            $('#lg-zoom-in').on('click.lg', function() {
                if (_this.core.$outer.find('.lg-current .lg-image').length) {
                    scale += _this.core.s.scale;
                    callScale();
                }
    Severity: Major
    Found in assets/javascripts/lightgallery-all.js and 1 other location - About 1 hr to fix
    assets/javascripts/lightgallery-all.js on lines 2605..2610

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

    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

            var maxY = Math.abs(($image.outerHeight() * Math.abs($image.attr('data-scale'))) - _this.core.$outer.find('.lg').height() + minY);
    Severity: Major
    Found in assets/javascripts/lightgallery-all.js and 1 other location - About 1 hr to fix
    assets/javascripts/lightgallery-all.js on lines 2845..2845

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

    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

            var maxX = Math.abs(($image.outerWidth() * Math.abs($image.attr('data-scale'))) - _this.core.$outer.find('.lg').width() + minX);
    Severity: Major
    Found in assets/javascripts/lightgallery-all.js and 1 other location - About 1 hr to fix
    assets/javascripts/lightgallery-all.js on lines 2843..2843

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

    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

            $('#lg-zoom-out').on('click.lg', function() {
                if (_this.core.$outer.find('.lg-current .lg-image').length) {
                    scale -= _this.core.s.scale;
                    callScale();
                }
    Severity: Major
    Found in assets/javascripts/lightgallery-all.js and 1 other location - About 1 hr to fix
    assets/javascripts/lightgallery-all.js on lines 2612..2617

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

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

          def generate_gallery_item(attachment)
            download_url = download_named_attachment_url(attachment.id, attachment.filename)
            case
              when attachment.is_image?
                {
    Severity: Minor
    Found in lib/redmine_lightbox/patches/application_controller_patch.rb - About 1 hr to fix

      Function enableThumbSwipe has 45 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          Thumbnail.prototype.enableThumbSwipe = function() {
              var _this = this;
              var startCoords = 0;
              var endCoords = 0;
              var isMoved = false;
      Severity: Minor
      Found in assets/javascripts/lightgallery-all.js - About 1 hr to fix

        Function enableDrag has 44 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            Plugin.prototype.enableDrag = function() {
                var _this = this;
                var startCoords = 0;
                var endCoords = 0;
                var isDraging = false;
        Severity: Minor
        Found in assets/javascripts/lightgallery-all.js - About 1 hr to fix

          Function loadVideo has 43 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              Video.prototype.loadVideo = function(src, addClass, noposter, index, html) {
                  var video = '';
                  var autoplay = 1;
                  var a = '';
                  var isVideo = this.core.isVideo(src, index) || {};
          Severity: Minor
          Found in assets/javascripts/lightgallery-all.js - About 1 hr to fix

            Function init has 40 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                Plugin.prototype.init = function() {
            
                    var _this = this;
            
                    // s.preload should not be more than $item.length
            Severity: Minor
            Found in assets/javascripts/lightgallery-all.js - About 1 hr to fix

              Function init has 40 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  Pager.prototype.init = function() {
                      var _this = this;
                      var pagerList = '';
                      var $pagerCont;
                      var $pagerOuter;
              Severity: Minor
              Found in assets/javascripts/lightgallery-all.js - About 1 hr to fix

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

                    Zoom.prototype.touchendZoom = function(startCoords, endCoords, allowX, allowY) {
                
                        var _this = this;
                        var _$el = _this.core.$slide.eq(_this.core.index).find('.lg-img-wrap');
                        var $image = _this.core.$slide.eq(_this.core.index).find('.lg-object');
                Severity: Minor
                Found in assets/javascripts/lightgallery-all.js - About 1 hr to fix

                  Function animateThumb has 36 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      Thumbnail.prototype.animateThumb = function(index) {
                          var $thumb = this.core.$outer.find('.lg-thumb');
                          if (this.core.s.animateThumb) {
                              var position;
                              switch (this.core.s.currentPagerPosition) {
                  Severity: Minor
                  Found in assets/javascripts/lightgallery-all.js - About 1 hr to fix

                    Function destroy has 35 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        Plugin.prototype.destroy = function(d) {
                    
                            var _this = this;
                    
                            if (!d) {
                    Severity: Minor
                    Found in assets/javascripts/lightgallery-all.js - About 1 hr to fix

                      Function Plugin has 33 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          function Plugin(element, options) {
                      
                              // Current lightGallery element
                              this.el = element;
                      
                      
                      Severity: Minor
                      Found in assets/javascripts/lightgallery-all.js - About 1 hr to fix

                        Function isVideo has 32 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            Plugin.prototype.isVideo = function(src, index) {
                        
                                var html;
                                if (this.s.dynamic) {
                                    html = this.s.dynamicEl[index].html;
                        Severity: Minor
                        Found in assets/javascripts/lightgallery-all.js - About 1 hr to fix

                          Function enableSwipe has 31 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                              Plugin.prototype.enableSwipe = function() {
                                  var _this = this;
                                  var startCoords = 0;
                                  var endCoords = 0;
                                  var isMoved = false;
                          Severity: Minor
                          Found in assets/javascripts/lightgallery-all.js - About 1 hr to fix

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

                                            if (_this.s.loop) {
                                                _this.index = _this.$items.length - 1;
                                                _this.$el.trigger('onBeforePrevSlide.lg', [_this.index, fromTouch]);
                                                _this.slide(_this.index, fromTouch, false);
                                            } else if (_this.s.slideEndAnimatoin) {
                            Severity: Major
                            Found in assets/javascripts/lightgallery-all.js and 1 other location - About 1 hr to fix
                            assets/javascripts/lightgallery-all.js on lines 901..910

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

                            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