drhenner/ror_ecommerce

View on GitHub

Showing 203 of 346 total issues

Function refresh_custom_select has 29 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    refresh_custom_select: function ($select, force_refresh) {
      var self = this;
      var maxWidth = 0,
          $customSelect = $select.next(),
          $options = $select.find('option'),
Severity: Minor
Found in app/assets/javascripts/foundation/foundation.forms.js - About 1 hr to fix

    Function magicMarkups has 28 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

          function magicMarkups(string) {
            if (string) {
              string = string.toString();
              string = string.replace(/\(\!\(([\s\S]*?)\)\!\)/g,
                function(x, a) {
    Severity: Minor
    Found in app/assets/javascripts/markitup/jquery.markitup.js - About 1 hr to fix

      Function cookie has 28 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        var config = $.cookie = function (key, value, options) {
      
          // write
          if (value !== undefined) {
            options = $.extend({}, config.defaults, options);
      Severity: Minor
      Found in app/assets/javascripts/foundation/foundation.cookie.js - About 1 hr to fix

        Function initialize has 28 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            initialize      : function() {
              jQuery('#submit_add_to_cart').click( function() {
                  if (jQuery('#cart_item_variant_id').val() == '' ) { // Select to see if variant is selected in hidden field
                    alert('Please click on a specific item to add.');
                  } else
        Severity: Minor
        Found in app/assets/javascripts/shopping/cart.js - About 1 hr to fix

          Function search_field_scale has 28 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              Chosen.prototype.search_field_scale = function() {
                var dd_top, div, h, style, style_block, styles, w, _i, _len;
                if (this.is_multiple) {
                  h = 0;
                  w = 0;
          Severity: Minor
          Found in app/assets/javascripts/chosen/chosen.jquery.js - About 1 hr to fix

            Function renderPreview has 28 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                  function renderPreview() {
                    var phtml;
                    if (options.previewParser && typeof options.previewParser === 'function') {
                      var data = options.previewParser( $$.val() );
                      writeInPreview( localize(data, 1) );
            Severity: Minor
            Found in app/assets/javascripts/markitup/jquery.markitup.js - About 1 hr to fix

              Function jq_param_sub has 28 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                function jq_param_sub( is_fragment, get_func, url, params, merge_mode ) {
                  var result,
                    qs,
                    matches,
                    url_params,
              Severity: Minor
              Found in app/assets/javascripts/jqwizard/bbq.js - About 1 hr to fix

                Method update has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                  def update
                    @order = session_admin_order
                    @order.ip_address = request.remote_ip
                
                    @credit_card ||= ActiveMerchant::Billing::CreditCard.new(cc_params)
                Severity: Minor
                Found in app/controllers/admin/shopping/checkout/orders_controller.rb - About 1 hr to fix

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

                    def create
                      @referring_user = User.find_by_email(params[:referring_user_email])
                      @referral = Referral.new(allowed_params)
                      @referral.referral_type_id = ReferralType::ADMIN_WEB_FORM_ID
                      @referral.skip_validate_has_not_signed_up_yet = true
                  Severity: Minor
                  Found in app/controllers/admin/user_datas/referrals_controller.rb - About 1 hr 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 10 (exceeds 5 allowed). Consider refactoring.
                  Open

                    def update
                      @variant = Variant.find(params[:id])
                      ###  the reason will effect accounting
                      #    if the item is refunded by the supplier the accounting will be reflected
                      if params[:refund].present? && params[:variant][:qty_to_add].present?
                  Severity: Minor
                  Found in app/controllers/admin/inventory/adjustments_controller.rb - About 1 hr 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 ensure_available has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                  Open

                      def ensure_available
                        if active? && deleted_at_changed?
                          self.errors.add(:base, 'There must be active variants.')  if active_variants.blank?
                          self.errors.add(:base, 'Variants must have inventory.')   unless active_variants.any?{|v| v.is_available? }
                          self.deleted_at = deleted_at_was if active_variants.blank? || !active_variants.any?{|v| v.is_available? }
                  Severity: Minor
                  Found in app/models/product.rb - About 1 hr 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_invoice has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                  Open

                    def create_invoice(credit_card, charge_amount, args, credited_amount = 0.0)
                      transaction do
                        new_invoice = create_invoice_transaction(credit_card, charge_amount, args, credited_amount)
                        if new_invoice.succeeded?
                          remove_user_store_credits
                  Severity: Minor
                  Found in app/models/order.rb - About 1 hr 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

                  Function clean has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                    jQuery.clean = function( elems, context, fragment, scripts ) {
                      // Set context per 1.8 logic
                      context = context || document;
                      context = !context.nodeType && context[0] || context;
                      context = context.ownerDocument || context;
                  Severity: Minor
                  Found in app/assets/javascripts/jquery/jquery-migrate-1.1.1.js - About 1 hr to fix

                    Function initialize has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                      initialize : function(invoiceId, order_id) {
                    
                        var captureTag      = jQuery(Hadean.Fulfillment.captureInvoiceButton + invoiceId );
                        var capturePartTag  = jQuery(Hadean.Fulfillment.capturePartInvoiceButton + invoiceId);
                        var cancelTag       = jQuery(Hadean.Fulfillment.cancelInvoiceButton + invoiceId);
                    Severity: Minor
                    Found in app/assets/javascripts/admin/fulfillment.js - About 1 hr to fix

                      Function indexOf has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          Array.prototype.indexOf = function (searchElement /*, fromIndex */ ) {
                            "use strict";
                            if (this == null) {
                              throw new TypeError();
                            }
                      Severity: Minor
                      Found in app/assets/javascripts/foundation_init/foundation.js - About 1 hr to fix

                        Function keydown_checker has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            Chosen.prototype.keydown_checker = function(evt) {
                              var stroke, _ref;
                              stroke = (_ref = evt.which) != null ? _ref : evt.keyCode;
                              this.search_field_scale();
                              if (stroke !== 8 && this.pending_backstroke) {
                        Severity: Minor
                        Found in app/assets/javascripts/chosen/chosen.jquery.js - About 1 hr to fix

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

                              SelectParser.prototype.add_option = function(option, group_position, group_disabled) {
                                if (option.nodeName === "OPTION") {
                                  if (option.text !== "") {
                                    if (group_position != null) {
                                      this.parsed[group_position].children += 1;
                          Severity: Minor
                          Found in app/assets/javascripts/chosen/chosen.jquery.js - About 1 hr to fix

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

                            $.fieldValue = function(el, successful) {
                                var n = el.name, t = el.type, tag = el.tagName.toLowerCase();
                                if (typeof successful == 'undefined') successful = true;
                            
                                if (successful && (!n || el.disabled || t == 'reset' || t == 'button' ||
                            Severity: Minor
                            Found in app/assets/javascripts/jqwizard/jquery.form.js - About 1 hr to fix

                              Consider simplifying this complex logical expression.
                              Open

                                    } else if (region.hasClass(self.settings.active_class) && self.is_accordion(section) || !settings.one_up && (self.small(section) || self.is_vertical_nav(section) || self.is_horizontal_nav(section) || self.is_accordion(section))) {
                                      region.removeClass(self.settings.active_class);
                                      region.trigger('closed.fndtn.section');
                                    }
                              Severity: Major
                              Found in app/assets/javascripts/foundation/foundation.section.js - About 1 hr to fix

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

                                  def create
                                    session_cart.save if session_cart.new_record?
                                    qty = params[:cart_item][:quantity].to_i
                                    if cart_item = session_cart.add_variant(params[:cart_item][:variant_id], most_likely_user, qty)
                                      flash[:notice] = [I18n.t('out_of_stock_notice'), I18n.t('item_saved_for_later')].compact.join(' ') unless cart_item.shopping_cart_item?
                                Severity: Minor
                                Found in app/controllers/shopping/cart_items_controller.rb - About 55 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