drhenner/ror_ecommerce

View on GitHub

Showing 203 of 346 total issues

Avoid deeply nested control flow statements.
Open

          if ( typeof elem.getElementsByTagName !== "undefined" ) {
            // handleScript alters the DOM, so use jQuery.merge to ensure snapshot iteration
            jsTags = jQuery.grep( jQuery.merge( [], elem.getElementsByTagName("script") ), handleScript );

            // Splice the scripts into ret after their former ancestor and advance our index beyond them
Severity: Major
Found in app/assets/javascripts/jquery/jquery-migrate-1.1.1.js - About 45 mins to fix

    Avoid deeply nested control flow statements.
    Open

                            if (placeholder !== elem.getAttribute(ATTR_CURRENT_VAL) || (elem.type === "password" && !elem.getAttribute(ATTR_INPUT_TYPE))) {
    
                                // Attempt to change the type of password inputs (fails in IE < 9)
                                if (elem.type === "password" && !elem.getAttribute(ATTR_INPUT_TYPE) && Utils.changeType(elem, "text")) {
                                    elem.setAttribute(ATTR_INPUT_TYPE, "password");
    Severity: Major
    Found in app/assets/javascripts/foundation/foundation.placeholder.js - About 45 mins to fix

      Avoid deeply nested control flow statements.
      Open

                    if (searchText.length) {
                      startpos = option.html.search(zregex);
                      text = option.html.substr(0, startpos + searchText.length) + '</em>' + option.html.substr(startpos + searchText.length);
                      text = text.substr(0, startpos) + '<em>' + text.substr(startpos);
                    } else {
      Severity: Major
      Found in app/assets/javascripts/chosen/chosen.jquery.js - About 45 mins to fix

        Avoid deeply nested control flow statements.
        Open

                                if (!elem.getAttribute(ATTR_EVENTS_BOUND)) {
                                    newElement(elem);
                                }
        Severity: Major
        Found in app/assets/javascripts/foundation/foundation.placeholder.js - About 45 mins to fix

          Avoid deeply nested control flow statements.
          Open

                        if (option.group_array_index != null) {
                          $("#" + this.results_data[option.group_array_index].dom_id).css('display', 'list-item');
                        }
          Severity: Major
          Found in app/assets/javascripts/chosen/chosen.jquery.js - About 45 mins to fix

            Avoid deeply nested control flow statements.
            Open

                        if ($(klass).hasClass('fixed')) {
                          $(klass).removeClass('fixed');
                          $('body').removeClass('f-topbar-fixed');
                        }
            Severity: Major
            Found in app/assets/javascripts/foundation/foundation.topbar.js - About 45 mins to fix

              Avoid deeply nested control flow statements.
              Open

                            if (parts.length) {
                              for (_j = 0, _len2 = parts.length; _j < _len2; _j++) {
                                part = parts[_j];
                                if (regex.test(part)) {
                                  found = true;
              Severity: Major
              Found in app/assets/javascripts/chosen/chosen.jquery.js - About 45 mins to fix

                Function add has 6 arguments (exceeds 4 allowed). Consider refactoring.
                Open

                  function add(element, events, fn, selector, getDelegate, capture){
                Severity: Minor
                Found in app/assets/javascripts/zepto.js - About 45 mins to fix

                  Function init has 6 arguments (exceeds 4 allowed). Consider refactoring.
                  Open

                      init : function (scope, libraries, method, options, response, /* internal */ nc) {
                  Severity: Minor
                  Found in app/assets/javascripts/foundation_init/foundation.js - About 45 mins to fix

                    Avoid deeply nested control flow statements.
                    Open

                                  if (this.result_highlight && result_id === this.result_highlight.attr('id')) {
                                    this.result_clear_highlight();
                                  }
                    Severity: Major
                    Found in app/assets/javascripts/chosen/chosen.jquery.js - About 45 mins to fix

                      Avoid deeply nested control flow statements.
                      Open

                                  if (this.settings.timer > 0) {
                      
                                    this.settings.$next_tip
                                      .fadeIn(this.settings.tipAnimationFadeSpeed)
                                      .show();
                      Severity: Major
                      Found in app/assets/javascripts/foundation/foundation.joyride.js - About 45 mins to fix

                        Avoid deeply nested control flow statements.
                        Open

                                          if (!region.hasClass(self.settings.active_class))
                                            region.addClass(self.settings.active_class);
                        Severity: Major
                        Found in app/assets/javascripts/foundation/foundation.section.js - About 45 mins to fix

                          Avoid deeply nested control flow statements.
                          Open

                                          if ($customRadio.length === 0) {
                                            $customRadio = $associatedElement.add(this).siblings('span.custom.radio').first();
                                          }
                          Severity: Major
                          Found in app/assets/javascripts/foundation/foundation.forms.js - About 45 mins to fix

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

                              def create
                                if params[:address].present?
                                  @shipping_address = checkout_user.addresses.new(allowed_params)
                                  @shipping_address.default = true          if checkout_user.default_shipping_address.nil?
                                  @shipping_address.billing_default = true  if checkout_user.default_billing_address.nil?
                            Severity: Minor
                            Found in app/controllers/admin/shopping/checkout/shipping_addresses_controller.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 sanitize_data has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                            Open

                              def sanitize_data
                                self.email      = self.email.strip.downcase         unless email.blank?
                                self.first_name = self.first_name.strip.capitalize  unless first_name.nil?
                                self.last_name  = self.last_name.strip.capitalize   unless last_name.nil?
                            
                            
                            Severity: Minor
                            Found in app/models/user.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 update has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                            Open

                              def update
                                all_selected = true
                                if params[:shipping_category].present?
                                  params[:shipping_category].each_pair do |category_id, rate_id|#[rate]
                                    if rate_id.present?
                            Severity: Minor
                            Found in app/controllers/admin/shopping/checkout/shipping_methods_controller.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 create has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                            Open

                              def create
                                if params[:address].present?
                                  @shopping_address = current_user.addresses.new(allowed_params)
                                  @shopping_address.default = true          if current_user.default_shipping_address.nil?
                                  @shopping_address.billing_default = true  if current_user.default_billing_address.nil?
                            Severity: Minor
                            Found in app/controllers/shopping/addresses_controller.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 update has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                            Open

                              def update
                                all_selected = true
                                redirect_to(shopping_orders_url) and return unless params[:shipping_category].present?
                                params[:shipping_category].each_pair do |category_id, rate_id|#[rate]
                                  if rate_id.present?
                            Severity: Minor
                            Found in app/controllers/shopping/shipping_methods_controller.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 receive! has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                            Open

                              def receive!
                                PurchaseOrderVariant.transaction do
                                  ###  Add to variant stock level
                                  self.variant.inventory.count_on_hand = self.variant.inventory.count_on_hand + quantity
                                  if self.variant.inventory.save!
                            Severity: Minor
                            Found in app/models/purchase_order_variant.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 update_tax_rates has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                            Open

                              def update_tax_rates
                                if saved_change_to_attribute?(:ship_address_id)
                                  # set_beginning_values
                                  tax_time = completed_at? ? completed_at : Time.zone.now
                                  order_items.each do |item|
                            Severity: Minor
                            Found in app/models/order.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

                            Severity
                            Category
                            Status
                            Source
                            Language