woothemes/woocommerce

View on GitHub
assets/js/prettyPhoto/jquery.prettyPhoto.js

Summary

Maintainability
F
1 wk
Test Coverage

Function prettyPhoto has 585 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    $.fn.prettyPhoto = function(pp_settings) {
        pp_settings = jQuery.extend({
            hook: 'rel', /* the attribute tag to use for prettyPhoto hooks. default: 'rel'. For HTML5, use "data-rel" or similar. */
            animation_speed: 'fast', /* fast/slow/normal */
            ajaxcallback: function() {},
Severity: Major
Found in assets/js/prettyPhoto/jquery.prettyPhoto.js - About 2 days to fix

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

    /* ------------------------------------------------------------------------
        Class: prettyPhoto
        Use: Lightbox clone for jQuery
        Author: Stephane Caron (http://www.no-margin-for-errors.com)
        Version: 3.1.6
    Severity: Major
    Found in assets/js/prettyPhoto/jquery.prettyPhoto.js - About 1 day to fix

      Function open has 128 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

              $.prettyPhoto.open = function(event) {
                  if(typeof settings == "undefined"){ // Means it's an API call, need to manually get the settings and set the variables
                      settings = pp_settings;
                      pp_images = $.makeArray(arguments[0]);
                      pp_titles = (arguments[1]) ? $.makeArray(arguments[1]) : $.makeArray("");
      Severity: Major
      Found in assets/js/prettyPhoto/jquery.prettyPhoto.js - About 5 hrs to fix

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

                function _build_overlay(caller){
                    // Inject Social Tool markup into General markup
                    if(settings.social_tools)
                        facebook_like_link = settings.social_tools.replace('{location_href}', encodeURIComponent(location.href));
        
        
        Severity: Major
        Found in assets/js/prettyPhoto/jquery.prettyPhoto.js - About 3 hrs to fix

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

                  function _fitToViewport(width,height){
                      resized = false;
          
                      _getDimensions(width,height);
          
          
          Severity: Minor
          Found in assets/js/prettyPhoto/jquery.prettyPhoto.js - About 1 hr to fix

            Function _showContent has 30 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                    function _showContent(){
                        $('.pp_loaderIcon').hide();
            
                        // Calculate the opened top position of the pic holder
                        projectedTop = scroll_pos['scrollTop'] + ((windowHeight/2) - (pp_dimensions['containerHeight']/2));
            Severity: Minor
            Found in assets/js/prettyPhoto/jquery.prettyPhoto.js - About 1 hr to fix

              Avoid deeply nested control flow statements.
              Open

                                              if(!settings.modal)
                                              $.prettyPhoto.close();
              Severity: Major
              Found in assets/js/prettyPhoto/jquery.prettyPhoto.js - About 45 mins to fix

                Avoid too many return statements within this function.
                Open

                                return 'ajax';
                Severity: Major
                Found in assets/js/prettyPhoto/jquery.prettyPhoto.js - About 30 mins to fix

                  Avoid too many return statements within this function.
                  Open

                                  return 'custom';
                  Severity: Major
                  Found in assets/js/prettyPhoto/jquery.prettyPhoto.js - About 30 mins to fix

                    Avoid too many return statements within this function.
                    Open

                                    return 'iframe';
                    Severity: Major
                    Found in assets/js/prettyPhoto/jquery.prettyPhoto.js - About 30 mins to fix

                      Avoid too many return statements within this function.
                      Open

                                      return 'image';
                      Severity: Major
                      Found in assets/js/prettyPhoto/jquery.prettyPhoto.js - About 30 mins to fix

                        Avoid too many return statements within this function.
                        Open

                                        return 'inline';
                        Severity: Major
                        Found in assets/js/prettyPhoto/jquery.prettyPhoto.js - About 30 mins to fix

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

                                      $pp_pic_holder.find('.pp_pause').unbind('click').removeClass('pp_pause').addClass('pp_play').click(function(){
                                          $.prettyPhoto.startSlideshow();
                                          return false;
                                      });
                          Severity: Major
                          Found in assets/js/prettyPhoto/jquery.prettyPhoto.js and 1 other location - About 1 hr to fix
                          assets/js/prettyPhoto/jquery.prettyPhoto.js on lines 434..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 65.

                          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

                                          $pp_pic_holder.find('.pp_play').unbind('click').removeClass('pp_play').addClass('pp_pause').click(function(){
                                              $.prettyPhoto.stopSlideshow();
                                              return false;
                                          });
                          Severity: Major
                          Found in assets/js/prettyPhoto/jquery.prettyPhoto.js and 1 other location - About 1 hr to fix
                          assets/js/prettyPhoto/jquery.prettyPhoto.js on lines 449..452

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

                          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

                                      $pp_pic_holder.find('.pp_previous, .pp_nav .pp_arrow_previous').bind('click',function(){
                                          $.prettyPhoto.changePage('previous');
                                          $.prettyPhoto.stopSlideshow();
                                          return false;
                                      });
                          Severity: Major
                          Found in assets/js/prettyPhoto/jquery.prettyPhoto.js and 1 other location - About 1 hr to fix
                          assets/js/prettyPhoto/jquery.prettyPhoto.js on lines 859..863

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

                          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

                                      $pp_pic_holder.find('.pp_next, .pp_nav .pp_arrow_next').bind('click',function(){
                                          $.prettyPhoto.changePage('next');
                                          $.prettyPhoto.stopSlideshow();
                                          return false;
                                      });
                          Severity: Major
                          Found in assets/js/prettyPhoto/jquery.prettyPhoto.js and 1 other location - About 1 hr to fix
                          assets/js/prettyPhoto/jquery.prettyPhoto.js on lines 853..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 57.

                          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

                                          $pp_gallery.find('.pp_arrow_next').click(function(){
                                              $.prettyPhoto.changeGalleryPage('next');
                                              $.prettyPhoto.stopSlideshow();
                                              return false;
                                          });
                          Severity: Major
                          Found in assets/js/prettyPhoto/jquery.prettyPhoto.js and 1 other location - About 1 hr to fix
                          assets/js/prettyPhoto/jquery.prettyPhoto.js on lines 785..789

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

                          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

                                          $pp_gallery.find('.pp_arrow_previous').click(function(){
                                              $.prettyPhoto.changeGalleryPage('previous');
                                              $.prettyPhoto.stopSlideshow();
                                              return false;
                                          });
                          Severity: Major
                          Found in assets/js/prettyPhoto/jquery.prettyPhoto.js and 1 other location - About 1 hr to fix
                          assets/js/prettyPhoto/jquery.prettyPhoto.js on lines 779..783

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

                          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

                                                  toInject = settings.quicktime_markup.replace(/{width}/g,pp_dimensions['width']).replace(/{height}/g,pp_dimensions['height']).replace(/{wmode}/g,settings.wmode).replace(/{path}/g,pp_images[set_position]).replace(/{autoplay}/g,settings.autoplay);
                          Severity: Major
                          Found in assets/js/prettyPhoto/jquery.prettyPhoto.js and 2 other locations - About 40 mins to fix
                          assets/js/prettyPhoto/jquery.prettyPhoto.js on lines 287..287
                          assets/js/prettyPhoto/jquery.prettyPhoto.js on lines 321..321

                          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 3 locations. Consider refactoring.
                          Open

                                                  toInject = settings.iframe_markup.replace(/{width}/g,pp_dimensions['width']).replace(/{height}/g,pp_dimensions['height']).replace(/{wmode}/g,settings.wmode).replace(/{path}/g,movie);
                          Severity: Major
                          Found in assets/js/prettyPhoto/jquery.prettyPhoto.js and 2 other locations - About 40 mins to fix
                          assets/js/prettyPhoto/jquery.prettyPhoto.js on lines 309..309
                          assets/js/prettyPhoto/jquery.prettyPhoto.js on lines 321..321

                          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 3 locations. Consider refactoring.
                          Open

                                                  toInject =  settings.flash_markup.replace(/{width}/g,pp_dimensions['width']).replace(/{height}/g,pp_dimensions['height']).replace(/{wmode}/g,settings.wmode).replace(/{path}/g,filename+'?'+flash_vars);
                          Severity: Major
                          Found in assets/js/prettyPhoto/jquery.prettyPhoto.js and 2 other locations - About 40 mins to fix
                          assets/js/prettyPhoto/jquery.prettyPhoto.js on lines 287..287
                          assets/js/prettyPhoto/jquery.prettyPhoto.js on lines 309..309

                          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

                                      if(movie_width.indexOf('%') != -1) { movie_width = parseFloat(($(window).width() * parseFloat(movie_width) / 100) - 150); percentBased = true; }
                          Severity: Minor
                          Found in assets/js/prettyPhoto/jquery.prettyPhoto.js and 1 other location - About 40 mins to fix
                          assets/js/prettyPhoto/jquery.prettyPhoto.js on lines 226..226

                          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

                                      if(movie_height.indexOf('%') != -1) { movie_height = parseFloat(($(window).height() * parseFloat(movie_height) / 100) - 150); percentBased = true; }
                          Severity: Minor
                          Found in assets/js/prettyPhoto/jquery.prettyPhoto.js and 1 other location - About 40 mins to fix
                          assets/js/prettyPhoto/jquery.prettyPhoto.js on lines 227..227

                          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

                                      movie_height = ( parseFloat(getParam('height',pp_images[set_position])) ) ? getParam('height',pp_images[set_position]) : settings.default_height.toString();
                          Severity: Minor
                          Found in assets/js/prettyPhoto/jquery.prettyPhoto.js and 1 other location - About 30 mins to fix
                          assets/js/prettyPhoto/jquery.prettyPhoto.js on lines 221..221

                          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

                                      movie_width = ( parseFloat(getParam('width',pp_images[set_position])) ) ? getParam('width',pp_images[set_position]) : settings.default_width.toString();
                          Severity: Minor
                          Found in assets/js/prettyPhoto/jquery.prettyPhoto.js and 1 other location - About 30 mins to fix
                          assets/js/prettyPhoto/jquery.prettyPhoto.js on lines 222..222

                          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