stevegrossi/stevegrossi

View on GitHub
app/assets/javascripts/jquery.chosen.js

Summary

Maintainability
F
4 days
Test Coverage

File jquery.chosen.js has 1042 lines of code (exceeds 250 allowed). Consider refactoring.
Open

// Chosen, a Select Box Enhancer for jQuery and Prototype
// by Patrick Filler for Harvest, http://getharvest.com
//
// Version 1.0.0
// Full source at https://github.com/harvesthq/chosen
Severity: Major
Found in app/assets/javascripts/jquery.chosen.js - About 2 days to fix

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

        Chosen.prototype.register_observers = function() {
          var _this = this;
    
          this.container.bind('mousedown.chosen', function(evt) {
            _this.container_mousedown(evt);
    Severity: Major
    Found in app/assets/javascripts/jquery.chosen.js - About 2 hrs to fix

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

          AbstractChosen.prototype.winnow_results = function() {
            var escapedSearchText, option, regex, regexAnchor, results, results_group, searchText, startpos, text, zregex, _i, _len, _ref;
      
            this.no_results_clear();
            results = 0;
      Severity: Major
      Found in app/assets/javascripts/jquery.chosen.js - About 2 hrs to fix

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

            Chosen.prototype.set_up_html = function() {
              var container_classes, container_props;
        
              container_classes = ["chosen-container"];
              container_classes.push("chosen-container-" + (this.is_multiple ? "multi" : "single"));
        Severity: Minor
        Found in app/assets/javascripts/jquery.chosen.js - About 1 hr to fix

          Function result_select has 42 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              Chosen.prototype.result_select = function(evt) {
                var high, item, selected_index;
          
                if (this.result_highlight) {
                  high = this.result_highlight;
          Severity: Minor
          Found in app/assets/javascripts/jquery.chosen.js - About 1 hr to fix

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

                AbstractChosen.prototype.keyup_checker = function(evt) {
                  var stroke, _ref;
            
                  stroke = (_ref = evt.which) != null ? _ref : evt.keyCode;
                  this.search_field_scale();
            Severity: Minor
            Found in app/assets/javascripts/jquery.chosen.js - About 1 hr to fix

              Function keydown_checker has 28 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  Chosen.prototype.keydown_checker = function(evt) {
                    var stroke, _ref1;
              
                    stroke = (_ref1 = evt.which) != null ? _ref1 : evt.keyCode;
                    this.search_field_scale();
              Severity: Minor
              Found in app/assets/javascripts/jquery.chosen.js - About 1 hr to fix

                Function add_option has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    SelectParser.prototype.add_option = function(option, group_position, group_disabled) {
                      if (option.nodeName.toUpperCase() === "OPTION") {
                        if (option.text !== "") {
                          if (group_position != null) {
                            this.parsed[group_position].children += 1;
                Severity: Minor
                Found in app/assets/javascripts/jquery.chosen.js - About 1 hr to fix

                  Avoid deeply nested control flow statements.
                  Open

                                if (results_group != null) {
                                  results_group.group_match = true;
                                }
                  Severity: Major
                  Found in app/assets/javascripts/jquery.chosen.js - About 45 mins to fix

                    Avoid deeply nested control flow statements.
                    Open

                                } else if ((option.group_array_index != null) && this.results_data[option.group_array_index].search_match) {
                                  option.search_match = true;
                                }
                    Severity: Major
                    Found in app/assets/javascripts/jquery.chosen.js - About 45 mins to fix

                      Avoid deeply nested control flow statements.
                      Open

                                    if (searchText.length) {
                                      startpos = option.search_text.search(zregex);
                                      text = option.search_text.substr(0, startpos + searchText.length) + '</em>' + option.search_text.substr(startpos + searchText.length);
                                      option.search_text = text.substr(0, startpos) + '<em>' + text.substr(startpos);
                                    }
                      Severity: Major
                      Found in app/assets/javascripts/jquery.chosen.js - About 45 mins to fix

                        There are no issues that match your filters.

                        Category
                        Status