drhenner/ror_ecommerce

View on GitHub

Showing 346 of 346 total issues

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

              left: (this.settings.$target.offset().left - this.outerWidth(this.settings.$next_tip) - nub_width)});
Severity: Minor
Found in app/assets/javascripts/foundation/foundation.joyride.js and 1 other location - About 40 mins to fix
app/assets/javascripts/foundation/foundation.joyride.js on lines 457..457

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

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 (!settings.deep_linking && (settings.one_up || !self.is_horizontal_nav(section) &&
              !self.is_vertical_nav(section) && !self.is_accordion(section))) {
Severity: Minor
Found in app/assets/javascripts/foundation/foundation.section.js and 1 other location - About 40 mins to fix
app/assets/javascripts/foundation/foundation.section.js on lines 380..381

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

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

            titles.each(function() {
              titles_max_width = Math.max(titles_max_width, self.outerWidth($(this)));
            });
Severity: Minor
Found in app/assets/javascripts/foundation/foundation.section.js and 1 other location - About 40 mins to fix
app/assets/javascripts/foundation/foundation.section.js on lines 230..232

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

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 add has 5 arguments (exceeds 4 allowed). Consider refactoring.
Open

jQuery.event.add = function( elem, types, handler, data, selector ){
Severity: Minor
Found in app/assets/javascripts/jquery/jquery-migrate-1.1.1.js - About 35 mins to fix

    Function anim has 5 arguments (exceeds 4 allowed). Consider refactoring.
    Open

      function anim(el, speed, opacity, scale, callback) {
    Severity: Minor
    Found in app/assets/javascripts/zepto.js - About 35 mins to fix

      Function remove has 5 arguments (exceeds 4 allowed). Consider refactoring.
      Open

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

        Function _w has 5 arguments (exceeds 4 allowed). Consider refactoring.
        Open

            var _w = function(f, a1, a2, a3, a4)
        Severity: Minor
        Found in app/assets/javascripts/jquery.datePicker-2.1.2.js - About 35 mins to fix

          Function remove has 5 arguments (exceeds 4 allowed). Consider refactoring.
          Open

          jQuery.event.remove = function( elem, types, handler, selector, mappedTypes ){
          Severity: Minor
          Found in app/assets/javascripts/jquery/jquery-migrate-1.1.1.js - About 35 mins to fix

            Function jq_param_sub has 5 arguments (exceeds 4 allowed). Consider refactoring.
            Open

              function jq_param_sub( is_fragment, get_func, url, params, merge_mode ) {
            Severity: Minor
            Found in app/assets/javascripts/jqwizard/bbq.js - About 35 mins to fix

              Method add_cart_items has 5 arguments (exceeds 4 allowed). Consider refactoring.
              Open

                def add_cart_items(items, qty, customer, cart_item_type_id, variant_id)
              Severity: Minor
              Found in app/models/cart.rb - About 35 mins to fix

                Method add_variant has 5 arguments (exceeds 4 allowed). Consider refactoring.
                Open

                  def add_variant(variant_id, customer, qty = 1, cart_item_type_id = ItemType::SHOPPING_CART_ID, admin_purchase = false)
                Severity: Minor
                Found in app/models/cart.rb - About 35 mins to fix

                  Method new_transaction_ledgers has 5 arguments (exceeds 4 allowed). Consider refactoring.
                  Open

                    def new_transaction_ledgers( transactor, credit_transaction_account_id, debit_transaction_account_id, amount, at)
                  Severity: Minor
                  Found in app/models/transaction.rb - About 35 mins to fix

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

                        if (iphone) os.ios = os.iphone = true, os.version = iphone[2].replace(/_/g, '.')
                    Severity: Minor
                    Found in app/assets/javascripts/zepto.js and 1 other location - About 35 mins to fix
                    app/assets/javascripts/zepto.js on lines 851..851

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

                    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

                          $('form.custom select', $(this.scope))
                            .not('[data-customforms="disabled"]')
                            .not('.' + this.settings.disable_class)
                            .not('[multiple=multiple]')
                    Severity: Minor
                    Found in app/assets/javascripts/foundation/foundation.forms.js and 1 other location - About 35 mins to fix
                    app/assets/javascripts/foundation/foundation.forms.js on lines 39..44

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

                    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 (ipad) os.ios = os.ipad = true, os.version = ipad[2].replace(/_/g, '.')
                    Severity: Minor
                    Found in app/assets/javascripts/zepto.js and 1 other location - About 35 mins to fix
                    app/assets/javascripts/zepto.js on lines 850..850

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

                    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

                      $.fn.bind = function(event, callback){
                        return this.each(function(){
                          add(this, event, callback)
                        })
                      }
                    Severity: Minor
                    Found in app/assets/javascripts/zepto.js and 1 other location - About 35 mins to fix
                    app/assets/javascripts/zepto.js on lines 971..975

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

                    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

                      $.fn.unbind = function(event, callback){
                        return this.each(function(){
                          remove(this, event, callback)
                        })
                      }
                    Severity: Minor
                    Found in app/assets/javascripts/zepto.js and 1 other location - About 35 mins to fix
                    app/assets/javascripts/zepto.js on lines 966..970

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

                    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

                          $('form.custom input[type="radio"],[type="checkbox"]', $(this.scope))
                            .not('[data-customforms="disabled"]')
                            .not('.' + this.settings.disable_class)
                            .each(function(idx, sel){
                              forms.set_custom_markup(sel);
                    Severity: Minor
                    Found in app/assets/javascripts/foundation/foundation.forms.js and 1 other location - About 35 mins to fix
                    app/assets/javascripts/foundation/foundation.forms.js on lines 49..52

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

                    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 session_cart! has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                    Open

                      def session_cart!
                        if cookies[:cart_id]
                          @session_cart = Cart.includes(:shopping_cart_items).find_by_id(cookies[:cart_id])
                          unless @session_cart
                            @session_cart = Cart.create(:user_id => current_user_id)
                    Severity: Minor
                    Found in app/controllers/application_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

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

                      def items_to_add_or_destroy(items_in_cart, order)
                        #destroy_any_order_item_that_was_removed_from_cart
                        destroy_order_items_not_in_cart!(items_in_cart, order)
                       # order.order_items.delete_all #destroy(order_item.id)
                        items = order.order_items.inject({}) {|h, item| h[item.variant_id].nil? ? h[item.variant_id] = [item.id]  : h[item.variant_id] << item.id; h}
                    Severity: Minor
                    Found in app/models/cart.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