jasonrobertfox/tictactoe

View on GitHub

Showing 58 of 126 total issues

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

    events: function() {
      var self = this;

      //combine titles selector from settings for click event binding
      var click_title_selectors = [],
Severity: Minor
Found in lib/assets/javascripts/foundation/foundation.section.js - About 1 hr to fix

    Function css has 31 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        css : function (dropdown, target) {
          var offset_parent = dropdown.offsetParent();
          // if (offset_parent.length > 0 && /body/i.test(dropdown.offsetParent()[0].nodeName)) {
            var position = target.offset();
            position.top -= offset_parent.offset().top;
    Severity: Minor
    Found in lib/assets/javascripts/foundation/foundation.dropdown.js - About 1 hr to fix

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

          pos_phone : function (init) {
            var tip_height = this.outerHeight(this.settings.$next_tip),
                tip_offset = this.settings.$next_tip.offset(),
                target_height = this.outerHeight(this.settings.$target),
                $nub = $('.joyride-nub', this.settings.$next_tip),
      Severity: Minor
      Found in lib/assets/javascripts/foundation/foundation.joyride.js - About 1 hr to fix

        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 lib/assets/javascripts/foundation/foundation.forms.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 lib/assets/javascripts/foundation/foundation.cookie.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 lib/assets/javascripts/foundation/foundation.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 lib/assets/javascripts/foundation/foundation.section.js - About 1 hr to fix

                Avoid deeply nested control flow statements.
                Open

                            if (this.settings.timer > 0) {
                
                              this.settings.$next_tip
                                .fadeIn(this.settings.tipAnimationFadeSpeed)
                                .show();
                Severity: Major
                Found in lib/assets/javascripts/foundation/foundation.joyride.js - About 45 mins to fix

                  Avoid deeply nested control flow statements.
                  Open

                                    if (!region.hasClass(self.settings.active_class))
                                      region.addClass(self.settings.active_class);
                  Severity: Major
                  Found in lib/assets/javascripts/foundation/foundation.section.js - About 45 mins to fix

                    Avoid deeply nested control flow statements.
                    Open

                                            if (placeholder !== elem.getAttribute(ATTR_CURRENT_VAL) || (elem.type === "password" && !elem.getAttribute(ATTR_INPUT_TYPE))) {
                    
                                                // Attempt to change the type of password inputs (fails in IE < 9)
                                                if (elem.type === "password" && !elem.getAttribute(ATTR_INPUT_TYPE) && Utils.changeType(elem, "text")) {
                                                    elem.setAttribute(ATTR_INPUT_TYPE, "password");
                    Severity: Major
                    Found in lib/assets/javascripts/foundation/foundation.placeholder.js - About 45 mins to fix

                      Avoid deeply nested control flow statements.
                      Open

                                      if ($customRadio.length === 0) {
                                        $customRadio = $associatedElement.add(this).siblings('span.custom.radio').first();
                                      }
                      Severity: Major
                      Found in lib/assets/javascripts/foundation/foundation.forms.js - About 45 mins to fix

                        Function init has 6 arguments (exceeds 4 allowed). Consider refactoring.
                        Open

                            init : function (scope, libraries, method, options, response, /* internal */ nc) {
                        Severity: Minor
                        Found in lib/assets/javascripts/foundation/foundation.js - About 45 mins to fix

                          Avoid deeply nested control flow statements.
                          Open

                                                  if (!elem.getAttribute(ATTR_EVENTS_BOUND)) {
                                                      newElement(elem);
                                                  }
                          Severity: Major
                          Found in lib/assets/javascripts/foundation/foundation.placeholder.js - About 45 mins to fix

                            Avoid deeply nested control flow statements.
                            Open

                                        if ($(klass).hasClass('fixed')) {
                                          $(klass).removeClass('fixed');
                                          $('body').removeClass('f-topbar-fixed');
                                        }
                            Severity: Major
                            Found in lib/assets/javascripts/foundation/foundation.topbar.js - About 45 mins to fix

                              Avoid too many return statements within this function.
                              Open

                                    return $(this.scope).width() < settings.small_breakpoint;
                              Severity: Major
                              Found in lib/assets/javascripts/foundation/foundation.section.js - About 30 mins to fix

                                Avoid too many return statements within this function.
                                Open

                                      return el.show();
                                Severity: Major
                                Found in lib/assets/javascripts/foundation/foundation.reveal.js - About 30 mins to fix

                                  Avoid too many return statements within this function.
                                  Open

                                        return el.hide();
                                  Severity: Major
                                  Found in lib/assets/javascripts/foundation/foundation.reveal.js - About 30 mins to fix

                                    Function write has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                                    Open

                                    Board.prototype.write = function(data) {
                                      data.board.forEach(function(space) {
                                        dom_space = getSpaceById(space.id);
                                        dom_space.prop('title', space.value);
                                        if (space.winning_space === true) {
                                    Severity: Minor
                                    Found in lib/assets/javascripts/Board.js - About 25 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