remomueller/contour

View on GitHub

Showing 26 of 40 total issues

File typeahead.js has 1130 lines of code (exceeds 250 allowed). Consider refactoring.
Open

/*!
 * typeahead.js 0.9.3
 * https://github.com/twitter/typeahead
 * Copyright 2013 Twitter, Inc. and other contributors; Licensed MIT
 */
Severity: Major
Found in app/assets/javascripts/external/typeahead.js - About 2 days to fix

    File bootstrap-datepicker.js has 878 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    /* =========================================================
     * bootstrap-datepicker.js
     * http://www.eyecon.ro/bootstrap-datepicker
     * =========================================================
     * Copyright 2012 Stefan Petre
    Severity: Major
    Found in app/assets/javascripts/external/bootstrap-datepicker.js - About 2 days to fix

      Function TypeaheadView has 215 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          var TypeaheadView = function() {
              var html = {
                  wrapper: '<span class="twitter-typeahead"></span>',
                  hint: '<input class="tt-hint" type="text" autocomplete="off" spellcheck="off" disabled>',
                  dropdown: '<span class="tt-dropdown-menu"></span>'
      Severity: Major
      Found in app/assets/javascripts/external/typeahead.js - About 1 day to fix

        Function Dataset has 192 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            var Dataset = function() {
                var keys = {
                    thumbprint: "thumbprint",
                    protocol: "protocol",
                    itemHash: "itemHash",
        Severity: Major
        Found in app/assets/javascripts/external/typeahead.js - About 7 hrs to fix

          Function DropdownView has 167 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              var DropdownView = function() {
                  var html = {
                      suggestionsList: '<span class="tt-suggestions"></span>'
                  }, css = {
                      suggestionsList: {
          Severity: Major
          Found in app/assets/javascripts/external/typeahead.js - About 6 hrs to fix

            Function InputView has 121 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                var InputView = function() {
                    function InputView(o) {
                        var that = this;
                        utils.bindAll(this);
                        this.specialKeyCodeMap = {
            Severity: Major
            Found in app/assets/javascripts/external/typeahead.js - About 4 hrs to fix

              Function fill has 92 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                      fill: function() {
                          var d = new Date(this.viewDate),
                              year = d.getUTCFullYear(),
                              month = d.getUTCMonth(),
                              startYear = this.startDate !== -Infinity ? this.startDate.getUTCFullYear() : -Infinity,
              Severity: Major
              Found in app/assets/javascripts/external/bootstrap-datepicker.js - About 3 hrs to fix

                Function Datepicker has 92 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    var Datepicker = function(element, options) {
                        var that = this;
                
                        this.element = $(element);
                        this.language = options.language||this.element.data('date-language')||"en";
                Severity: Major
                Found in app/assets/javascripts/external/bootstrap-datepicker.js - About 3 hrs to fix

                  Function keydown has 89 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                          keydown: function(e){
                              if (this.picker.is(':not(:visible)')){
                                  if (e.keyCode == 27) // allow escape to hide and re-show picker
                                      this.show();
                                  return;
                  Severity: Major
                  Found in app/assets/javascripts/external/bootstrap-datepicker.js - About 3 hrs to fix

                    Function parseDate has 87 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                            parseDate: function(date, format, language) {
                                if (date instanceof Date) return date;
                                if (/^[\-+]\d+[dmwy]([\s,]+[\-+]\d+[dmwy])*$/.test(date)) {
                                    var part_re = /([\-+]\d+)([dmwy])/,
                                        parts = date.match(/([\-+]\d+)([dmwy])/g),
                    Severity: Major
                    Found in app/assets/javascripts/external/bootstrap-datepicker.js - About 3 hrs to fix

                      Function click has 80 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                              click: function(e) {
                                  e.stopPropagation();
                                  e.preventDefault();
                                  var target = $(e.target).closest('span, td, th');
                                  if (target.length == 1) {
                      Severity: Major
                      Found in app/assets/javascripts/external/bootstrap-datepicker.js - About 3 hrs to fix

                        Function PersistentStorage has 77 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            var PersistentStorage = function() {
                                var ls, methods;
                                try {
                                    ls = window.localStorage;
                                    ls.setItem("~~~", "!");
                        Severity: Major
                        Found in app/assets/javascripts/external/typeahead.js - About 3 hrs to fix

                          Function Transport has 75 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                              var Transport = function() {
                                  var pendingRequestsCount = 0, pendingRequests = {}, maxPendingRequests, requestCache;
                                  function Transport(o) {
                                      utils.bindAll(this);
                                      o = utils.isString(o) ? {
                          Severity: Major
                          Found in app/assets/javascripts/external/typeahead.js - About 3 hrs to fix

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

                                    _attachEvents: function(){
                                        this._detachEvents();
                                        if (this.isInput) { // single input
                                            this._events = [
                                                [this.element, {
                            Severity: Minor
                            Found in app/assets/javascripts/external/bootstrap-datepicker.js - About 1 hr to fix

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

                                def sort_field_helper(order, sort_field, display_name)
                                  sort_field_order = (order == sort_field) ? "#{sort_field} DESC" : sort_field
                                  symbol = (order == sort_field) ? '&raquo;' : (order == sort_field + ' DESC' ? '&laquo;' : '&laquo;&raquo;')
                                  selected_class = (order == sort_field) ? 'selected' : (order == sort_field + ' DESC' ? 'selected' : '')
                                  content_tag(:span, class: selected_class) do
                              Severity: Minor
                              Found in app/helpers/contour_helper.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 EventTarget has 34 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                                  var EventTarget = function() {
                                      var eventSplitter = /\s+/;
                                      return {
                                          on: function(events, callback) {
                                              var event;
                              Severity: Minor
                              Found in app/assets/javascripts/external/typeahead.js - About 1 hr to fix

                                Function initialize has 33 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                            initialize: function(datasetDefs) {
                                                var datasets;
                                                datasetDefs = utils.isArray(datasetDefs) ? datasetDefs : [ datasetDefs ];
                                                if (datasetDefs.length === 0) {
                                                    $.error("no datasets provided");
                                Severity: Minor
                                Found in app/assets/javascripts/external/typeahead.js - About 1 hr to fix

                                  Function _loadPrefetchData has 32 lines of code (exceeds 25 allowed). Consider refactoring.
                                  Open

                                              _loadPrefetchData: function(o) {
                                                  var that = this, thumbprint = VERSION + (o.thumbprint || ""), storedThumbprint, storedProtocol, storedItemHash, storedAdjacencyList, isExpired, deferred;
                                                  if (this.storage) {
                                                      storedThumbprint = this.storage.get(keys.thumbprint);
                                                      storedProtocol = this.storage.get(keys.protocol);
                                  Severity: Minor
                                  Found in app/assets/javascripts/external/typeahead.js - About 1 hr to fix

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

                                                _getLocalSuggestions: function(terms) {
                                                    var that = this, firstChars = [], lists = [], shortestList, suggestions = [];
                                                    utils.each(terms, function(i, term) {
                                                        var firstChar = term.charAt(0);
                                                        !~utils.indexOf(firstChars, firstChar) && firstChars.push(firstChar);
                                    Severity: Minor
                                    Found in app/assets/javascripts/external/typeahead.js - About 1 hr to fix

                                      Function updateNavArrows has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                                      Open

                                              updateNavArrows: function() {
                                                  var d = new Date(this.viewDate),
                                                      year = d.getUTCFullYear(),
                                                      month = d.getUTCMonth();
                                                  switch (this.viewMode) {
                                      Severity: Minor
                                      Found in app/assets/javascripts/external/bootstrap-datepicker.js - About 1 hr to fix
                                        Severity
                                        Category
                                        Status
                                        Source
                                        Language