drhenner/ror_ecommerce

View on GitHub

Showing 346 of 346 total issues

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

    $options.each(function (index) {
      if (this.selected) {
        $customSelect.find('li').eq(index).addClass('selected');
        $customSelect.find('.current').html($(this).html());
      }
Severity: Major
Found in app/assets/javascripts/admin/jquery.customforms.js and 1 other location - About 2 hrs to fix
app/assets/javascripts/admin/jquery.customforms.js on lines 69..74

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

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 ( typeof data.is_scrolling === 'undefined') {
            data.is_scrolling = !!( data.is_scrolling || Math.abs(data.delta_x) < Math.abs(e.touches[0].pageY - data.start_page_y) );
          }
Severity: Major
Found in app/assets/javascripts/foundation/foundation.orbit.js and 1 other location - About 2 hrs to fix
app/assets/javascripts/foundation/foundation.clearing.js on lines 140..142

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

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

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

    $options.each(function (index) {
      if (this.selected) {
        $customSelect.find('li').eq(index).addClass('selected');
        $customSelect.find('.current').html($(this).html());
      }
Severity: Major
Found in app/assets/javascripts/admin/jquery.customforms.js and 1 other location - About 2 hrs to fix
app/assets/javascripts/admin/jquery.customforms.js on lines 120..125

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

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

    this.prev = function(current, prev, callback) {
      prev.css({'margin':'0%', 'opacity':'0.01'});
      prev.animate({'opacity':'1'}, duration, 'linear', function() {
        current.css('margin', '100%');
        callback();
Severity: Major
Found in app/assets/javascripts/foundation/foundation.orbit.js and 1 other location - About 2 hrs to fix
app/assets/javascripts/foundation/foundation.orbit.js on lines 352..358

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

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 ( typeof data.is_scrolling === 'undefined') {
            data.is_scrolling = !!( data.is_scrolling || Math.abs(data.delta_x) < Math.abs(e.touches[0].pageY - data.start_page_y) );
          }
Severity: Major
Found in app/assets/javascripts/foundation/foundation.clearing.js and 1 other location - About 2 hrs to fix
app/assets/javascripts/foundation/foundation.orbit.js on lines 237..239

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

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 init has 60 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    self.init = function() {
      self.build_markup();
      if (settings.timer) {timer = self.create_timer(); timer.start();}
      animate = new FadeAnimation(settings, slides_container);
      if (settings.animation === 'slide') 
Severity: Major
Found in app/assets/javascripts/foundation/foundation.orbit.js - About 2 hrs to fix

    Function ajax has 60 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      $.ajax = function(options){
        var settings = $.extend({}, options || {})
        for (key in $.ajaxSettings) if (settings[key] === undefined) settings[key] = $.ajaxSettings[key]
    
        ajaxStart(settings)
    Severity: Major
    Found in app/assets/javascripts/zepto.js - About 2 hrs to fix

      Function cb has 59 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

              function cb() {
                  if (cbInvoked) 
                      return;
      
                  var ok = true;
      Severity: Major
      Found in app/assets/javascripts/jqwizard/jquery.form.js - About 2 hrs to fix

        Function pos_default has 59 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            pos_default : function (init, resizing) {
              var half_fold = Math.ceil($(window).height() / 2),
                  tip_position = this.settings.$next_tip.offset(),
                  $nub = this.settings.$next_tip.find('.joyride-nub'),
                  nub_width = Math.ceil(this.outerWidth($nub) / 2),
        Severity: Major
        Found in app/assets/javascripts/foundation/foundation.joyride.js - About 2 hrs to fix

          Function winnow_results has 58 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              Chosen.prototype.winnow_results = function() {
                var found, option, part, parts, regex, result, result_id, results, searchText, startpos, text, zregex, _i, _j, _len, _len2, _ref;
                this.no_results_clear();
                results = 0;
                searchText = this.search_field.val() === this.default_text ? "" : $('<div/>').text($.trim(this.search_field.val())).html();
          Severity: Major
          Found in app/assets/javascripts/chosen/chosen.jquery.js - About 2 hrs to fix

            Function init has 58 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                init : function (options) {
            
                  return this.each(function () {
                    var targets, tips, tipTemplate, poll;
            
            
            Severity: Major
            Found in app/assets/javascripts/admin/jquery.tooltips.js - About 2 hrs to fix

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

                          regions.each(function () {
                            var region = $(this);
              
                            region.css("margin-top", "-" + (first1 ? section : region.children(self.settings.title_selector)).css("border-top-width"));
                            first1 = false;
              Severity: Major
              Found in app/assets/javascripts/foundation/foundation.section.js and 1 other location - About 2 hrs to fix
              app/assets/javascripts/foundation/foundation.section.js on lines 234..239

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

              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

                          regions.each(function() {
                            var region = $(this);
              
                            region.css("margin-left", "-" + (first ? section : region.children(self.settings.title_selector)).css("border-left-width"));
                            first = false;
              Severity: Major
              Found in app/assets/javascripts/foundation/foundation.section.js and 1 other location - About 2 hrs to fix
              app/assets/javascripts/foundation/foundation.section.js on lines 276..281

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

              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

              Class Referral has 21 methods (exceeds 20 allowed). Consider refactoring.
              Open

              class Referral < ApplicationRecord
                belongs_to :referring_user, :foreign_key => "referring_user_id", :class_name => "User"
                belongs_to :referral_user,  :foreign_key => "referral_user_id", :class_name => "User"
                belongs_to :referral_program
                belongs_to :referral_type
              Severity: Minor
              Found in app/models/referral.rb - About 2 hrs to fix

                Class OrderItem has 21 methods (exceeds 20 allowed). Consider refactoring.
                Open

                class OrderItem < ApplicationRecord
                  include AASM
                
                  belongs_to :order
                  belongs_to :shipping_rate
                Severity: Minor
                Found in app/models/order_item.rb - About 2 hrs to fix

                  Function events has 54 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      events : function () {
                        var self = this;
                  
                        $(this.scope)
                          .off('.fndtn.reveal')
                  Severity: Major
                  Found in app/assets/javascripts/foundation/foundation.reveal.js - About 2 hrs to fix

                    Function expose has 52 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        expose : function () {
                          var expose,
                              exposeCover,
                              el,
                              origCSS,
                    Severity: Major
                    Found in app/assets/javascripts/foundation/foundation.joyride.js - About 2 hrs to fix

                      Function appendCustomSelect has 52 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                        function appendCustomSelect(sel) {
                          var $this = $(sel),
                              $customSelect = $this.next('div.custom.dropdown'),
                              $options = $this.find('option'),
                              maxWidth = 0,
                      Severity: Major
                      Found in app/assets/javascripts/admin/jquery.customforms.js - About 2 hrs to fix

                        Function validate has 52 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            validate: function( options ) {
                        
                                // if nothing is selected, return nothing; can't chain anyway
                                if (!this.length) {
                                    options && options.debug && window.console && console.warn( "nothing selected, can't validate, returning nothing" );
                        Severity: Major
                        Found in app/assets/javascripts/jqwizard/jquery.validate.js - About 2 hrs to fix

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

                                  switch (this.options.captionAnimation) {
                                    case 'none':
                                      this.$caption.hide();
                                      break;
                                    case 'fade':
                          Severity: Major
                          Found in app/assets/javascripts/admin/jquery.orbit-1.4.0.js and 1 other location - About 2 hrs to fix
                          app/assets/javascripts/admin/jquery.orbit-1.4.0.js on lines 336..346

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

                          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

                          Severity
                          Category
                          Status
                          Source
                          Language