drhenner/ror_ecommerce

View on GitHub

Showing 203 of 346 total issues

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

        normalizeRules: function(rules, element) {
            // handle dependency check
            $.each(rules, function(prop, val) {
                // ignore rule when param is explicitly false, eg. required:false
                if (val === false) {
    Severity: Major
    Found in app/assets/javascripts/jqwizard/jquery.validate.js - About 2 hrs to fix

      Function toggle has 50 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          toggle: function() {
            var self = this;
            var topbar = $('.top-bar, [data-topbar]'),
                section = topbar.find('section, .section');
      
      
      Severity: Minor
      Found in app/assets/javascripts/foundation/foundation.topbar.js - About 2 hrs to fix

        Function set_active_from_hash has 50 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            set_active_from_hash: function() {
              var self = Foundation.libs.section,
                  hash = window.location.hash.substring(1),
                  sections = $(self.settings.section_selector);
        
        
        Severity: Minor
        Found in app/assets/javascripts/foundation/foundation.section.js - About 2 hrs to fix

          Function un_expose has 48 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              un_expose : function () {
                var exposeId,
                    el,
                    expose ,
                    origCSS,
          Severity: Minor
          Found in app/assets/javascripts/foundation/foundation.joyride.js - About 1 hr to fix

            Function set_up_html has 45 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                Chosen.prototype.set_up_html = function() {
                  var container_div, dd_top, dd_width, sf_width;
                  this.container_id = this.form_field.id.length ? this.form_field.id.replace(/(:|\.)/g, '_') : this.generate_field_id();
                  this.container_id += "_chzn";
                  this.f_width = this.form_field_jq.outerWidth() + 60;
            Severity: Minor
            Found in app/assets/javascripts/chosen/chosen.jquery.js - About 1 hr to fix

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

                    function init() {
                      id = ''; nameSpace = '';
                      if (options.id) {
                        id = 'id="'+options.id+'"';
                      } else if ($$.attr("id")) {
              Severity: Minor
              Found in app/assets/javascripts/markitup/jquery.markitup.js - About 1 hr to fix

                Function keyPressed has 44 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                      function keyPressed(e) {
                        shiftKey = e.shiftKey;
                        altKey = e.altKey;
                        ctrlKey = (!(e.altKey && e.ctrlKey)) ? (e.ctrlKey || e.metaKey) : false;
                
                
                Severity: Minor
                Found in app/assets/javascripts/markitup/jquery.markitup.js - About 1 hr to fix

                  Function dropMenus has 44 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                        function dropMenus(markupSet) {
                          var ul = $('<ul></ul>'), i = 0;
                          $('li:hover > ul', ul).css('display', 'block');
                          $.each(markupSet, function() {
                            var button = this, t = '', title, li, j;
                  Severity: Minor
                  Found in app/assets/javascripts/markitup/jquery.markitup.js - About 1 hr to fix

                    Function remote has 44 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                            remote: function(value, element, param) {
                                if ( this.optional(element) )
                                    return "dependency-mismatch";
                                
                                var previous = this.previousValue(element);
                    Severity: Minor
                    Found in app/assets/javascripts/jqwizard/jquery.validate.js - About 1 hr to fix

                      Function show has 43 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          show : function (el, css) {
                            // is modal
                            if (css) {
                              if (el.parent('body').length === 0) {
                                var placeholder = el.wrap('<div style="display: none;" />').parent();
                      Severity: Minor
                      Found in app/assets/javascripts/foundation/foundation.reveal.js - About 1 hr to fix

                        Function attr has 43 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                        jQuery.attr = function( elem, name, value, pass ) {
                          var lowerName = name.toLowerCase(),
                            nType = elem && elem.nodeType;
                        
                          if ( pass ) {
                        Severity: Minor
                        Found in app/assets/javascripts/jquery/jquery-migrate-1.1.1.js - About 1 hr to fix

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

                              init: function (element, options) {
                                var $imageSlides,
                                    imagesLoadedCount = 0,
                                    self = this;
                          
                          
                          Severity: Minor
                          Found in app/assets/javascripts/admin/jquery.orbit-1.4.0.js - About 1 hr to fix

                            Function _goto has 41 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                                self._goto = function(next_idx, start_timer) {
                                  // if (locked) {return false;}
                                  if (next_idx === idx) {return false;}
                                  if (typeof timer === 'object') {timer.restart();}
                                  var slides = slides_container.children();
                            Severity: Minor
                            Found in app/assets/javascripts/foundation/foundation.orbit.js - About 1 hr to fix

                              Function register_observers has 41 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                                  Chosen.prototype.register_observers = function() {
                                    this.container.mousedown(__bind(function(evt) {
                                      return this.container_mousedown(evt);
                                    }, this));
                                    this.container.mouseup(__bind(function(evt) {
                              Severity: Minor
                              Found in app/assets/javascripts/chosen/chosen.jquery.js - About 1 hr to fix

                                Function Timer has 41 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                  var Timer = function(el, settings, callback) {
                                    var self = this,
                                        duration = settings.timer_speed,
                                        progress = el.find('.'+settings.timer_progress_class),
                                        start, 
                                Severity: Minor
                                Found in app/assets/javascripts/foundation/foundation.orbit.js - About 1 hr to fix

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

                                      init : function (section, method, options) {
                                        Foundation.inherit(this, 'data_options addCustomRule');
                                        var self = this;
                                  
                                        if (typeof method === 'object') {
                                  Severity: Minor
                                  Found in app/assets/javascripts/foundation/foundation.topbar.js - About 1 hr to fix

                                    Function closeAnimation has 41 lines of code (exceeds 25 allowed). Consider refactoring.
                                    Open

                                          function closeAnimation() {
                                            if (!locked) {
                                              lockModal();
                                              modal.removeClass("open");
                                              if (options.animation === "fadeAndPop") {
                                    Severity: Minor
                                    Found in app/assets/javascripts/admin/jquery.reveal.js - About 1 hr to fix

                                      Function open has 40 lines of code (exceeds 25 allowed). Consider refactoring.
                                      Open

                                          open : function (target, ajax_settings) {
                                            if (target) {
                                              if (typeof target.selector !== 'undefined') {
                                                var modal = $('#' + target.data('reveal-id'));
                                              } else {
                                      Severity: Minor
                                      Found in app/assets/javascripts/foundation/foundation.reveal.js - About 1 hr to fix

                                        Method update has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
                                        Open

                                          def update
                                            @order = find_or_create_order
                                            @order.ip_address = request.remote_ip
                                        
                                            @credit_card ||= ActiveMerchant::Billing::CreditCard.new(cc_params)
                                        Severity: Minor
                                        Found in app/controllers/shopping/orders_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

                                        Severity
                                        Category
                                        Status
                                        Source
                                        Language