sodabrew/puppet-dashboard

View on GitHub
app/assets/javascripts/jquery.colorbox.js

Summary

Maintainability
F
6 days
Test Coverage

File jquery.colorbox.js has 763 lines of code (exceeds 250 allowed). Consider refactoring.
Open

/*!
    jQuery Colorbox v1.4.10 - 2013-04-02
    (c) 2013 Jack Moore - jacklmoore.com/colorbox
    license: http://www.opensource.org/licenses/mit-license.php
*/
Severity: Major
Found in app/assets/javascripts/jquery.colorbox.js - About 1 day to fix

    Function prep has 120 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        publicMethod.prep = function (object) {
            if (!open) {
                return;
            }
            
    Severity: Major
    Found in app/assets/javascripts/jquery.colorbox.js - About 4 hrs to fix

      Function load has 91 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          function load () {
              var href, setResize, prep = publicMethod.prep, $inline, request = ++requests;
              
              active = true;
              
      Severity: Major
      Found in app/assets/javascripts/jquery.colorbox.js - About 3 hrs to fix

        Function position has 65 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            publicMethod.position = function (speed, loadedCallback) {
                var
                css,
                top = 0,
                left = 0,
        Severity: Major
        Found in app/assets/javascripts/jquery.colorbox.js - About 2 hrs to fix

          Function launch has 62 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              function launch(target) {
                  if (!closing) {
                      
                      element = target;
                      
          Severity: Major
          Found in app/assets/javascripts/jquery.colorbox.js - About 2 hrs to fix

            Function slideshow has 51 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                function slideshow() {
                    var
                    timeOut,
                    className = prefix + "Slideshow_",
                    click = "click." + prefix,
            Severity: Major
            Found in app/assets/javascripts/jquery.colorbox.js - About 2 hrs to fix

              Function addBindings has 48 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  function addBindings() {
                      function clickHandler(e) {
                          // ignore non-left-mouse-clicks and clicks modified with ctrl / command, shift, or alt.
                          // See: http://jacklmoore.com/notes/click-events/
                          if (!(e.which > 1 || e.shiftKey || e.altKey || e.metaKey || e.control)) {
              Severity: Minor
              Found in app/assets/javascripts/jquery.colorbox.js - About 1 hr to fix

                Function appendHTML has 42 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    function appendHTML() {
                        if (!$box && document.body) {
                            init = false;
                            $window = $(window);
                            $box = $tag(div).attr({
                Severity: Minor
                Found in app/assets/javascripts/jquery.colorbox.js - About 1 hr to fix

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

                          function getWidth() {
                              settings.w = settings.w || $loaded.width();
                              settings.w = settings.mw && settings.mw < settings.w ? settings.mw : settings.w;
                              return settings.w;
                          }
                  Severity: Major
                  Found in app/assets/javascripts/jquery.colorbox.js and 1 other location - About 2 hrs to fix
                  app/assets/javascripts/jquery.colorbox.js on lines 687..691

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

                  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

                          function getHeight() {
                              settings.h = settings.h || $loaded.height();
                              settings.h = settings.mh && settings.mh < settings.h ? settings.mh : settings.h;
                              return settings.h;
                          }
                  Severity: Major
                  Found in app/assets/javascripts/jquery.colorbox.js and 1 other location - About 2 hrs to fix
                  app/assets/javascripts/jquery.colorbox.js on lines 682..686

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

                  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 (settings.maxWidth) {
                              settings.mw = setSize(settings.maxWidth, 'x') - loadedWidth - interfaceWidth;
                              settings.mw = settings.w && settings.w < settings.mw ? settings.w : settings.mw;
                          }
                  Severity: Major
                  Found in app/assets/javascripts/jquery.colorbox.js and 1 other location - About 2 hrs to fix
                  app/assets/javascripts/jquery.colorbox.js on lines 858..861

                  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

                          if (settings.maxHeight) {
                              settings.mh = setSize(settings.maxHeight, 'y') - loadedHeight - interfaceHeight;
                              settings.mh = settings.h && settings.h < settings.mh ? settings.h : settings.mh;
                          }
                  Severity: Major
                  Found in app/assets/javascripts/jquery.colorbox.js and 1 other location - About 2 hrs to fix
                  app/assets/javascripts/jquery.colorbox.js on lines 854..857

                  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

                              $topBorder[0].style.width = $bottomBorder[0].style.width = $content[0].style.width = (parseInt(that.style.width,10) - interfaceWidth)+'px';
                  Severity: Major
                  Found in app/assets/javascripts/jquery.colorbox.js and 1 other location - About 1 hr to fix
                  app/assets/javascripts/jquery.colorbox.js on lines 608..608

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

                  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

                              $content[0].style.height = $leftBorder[0].style.height = $rightBorder[0].style.height = (parseInt(that.style.height,10) - interfaceHeight)+'px';
                  Severity: Major
                  Found in app/assets/javascripts/jquery.colorbox.js and 1 other location - About 1 hr to fix
                  app/assets/javascripts/jquery.colorbox.js on lines 607..607

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

                  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 (settings.mh && photo.height > settings.mh) {
                                          percent = (photo.height - settings.mh) / photo.height;
                                          setResize();
                                      }
                  Severity: Major
                  Found in app/assets/javascripts/jquery.colorbox.js and 1 other location - About 1 hr to fix
                  app/assets/javascripts/jquery.colorbox.js on lines 912..915

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

                  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 (settings.mw && photo.width > settings.mw) {
                                          percent = (photo.width - settings.mw) / photo.width;
                                          setResize();
                                      }
                  Severity: Major
                  Found in app/assets/javascripts/jquery.colorbox.js and 1 other location - About 1 hr to fix
                  app/assets/javascripts/jquery.colorbox.js on lines 916..919

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

                  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

                          settings.w = settings.width ?
                                  setSize(settings.width, 'x') - loadedWidth - interfaceWidth :
                                  settings.innerWidth && setSize(settings.innerWidth, 'x');
                  Severity: Minor
                  Found in app/assets/javascripts/jquery.colorbox.js and 1 other location - About 55 mins to fix
                  app/assets/javascripts/jquery.colorbox.js on lines 840..842

                  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

                          settings.h = settings.height ?
                                  setSize(settings.height, 'y') - loadedHeight - interfaceHeight :
                                  settings.innerHeight && setSize(settings.innerHeight, 'y');
                  Severity: Minor
                  Found in app/assets/javascripts/jquery.colorbox.js and 1 other location - About 55 mins to fix
                  app/assets/javascripts/jquery.colorbox.js on lines 844..846

                  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

                                  interfaceHeight = $topBorder.height() + $bottomBorder.height() + $content.outerHeight(true) - $content.height();
                  Severity: Minor
                  Found in app/assets/javascripts/jquery.colorbox.js and 1 other location - About 35 mins to fix
                  app/assets/javascripts/jquery.colorbox.js on lines 350..350

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

                  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

                                  interfaceWidth = $leftBorder.width() + $rightBorder.width() + $content.outerWidth(true) - $content.width();
                  Severity: Minor
                  Found in app/assets/javascripts/jquery.colorbox.js and 1 other location - About 35 mins to fix
                  app/assets/javascripts/jquery.colorbox.js on lines 349..349

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

                  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