suryart/spree_lookbook

View on GitHub

Showing 6 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

    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

      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

          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