Undev/redmine_lightbox

View on GitHub
assets/javascripts/lightgallery-all.js

Summary

Maintainability
F
3 wks
Test Coverage

File lightgallery-all.js has 2099 lines of code (exceeds 250 allowed). Consider refactoring.
Open

/*! lightgallery - v1.2.22 - 2016-07-20
* http://sachinchoolur.github.io/lightGallery/
* Copyright (c) 2016 Sachin N; Licensed Apache 2.0 */
(function($, window, document, undefined) {

Severity: Major
Found in assets/javascripts/lightgallery-all.js - About 5 days to fix

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

        Video.prototype.init = function() {
            var _this = this;
    
            // Event triggered when video url found without poster
            _this.core.$el.on('hasVideo.lg.tm', function(event, index, src, html) {
    Severity: Major
    Found in assets/javascripts/lightgallery-all.js - About 5 hrs to fix

      Function loadContent has 126 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          Plugin.prototype.loadContent = function(index, rec, delay) {
      
              var _this = this;
              var _hasPoster = false;
              var _$img;
      Severity: Major
      Found in assets/javascripts/lightgallery-all.js - About 5 hrs to fix

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

            Zoom.prototype.init = function() {
        
                var _this = this;
                var zoomIcons = '<span id="lg-zoom-in" class="lg-icon"></span><span id="lg-zoom-out" class="lg-icon"></span>';
        
        
        Severity: Major
        Found in assets/javascripts/lightgallery-all.js - About 4 hrs to fix

          Function build has 111 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              Thumbnail.prototype.build = function() {
                  var _this = this;
                  var thumbList = '';
                  var vimeoErrorThumbSize = '';
                  var $thumb;
          Severity: Major
          Found in assets/javascripts/lightgallery-all.js - About 4 hrs to fix

            Function slide has 94 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                Plugin.prototype.slide = function(index, fromTouch, fromThumb) {
            
                    var _prevIndex = this.$outer.find('.lg-current').index();
                    var _this = this;
            
            
            Severity: Major
            Found in assets/javascripts/lightgallery-all.js - About 3 hrs to fix

              Function structure has 72 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  Plugin.prototype.structure = function() {
                      var list = '';
                      var controls = '';
                      var i = 0;
                      var subHtmlCont = '';
              Severity: Major
              Found in assets/javascripts/lightgallery-all.js - About 2 hrs to fix

                Function zoomDrag has 67 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    Zoom.prototype.zoomDrag = function() {
                
                        var _this = this;
                        var startCoords = {};
                        var endCoords = {};
                Severity: Major
                Found in assets/javascripts/lightgallery-all.js - About 2 hrs to fix

                  Function loadOnClick has 67 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                          var loadOnClick = function($el) {
                              // check slide has poster
                              if ($el.find('.lg-object').hasClass('lg-has-poster') && $el.find('.lg-object').is(':visible')) {
                  
                                  // check already video element present
                  Severity: Major
                  Found in assets/javascripts/lightgallery-all.js - About 2 hrs to fix

                    Function zoomSwipe has 59 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        Zoom.prototype.zoomSwipe = function() {
                            var _this = this;
                            var startCoords = {};
                            var endCoords = {};
                            var isMoved = false;
                    Severity: Major
                    Found in assets/javascripts/lightgallery-all.js - About 2 hrs to fix

                      Function addHtml has 55 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          Plugin.prototype.addHtml = function(index) {
                              var subHtml = null;
                              var subHtmlUrl;
                              var $currentEle;
                              if (this.s.dynamic) {
                      Severity: Major
                      Found in assets/javascripts/lightgallery-all.js - About 2 hrs to fix

                        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

                          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

                                                Function build has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                                                Open

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

                                                  Function getThumb has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                                                  Open

                                                          function getThumb(src, thumb, index) {
                                                              var isVideo = _this.core.isVideo(src, index) || {};
                                                              var thumbImg;
                                                              var vimeoId = '';
                                                  
                                                  
                                                  Severity: Minor
                                                  Found in assets/javascripts/lightgallery-all.js - About 1 hr to fix

                                                    Function actualSize has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                                                    Open

                                                            var actualSize = function(event, $image, index, fromIcon) {
                                                                var w = $image.width();
                                                                var nw;
                                                                if (_this.core.s.dynamic) {
                                                                    nw = _this.core.s.dynamicEl[index].width || $image[0].naturalWidth || w;
                                                    Severity: Minor
                                                    Found in assets/javascripts/lightgallery-all.js - About 1 hr to fix

                                                      Avoid deeply nested control flow statements.
                                                      Open

                                                                          if (_this.core.s.loadDailymotionThumbnail) {
                                                                              thumbImg = '//www.dailymotion.com/thumbnail/video/' + isVideo.dailymotion[1];
                                                                          } else {
                                                                              thumbImg = thumb;
                                                                          }
                                                      Severity: Major
                                                      Found in assets/javascripts/lightgallery-all.js - About 45 mins to fix

                                                        Avoid deeply nested control flow statements.
                                                        Open

                                                                            if ((index === _length - 1) && (_prevIndex === 0) && !fromThumb) {
                                                                                _prev = true;
                                                                                _next = false;
                                                                            }
                                                        Severity: Major
                                                        Found in assets/javascripts/lightgallery-all.js - About 45 mins to fix

                                                          Avoid deeply nested control flow statements.
                                                          Open

                                                                  } else if (isVideo.vk) {
                                                          
                                                                      a = '&autoplay=' + autoplay;
                                                                      if (this.core.s.vkPlayerParams) {
                                                                          a = a + '&' + $.param(this.core.s.vkPlayerParams);
                                                          Severity: Major
                                                          Found in assets/javascripts/lightgallery-all.js - About 45 mins to fix

                                                            Avoid deeply nested control flow statements.
                                                            Open

                                                                        if (fL === '.' || fL === '#') {
                                                                            html = $(html).html();
                                                                        }
                                                            Severity: Major
                                                            Found in assets/javascripts/lightgallery-all.js - About 45 mins to fix

                                                              Consider simplifying this complex logical expression.
                                                              Open

                                                                              if (_this.s.dynamic) {
                                                                                  _src = _this.s.dynamicEl[index].downloadUrl !== false && (_this.s.dynamicEl[index].downloadUrl || _this.s.dynamicEl[index].src);
                                                                              } else {
                                                                                  _src = _this.$items.eq(index).attr('data-download-url') !== 'false' && (_this.$items.eq(index).attr('data-download-url') || _this.$items.eq(index).attr('href') || _this.$items.eq(index).attr('data-src'));
                                                              
                                                              
                                                              Severity: Major
                                                              Found in assets/javascripts/lightgallery-all.js - About 40 mins to fix

                                                                Consider simplifying this complex logical expression.
                                                                Open

                                                                        if (_this.core.doCss() && _this.core.$items.length > 1 && ((_this.core.s.enableSwipe && _this.core.isTouch) || (_this.core.s.enableDrag && !_this.core.isTouch))) {
                                                                            _this.core.$el.on('onSlideClick.lg.tm', function() {
                                                                                var $el = _this.core.$slide.eq(_this.core.index);
                                                                                loadOnClick($el);
                                                                            });
                                                                Severity: Major
                                                                Found in assets/javascripts/lightgallery-all.js - About 40 mins to fix

                                                                  Function loadVideo has 5 arguments (exceeds 4 allowed). Consider refactoring.
                                                                  Open

                                                                      Video.prototype.loadVideo = function(src, addClass, noposter, index, html) {
                                                                  Severity: Minor
                                                                  Found in assets/javascripts/lightgallery-all.js - About 35 mins to fix

                                                                    Avoid too many return statements within this function.
                                                                    Open

                                                                                return {
                                                                                    vk: vk
                                                                                };
                                                                    Severity: Major
                                                                    Found in assets/javascripts/lightgallery-all.js - About 30 mins to fix

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

                                                                                          if (youtubePlayer) {
                                                                                              youtubePlayer.contentWindow.postMessage('{"event":"command","func":"playVideo","args":""}', '*');
                                                                                          } else if (vimeoPlayer) {
                                                                                              try {
                                                                                                  $f(vimeoPlayer).api('play');
                                                                      Severity: Major
                                                                      Found in assets/javascripts/lightgallery-all.js and 1 other location - About 7 hrs to fix
                                                                      assets/javascripts/lightgallery-all.js on lines 2308..2329

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

                                                                      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 (youtubePlayer) {
                                                                                      youtubePlayer.contentWindow.postMessage('{"event":"command","func":"pauseVideo","args":""}', '*');
                                                                                  } else if (vimeoPlayer) {
                                                                                      try {
                                                                                          $f(vimeoPlayer).api('pause');
                                                                      Severity: Major
                                                                      Found in assets/javascripts/lightgallery-all.js and 1 other location - About 7 hrs to fix
                                                                      assets/javascripts/lightgallery-all.js on lines 2258..2279

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

                                                                      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

                                                                              } else if (isVideo.vimeo) {
                                                                      
                                                                                  a = '?autoplay=' + autoplay + '&api=1';
                                                                                  if (this.core.s.vimeoPlayerParams) {
                                                                                      a = a + '&' + $.param(this.core.s.vimeoPlayerParams);
                                                                      Severity: Major
                                                                      Found in assets/javascripts/lightgallery-all.js and 2 other locations - About 3 hrs to fix
                                                                      assets/javascripts/lightgallery-all.js on lines 2370..2414
                                                                      assets/javascripts/lightgallery-all.js on lines 2388..2414

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

                                                                      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

                                                                              if (isVideo.youtube) {
                                                                      
                                                                                  a = '?wmode=opaque&autoplay=' + autoplay + '&enablejsapi=1';
                                                                                  if (this.core.s.youtubePlayerParams) {
                                                                                      a = a + '&' + $.param(this.core.s.youtubePlayerParams);
                                                                      Severity: Major
                                                                      Found in assets/javascripts/lightgallery-all.js and 2 other locations - About 3 hrs to fix
                                                                      assets/javascripts/lightgallery-all.js on lines 2379..2414
                                                                      assets/javascripts/lightgallery-all.js on lines 2388..2414

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

                                                                      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

                                                                              } else if (isVideo.dailymotion) {
                                                                      
                                                                                  a = '?wmode=opaque&autoplay=' + autoplay + '&api=postMessage';
                                                                                  if (this.core.s.dailymotionPlayerParams) {
                                                                                      a = a + '&' + $.param(this.core.s.dailymotionPlayerParams);
                                                                      Severity: Major
                                                                      Found in assets/javascripts/lightgallery-all.js and 2 other locations - About 3 hrs to fix
                                                                      assets/javascripts/lightgallery-all.js on lines 2370..2414
                                                                      assets/javascripts/lightgallery-all.js on lines 2379..2414

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

                                                                      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 (document.exitFullscreen) {
                                                                                  document.exitFullscreen();
                                                                              } else if (document.msExitFullscreen) {
                                                                                  document.msExitFullscreen();
                                                                              } else if (document.mozCancelFullScreen) {
                                                                      Severity: Major
                                                                      Found in assets/javascripts/lightgallery-all.js and 1 other location - About 2 hrs to fix
                                                                      assets/javascripts/lightgallery-all.js on lines 1548..1556

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

                                                                      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 (el.requestFullscreen) {
                                                                                  el.requestFullscreen();
                                                                              } else if (el.msRequestFullscreen) {
                                                                                  el.msRequestFullscreen();
                                                                              } else if (el.mozRequestFullScreen) {
                                                                      Severity: Major
                                                                      Found in assets/javascripts/lightgallery-all.js and 1 other location - About 2 hrs to fix
                                                                      assets/javascripts/lightgallery-all.js on lines 1560..1568

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

                                                                      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 (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 2706..2710
                                                                      assets/javascripts/lightgallery-all.js on lines 2792..2796
                                                                      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 2792..2796
                                                                      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 (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

                                                                      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

                                                                      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

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

                                                                                      if (_this.s.loop) {
                                                                                          _this.index = 0;
                                                                                          _this.$el.trigger('onBeforeNextSlide.lg', [_this.index]);
                                                                                          _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 927..936

                                                                      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

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

                                                                                  if (allowY) {
                                                                                      _$el.attr('data-y', Math.abs(distanceY));
                                                                                  } else {
                                                                                      distanceY = -Math.abs(_$el.attr('data-y'));
                                                                                  }
                                                                      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 2870..2874

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

                                                                      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 (allowX) {
                                                                                      _$el.attr('data-x', Math.abs(distanceX));
                                                                                  } else {
                                                                                      distanceX = -Math.abs(_$el.attr('data-x'));
                                                                                  }
                                                                      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 2864..2868

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

                                                                      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 ((Math.abs(endCoords.x - startCoords.x) > 15) || (Math.abs(endCoords.y - startCoords.y) > 15)) {
                                                                                  if (allowY) {
                                                                                      if (distanceY <= -maxY) {
                                                                                          distanceY = -maxY;
                                                                                      } else if (distanceY >= -minY) {
                                                                      Severity: Minor
                                                                      Found in assets/javascripts/lightgallery-all.js and 1 other location - About 55 mins to fix
                                                                      assets/javascripts/lightgallery-all.js on lines 2712..2717

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

                                                                      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 ((Math.abs(endCoords.x - startCoords.x) > 15) || (Math.abs(endCoords.y - startCoords.y) > 15)) {
                                                                                          _$el.css({
                                                                                              left: distanceX + 'px',
                                                                                              top: distanceY + 'px'
                                                                                          });
                                                                      Severity: Minor
                                                                      Found in assets/javascripts/lightgallery-all.js and 1 other location - About 55 mins to fix
                                                                      assets/javascripts/lightgallery-all.js on lines 2847..2881

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

                                                                      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

                                                                                      allowX = $image.outerWidth() * $image.attr('data-scale') > _this.core.$outer.find('.lg').width();
                                                                      Severity: Major
                                                                      Found in assets/javascripts/lightgallery-all.js and 3 other locations - About 55 mins to fix
                                                                      assets/javascripts/lightgallery-all.js on lines 2668..2668
                                                                      assets/javascripts/lightgallery-all.js on lines 2755..2755
                                                                      assets/javascripts/lightgallery-all.js on lines 2756..2756

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

                                                                      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

                                                                                      allowY = $image.outerHeight() * $image.attr('data-scale') > _this.core.$outer.find('.lg').height();
                                                                      Severity: Major
                                                                      Found in assets/javascripts/lightgallery-all.js and 3 other locations - About 55 mins to fix
                                                                      assets/javascripts/lightgallery-all.js on lines 2669..2669
                                                                      assets/javascripts/lightgallery-all.js on lines 2755..2755
                                                                      assets/javascripts/lightgallery-all.js on lines 2756..2756

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

                                                                      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

                                                                                  allowY = $image.outerHeight() * $image.attr('data-scale') > _this.core.$outer.find('.lg').height();
                                                                      Severity: Major
                                                                      Found in assets/javascripts/lightgallery-all.js and 3 other locations - About 55 mins to fix
                                                                      assets/javascripts/lightgallery-all.js on lines 2668..2668
                                                                      assets/javascripts/lightgallery-all.js on lines 2669..2669
                                                                      assets/javascripts/lightgallery-all.js on lines 2756..2756

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

                                                                      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

                                                                                  allowX = $image.outerWidth() * $image.attr('data-scale') > _this.core.$outer.find('.lg').width();
                                                                      Severity: Major
                                                                      Found in assets/javascripts/lightgallery-all.js and 3 other locations - About 55 mins to fix
                                                                      assets/javascripts/lightgallery-all.js on lines 2668..2668
                                                                      assets/javascripts/lightgallery-all.js on lines 2669..2669
                                                                      assets/javascripts/lightgallery-all.js on lines 2755..2755

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

                                                                      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

                                                                                      } else if (_next) {
                                                                      
                                                                                          // next slide
                                                                                          this.$slide.eq(index).addClass('lg-next-slide');
                                                                                          this.$slide.eq(_prevIndex).addClass('lg-prev-slide');
                                                                      Severity: Minor
                                                                      Found in assets/javascripts/lightgallery-all.js and 1 other location - About 50 mins to fix
                                                                      assets/javascripts/lightgallery-all.js on lines 817..827

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

                                                                      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 (_prev) {
                                                                      
                                                                                          //prevslide
                                                                                          this.$slide.eq(index).addClass('lg-prev-slide');
                                                                                          this.$slide.eq(_prevIndex).addClass('lg-next-slide');
                                                                      Severity: Minor
                                                                      Found in assets/javascripts/lightgallery-all.js and 1 other location - About 50 mins to fix
                                                                      assets/javascripts/lightgallery-all.js on lines 822..827

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

                                                                      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 (allowX) {
                                                                                      if (distanceX <= -maxX) {
                                                                                          distanceX = -maxX;
                                                                                      } else if (distanceX >= -minX) {
                                                                                          distanceX = -minX;
                                                                      Severity: Minor
                                                                      Found in assets/javascripts/lightgallery-all.js and 1 other location - About 50 mins to fix
                                                                      assets/javascripts/lightgallery-all.js on lines 2848..2854

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

                                                                      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 (allowY) {
                                                                                      if (distanceY <= -maxY) {
                                                                                          distanceY = -maxY;
                                                                                      } else if (distanceY >= -minY) {
                                                                                          distanceY = -minY;
                                                                      Severity: Minor
                                                                      Found in assets/javascripts/lightgallery-all.js and 1 other location - About 50 mins to fix
                                                                      assets/javascripts/lightgallery-all.js on lines 2856..2862

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

                                                                      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

                                                                                      endCoords = {
                                                                                          x: e.originalEvent.targetTouches[0].pageX,
                                                                                          y: e.originalEvent.targetTouches[0].pageY
                                                                                      };
                                                                      Severity: Minor
                                                                      Found in assets/javascripts/lightgallery-all.js and 1 other location - About 40 mins to fix
                                                                      assets/javascripts/lightgallery-all.js on lines 2672..2675

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

                                                                      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

                                                                                          startCoords = {
                                                                                              x: e.originalEvent.targetTouches[0].pageX,
                                                                                              y: e.originalEvent.targetTouches[0].pageY
                                                                                          };
                                                                      Severity: Minor
                                                                      Found in assets/javascripts/lightgallery-all.js and 1 other location - About 40 mins to fix
                                                                      assets/javascripts/lightgallery-all.js on lines 2692..2695

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

                                                                      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

                                                                                      if (Math.abs(endCoords - startCoords) < _this.core.s.swipeThreshold) {
                                                                                          _this.thumbClickable = true;
                                                                                      }
                                                                      Severity: Minor
                                                                      Found in assets/javascripts/lightgallery-all.js and 1 other location - About 35 mins to fix
                                                                      assets/javascripts/lightgallery-all.js on lines 2086..2088

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

                                                                      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

                                                                                          if (Math.abs(endCoords - startCoords) < _this.core.s.swipeThreshold) {
                                                                                              _this.thumbClickable = true;
                                                                                          }
                                                                      Severity: Minor
                                                                      Found in assets/javascripts/lightgallery-all.js and 1 other location - About 35 mins to fix
                                                                      assets/javascripts/lightgallery-all.js on lines 2023..2025

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

                                                                      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

                                                                                  _src = _this.$items.eq(index).attr('href') || _this.$items.eq(index).attr('data-src');
                                                                      Severity: Minor
                                                                      Found in assets/javascripts/lightgallery-all.js and 1 other location - About 30 mins to fix
                                                                      assets/javascripts/lightgallery-all.js on lines 767..767

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

                                                                      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 minY = (_this.core.$outer.find('.lg').height() - $image.outerHeight()) / 2;
                                                                      Severity: Minor
                                                                      Found in assets/javascripts/lightgallery-all.js and 1 other location - About 30 mins to fix
                                                                      assets/javascripts/lightgallery-all.js on lines 2844..2844

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

                                                                      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 minX = (_this.core.$outer.find('.lg').width() - $image.outerWidth()) / 2;
                                                                      Severity: Minor
                                                                      Found in assets/javascripts/lightgallery-all.js and 1 other location - About 30 mins to fix
                                                                      assets/javascripts/lightgallery-all.js on lines 2842..2842

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

                                                                      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

                                                                                          _src = _this.$items.eq(index).attr('data-download-url') !== 'false' && (_this.$items.eq(index).attr('data-download-url') || _this.$items.eq(index).attr('href') || _this.$items.eq(index).attr('data-src'));
                                                                      Severity: Minor
                                                                      Found in assets/javascripts/lightgallery-all.js and 1 other location - About 30 mins to fix
                                                                      assets/javascripts/lightgallery-all.js on lines 615..615

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

                                                                      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

                                                                      There are no issues that match your filters.

                                                                      Category
                                                                      Status