woothemes/woocommerce

View on GitHub
assets/js/photoswipe/photoswipe-ui-default.js

Summary

Maintainability
F
6 days
Test Coverage

Function PhotoSwipeUI_Default has 641 lines of code (exceeds 25 allowed). Consider refactoring.
Open

 function(pswp, framework) {

    var ui = this;
    var _overlayUIUpdated = false,
        _controlsVisible = true,
Severity: Major
Found in assets/js/photoswipe/photoswipe-ui-default.js - About 3 days to fix

    File photoswipe-ui-default.js has 656 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    /*! PhotoSwipe Default UI - 4.1.3 - 2019-01-08
    * http://photoswipe.com
    * Copyright (c) 2019 Dmitry Semenov; */
    /**
    *
    Severity: Major
    Found in assets/js/photoswipe/photoswipe-ui-default.js - About 1 day to fix

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

          ui.init = function() {
      
              // extend options
              framework.extend(pswp.options, _defaultUIOptions, true);
      
      
      Severity: Major
      Found in assets/js/photoswipe/photoswipe-ui-default.js - About 3 hrs to fix

        Function getFullscreenAPI has 49 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            ui.getFullscreenAPI = function() {
                var dE = document.documentElement,
                    api,
                    tF = 'fullscreenchange';
        
        
        Severity: Minor
        Found in assets/js/photoswipe/photoswipe-ui-default.js - About 1 hr to fix

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

              ui.onGlobalTap = function(e) {
                  e = e || window.event;
                  var target = e.target || e.srcElement;
          
                  if(_blockControlsTap) {
          Severity: Minor
          Found in assets/js/photoswipe/photoswipe-ui-default.js - About 1 hr to fix

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

                var _setupUIElements = function() {
                    var item,
                        classAttr,
                        uiElement;
            
            
            Severity: Minor
            Found in assets/js/photoswipe/photoswipe-ui-default.js - About 1 hr to fix

              Function _onControlsTap has 28 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  var _onControlsTap = function(e) {
                          if(_blockControlsTap) {
                              return true;
                          }
              
              
              Severity: Minor
              Found in assets/js/photoswipe/photoswipe-ui-default.js - About 1 hr to fix

                Avoid deeply nested control flow statements.
                Open

                                            if(uiElement.onInit) {
                                                uiElement.onInit(item);
                                            }
                Severity: Major
                Found in assets/js/photoswipe/photoswipe-ui-default.js - About 45 mins to fix

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

                  (function (root, factory) { 
                      if (typeof define === 'function' && define.amd) {
                          define(factory);
                      } else if (typeof exports === 'object') {
                          module.exports = factory();
                  Severity: Major
                  Found in assets/js/photoswipe/photoswipe-ui-default.js and 1 other location - About 2 hrs to fix
                  assets/js/photoswipe/photoswipe.js on lines 4..3735

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

                  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

                              addCaptionHTMLFn: function(item, captionEl /*, isFake */) {
                                  if(!item.title) {
                                      captionEl.children[0].innerHTML = '';
                                      return false;
                                  }
                  Severity: Major
                  Found in assets/js/photoswipe/photoswipe-ui-default.js and 1 other location - About 1 hr to fix
                  assets/js/frontend/single-product.js on lines 311..318

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

                  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

                          { 
                              name: 'share-modal', 
                              option: 'shareEl',
                              onInit: function(el) {  
                                  _shareModal = el;
                  Severity: Minor
                  Found in assets/js/photoswipe/photoswipe-ui-default.js and 1 other location - About 35 mins to fix
                  assets/js/photoswipe/photoswipe-ui-default.js on lines 438..447

                  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

                          { 
                              name: 'button--share', 
                              option: 'shareEl',
                              onInit: function(el) { 
                                  _shareButton = el;
                  Severity: Minor
                  Found in assets/js/photoswipe/photoswipe-ui-default.js and 1 other location - About 35 mins to fix
                  assets/js/photoswipe/photoswipe-ui-default.js on lines 428..437

                  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

                  There are no issues that match your filters.

                  Category
                  Status