drhenner/ror_ecommerce

View on GitHub

Showing 346 of 346 total issues

Function reposition has 39 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    reposition : function (target, tip, classes) {
      var width, nub, nubHeight, nubWidth, column, objPos;

      tip.css('visibility', 'hidden').show();

Severity: Minor
Found in app/assets/javascripts/foundation/foundation.tooltips.js - About 1 hr to fix

    Function add has 39 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        function add(value, text, callHandler) {
            $option = null;
    
            if ($(value).is('option')) {
                $option = $(value);
    Severity: Minor
    Found in app/assets/javascripts/jquery.selectlist.js - About 1 hr to fix

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

              if (this.top()) {
      
                  this.settings.$next_tip.offset({top: this.settings.$target.offset().top - tip_height - nub_height});
                  $nub.addClass('bottom');
      
      
      Severity: Major
      Found in app/assets/javascripts/foundation/foundation.joyride.js and 1 other location - About 1 hr to fix
      app/assets/javascripts/foundation/foundation.joyride.js on lines 533..538

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

      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

              } else {
      
                this.settings.$next_tip.offset({top: this.settings.$target.offset().top + target_height + nub_height});
                $nub.addClass('top');
      
      
      Severity: Major
      Found in app/assets/javascripts/foundation/foundation.joyride.js and 1 other location - About 1 hr to fix
      app/assets/javascripts/foundation/foundation.joyride.js on lines 528..533

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

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

          events : function () {
            var self = this;
      
            $(this.scope)
              .on('click.joyride', '.joyride-next-tip, .joyride-modal-bg', function (e) {
      Severity: Minor
      Found in app/assets/javascripts/foundation/foundation.joyride.js - About 1 hr to fix

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

              $options.each(function () {
                $li = $('<li>' + $(this).html() + '</li>');
                $customSelect.find('ul').append($li);
              });
        Severity: Major
        Found in app/assets/javascripts/admin/jquery.customforms.js and 1 other location - About 1 hr to fix
        app/assets/javascripts/admin/jquery.customforms.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 65.

        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 () {
                $li = $('<li>' + $(this).html() + '</li>');
                $customSelect.find('ul').append($li);
              });
        Severity: Major
        Found in app/assets/javascripts/admin/jquery.customforms.js and 1 other location - About 1 hr to fix
        app/assets/javascripts/admin/jquery.customforms.js on lines 61..64

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

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

            Chosen.prototype.results_build = function() {
              var content, data, _i, _len, _ref;
              this.parsing = true;
              this.results_data = root.SelectParser.select_to_array(this.form_field);
              if (this.is_multiple && this.choices > 0) {
        Severity: Minor
        Found in app/assets/javascripts/chosen/chosen.jquery.js - About 1 hr to fix

          Function _next has 37 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

                  _next : function(){
                      if(this.options.validationEnabled){
                          if(!this.element.valid()){
                              this.element.validate().focusInvalid();
                              return false;
          Severity: Minor
          Found in app/assets/javascripts/jqwizard/jquery.form.wizard.js - About 1 hr to fix

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

                  if (target.next().length > 0) {
                    visible_image
                      .find('.clearing-main-next')
                      .removeClass('disabled');
                  } else {
            Severity: Major
            Found in app/assets/javascripts/foundation/foundation.clearing.js and 1 other location - About 1 hr to fix
            app/assets/javascripts/foundation/foundation.clearing.js on lines 291..299

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

            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 (target.prev().length > 0) {
                    visible_image
                      .find('.clearing-main-prev')
                      .removeClass('disabled');
                  } else {
            Severity: Major
            Found in app/assets/javascripts/foundation/foundation.clearing.js and 1 other location - About 1 hr to fix
            app/assets/javascripts/foundation/foundation.clearing.js on lines 281..289

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

            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

                createSalesGraph : function(dataSet){
                  new Morris.Bar({
                    // ID of the element in which to draw the chart.
                    element: 'weekly-sales-graph',
                    // Chart data records -- each entry in this array corresponds to a point on
            Severity: Major
            Found in app/assets/javascripts/admin/reports/weekly_chart.js and 1 other location - About 1 hr to fix
            app/assets/javascripts/admin/reports/weekly_chart.js on lines 39..54

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

            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

                createEarningsGraph : function(dataSet) {
                  new Morris.Line({
                    // ID of the element in which to draw the chart.
                    element: 'weekly-earnings-graph',
                    // Chart data records -- each entry in this array corresponds to a point on
            Severity: Major
            Found in app/assets/javascripts/admin/reports/weekly_chart.js and 1 other location - About 1 hr to fix
            app/assets/javascripts/admin/reports/weekly_chart.js on lines 23..38

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

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

                start : function () {
                  var self = this,
                      $this = $(this.scope).find('[data-joyride]'),
                      integer_settings = ['timer', 'scrollSpeed', 'startOffset', 'tipAnimationFadeSpeed', 'cookieExpires'],
                      int_settings_count = integer_settings.length;
            Severity: Minor
            Found in app/assets/javascripts/foundation/foundation.joyride.js - About 1 hr to fix

              Function anim has 36 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                $.fn.anim = function(properties, duration, ease, callback){
                  var key, cssValues = {}, cssProperties, transforms = '',
                      that = this, wrappedCallback, endEvent = $.fx.transitionEnd
              
                  if (duration === undefined) duration = 0.4
              Severity: Minor
              Found in app/assets/javascripts/zepto.js - About 1 hr to fix

                Function swipe_events has 36 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    swipe_events : function () {
                      var self = this;
                
                      $(this.scope)
                        .on('touchstart.fndtn.clearing', '.visible-img', function(e) {
                Severity: Minor
                Found in app/assets/javascripts/foundation/foundation.clearing.js - About 1 hr to fix

                  Method index has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
                  Open

                    def index
                      #  The index action should
                      if u = User.first
                        redirect_to root_url and return if !current_user
                        redirect_to root_url unless current_user.admin?
                  Severity: Minor
                  Found in app/controllers/admin/overviews_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

                  Function setDimentionsFromLargestSlide has 35 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      setDimentionsFromLargestSlide: function () {
                        //Collect all slides and set slider size of largest image
                        var self = this,
                            $fluidPlaceholder;
                  
                  
                  Severity: Minor
                  Found in app/assets/javascripts/admin/jquery.orbit-1.4.0.js - About 1 hr to fix

                    Function reposition has 35 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        reposition : function (target, tip, classes) {
                          var width, nub, nubHeight, nubWidth, row, objPos;
                    
                          width = target.data('width');
                          nub = tip.children('.nub');
                    Severity: Minor
                    Found in app/assets/javascripts/admin/jquery.tooltips.js - About 1 hr to fix

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

                          events : function () {
                            var self = this;
                      
                            $(this.scope)
                              .on('click.fndtn.dropdown', '[data-dropdown]', function (e) {
                      Severity: Minor
                      Found in app/assets/javascripts/foundation/foundation.dropdown.js - About 1 hr to fix
                        Severity
                        Category
                        Status
                        Source
                        Language