fossasia/loklak_webclient

View on GitHub
app/js/components/photoswipe-ui-default.js

Summary

Maintainability
F
6 days
Test Coverage

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

 function(pswp, framework) {

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

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

    /*! PhotoSwipe Default UI - 4.0.7 - 2015-03-18
    * http://photoswipe.com
    * Copyright (c) 2015 Dmitry Semenov; */
    /**
    *
    Severity: Major
    Found in app/js/components/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 app/js/components/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 app/js/components/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 app/js/components/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 app/js/components/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 app/js/components/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 app/js/components/photoswipe-ui-default.js - About 45 mins to fix

                  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 app/js/components/photoswipe-ui-default.js and 1 other location - About 35 mins to fix
                  app/js/components/photoswipe-ui-default.js on lines 427..436

                  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: 'share-modal', 
                              option: 'shareEl',
                              onInit: function(el) {  
                                  _shareModal = el;
                  Severity: Minor
                  Found in app/js/components/photoswipe-ui-default.js and 1 other location - About 35 mins to fix
                  app/js/components/photoswipe-ui-default.js on lines 437..446

                  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