suryart/spree_lookbook

View on GitHub

Showing 18 of 18 total issues

Function _create has 267 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    _create: function() {
        var self = this;
        var o = self.options;
        //each picture
        $('.ip_slide').each(function( index, value ) {
Severity: Major
Found in app/assets/javascripts/admin/jQuery.iPicture.init.js - About 1 day to fix

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

                    $('#'+value.id +' .bgList').bind('click', function(){
                      if(clickCounter2==0){
                       $(bgDropp).css('display','block');
                       clickCounter2=1;
                      }else if(clickCounter2==1){
    Severity: Major
    Found in app/assets/javascripts/admin/jQuery.iPicture.init.js and 1 other location - About 3 hrs to fix
    app/assets/javascripts/admin/jQuery.iPicture.init.js on lines 189..198

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

    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

                    $('#'+value.id +' .roundList').bind('click', function(){
                      if(clickBgCounter==0){
                       $(bgRoundDropp).css('display','block');
                       clickBgCounter=1;
                      }else if(clickBgCounter==1){
    Severity: Major
    Found in app/assets/javascripts/admin/jQuery.iPicture.init.js and 1 other location - About 3 hrs to fix
    app/assets/javascripts/admin/jQuery.iPicture.init.js on lines 153..162

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

    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

    File jQuery.iPicture.init.js has 291 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    /*
     * jQuery UI iPicture² 1.0.0
     *
     * Copyright 2011 D'Alia Sara
     * Dual licensed under the MIT or GPL Version 2 licenses.
    Severity: Minor
    Found in app/assets/javascripts/admin/jQuery.iPicture.init.js - About 3 hrs to fix

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

        class LookbookImage < Asset
          validates_attachment_presence :attachment
          validate :no_attachment_errors
      
          attr_accessible :alt, :attachment, :position, :viewable_type, :viewable_id
      Severity: Major
      Found in app/models/spree/lookbook_image.rb and 1 other location - About 2 hrs to fix
      app/models/spree/lookbook_collection_image.rb on lines 2..48

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

      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

        class LookbookCollectionImage < Asset
          validates_attachment_presence :attachment
          validate :no_attachment_errors
      
          attr_accessible :alt, :attachment, :position, :viewable_type, :viewable_id
      Severity: Major
      Found in app/models/spree/lookbook_collection_image.rb and 1 other location - About 2 hrs to fix
      app/models/spree/lookbook_image.rb on lines 2..48

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

      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

                    case 0:
                        bgPar.css('left','0').css('right','-55px').css('top','40px');
                        pTurn.css('left','60px').css('right','-40px').css('top','30px');
                        pTurn.parent('.more').attr('data-animationtype','ttb-slide');
                        return ++countTurn;
      Severity: Major
      Found in app/assets/javascripts/admin/jQuery.iPicture.init.js and 1 other location - About 2 hrs to fix
      app/assets/javascripts/admin/jQuery.iPicture.init.js on lines 304..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 90.

      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

                    case 2:
                        bgPar.css('left','0').css('right','-55px').css('top','-40px');
                        pTurn.css('left','65px').css('right','-40px').css('top','-50px');
                        pTurn.parent('.more').attr('data-animationtype','btt-slide');
                        return ++countTurn;
      Severity: Major
      Found in app/assets/javascripts/admin/jQuery.iPicture.init.js and 1 other location - About 2 hrs to fix
      app/assets/javascripts/admin/jQuery.iPicture.init.js on lines 292..297

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

      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

                          $(button).bind('mouseout', function(){
                            $(button).css('width','32');
                              $(button).css('height','36');
                              $(button).css('background-size','32px');
                              $(button).css('z-index','1');
      Severity: Major
      Found in app/assets/javascripts/admin/jQuery.iPicture.init.js and 1 other location - About 2 hrs to fix
      app/assets/javascripts/admin/jQuery.iPicture.init.js on lines 98..103

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

      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

                          $(button).bind('mouseover', function(){
                              $(button).css('width','36');
                              $(button).css('height','36');
                              $(button).css('background-size','36px');
                              $(button).css('z-index','10');
      Severity: Major
      Found in app/assets/javascripts/admin/jQuery.iPicture.init.js and 1 other location - About 2 hrs to fix
      app/assets/javascripts/admin/jQuery.iPicture.init.js on lines 104..109

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

      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

      Function drop has 46 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

                          drop: function( event, ui ) {
                              plus++;
                              var countTurn=0;
                              var div = $('<div class="more more32 '+o.button+'" title="Click or drag"></div>' )
                                  .attr("data-button", o.button)
      Severity: Minor
      Found in app/assets/javascripts/admin/jQuery.iPicture.init.js - About 1 hr to fix

        Function turnTooltip has 26 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

                function turnTooltip(countTurn, bgPar, pTurn){
                    switch(countTurn){
                      case 0:
                          bgPar.css('left','0').css('right','-55px').css('top','40px');
                          pTurn.css('left','60px').css('right','-40px').css('top','30px');
        Severity: Minor
        Found in app/assets/javascripts/admin/jQuery.iPicture.init.js - About 1 hr to fix

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

                              $(roundBg).bind('mouseover', function(){
                                  $(roundBg).css('border','1px solid red');
                                  $(roundBg).css('z-index','10');
                              });
          Severity: Major
          Found in app/assets/javascripts/admin/jQuery.iPicture.init.js and 3 other locations - About 55 mins to fix
          app/assets/javascripts/admin/jQuery.iPicture.init.js on lines 143..146
          app/assets/javascripts/admin/jQuery.iPicture.init.js on lines 147..150
          app/assets/javascripts/admin/jQuery.iPicture.init.js on lines 183..186

          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

                              $(roundBg).bind('mouseout', function(){
                                $(roundBg).css('border','0');
                                  $(roundBg).css('z-index','1');
                              });
          Severity: Major
          Found in app/assets/javascripts/admin/jQuery.iPicture.init.js and 3 other locations - About 55 mins to fix
          app/assets/javascripts/admin/jQuery.iPicture.init.js on lines 143..146
          app/assets/javascripts/admin/jQuery.iPicture.init.js on lines 147..150
          app/assets/javascripts/admin/jQuery.iPicture.init.js on lines 179..182

          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

                              $(bg).bind('mouseout', function(){
                                $(bg).css('border','0');
                                  $(bg).css('z-index','1');
                              });
          Severity: Major
          Found in app/assets/javascripts/admin/jQuery.iPicture.init.js and 3 other locations - About 55 mins to fix
          app/assets/javascripts/admin/jQuery.iPicture.init.js on lines 143..146
          app/assets/javascripts/admin/jQuery.iPicture.init.js on lines 179..182
          app/assets/javascripts/admin/jQuery.iPicture.init.js on lines 183..186

          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

                              $(bg).bind('mouseover', function(){
                                  $(bg).css('border','1px solid red');
                                  $(bg).css('z-index','10');
                              });
          Severity: Major
          Found in app/assets/javascripts/admin/jQuery.iPicture.init.js and 3 other locations - About 55 mins to fix
          app/assets/javascripts/admin/jQuery.iPicture.init.js on lines 147..150
          app/assets/javascripts/admin/jQuery.iPicture.init.js on lines 179..182
          app/assets/javascripts/admin/jQuery.iPicture.init.js on lines 183..186

          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

          Method define_look_image_method has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
          Open

              def define_look_image_method(style)
                self.class.send :define_method, "#{style}_look_image" do |look, *options|
                  options = options.first || {}
                  if look.look_images.empty?
                    image_tag "noimage/#{style}.png", options
          Severity: Minor
          Found in app/helpers/spree/looks_helper.rb - About 45 mins to fix

          Cognitive Complexity

          Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

          A method's cognitive complexity is based on a few simple rules:

          • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
          • Code is considered more complex for each "break in the linear flow of the code"
          • Code is considered more complex when "flow breaking structures are nested"

          Further reading

          Method save_tooltip has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
          Open

                def save_tooltip
                  unless params[:tooltip].blank?
                    @look_image.tooltip.present? ? @look_image.tooltip.update_attributes(params[:tooltip]) : (@look_image.tooltip = Spree::Tooltip.create(params[:tooltip]))
                    add_tooltip_locations
                  end
          Severity: Minor
          Found in app/controllers/spree/admin/look_images_controller.rb - About 35 mins to fix

          Cognitive Complexity

          Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

          A method's cognitive complexity is based on a few simple rules:

          • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
          • Code is considered more complex for each "break in the linear flow of the code"
          • Code is considered more complex when "flow breaking structures are nested"

          Further reading

          Severity
          Category
          Status
          Source
          Language