opsforgeio/cabot

View on GitHub
cabot/static/theme/js/chosen.jquery.js

Summary

Maintainability
F
6 days
Test Coverage

File chosen.jquery.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 cabot/static/theme/js/chosen.jquery.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 cabot/static/theme/js/chosen.jquery.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 cabot/static/theme/js/chosen.jquery.js - About 2 hrs 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 cabot/static/theme/js/chosen.jquery.js - About 1 hr 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 cabot/static/theme/js/chosen.jquery.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 cabot/static/theme/js/chosen.jquery.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 cabot/static/theme/js/chosen.jquery.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 cabot/static/theme/js/chosen.jquery.js - About 1 hr 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 cabot/static/theme/js/chosen.jquery.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 cabot/static/theme/js/chosen.jquery.js - About 45 mins to fix

                      Avoid deeply nested control flow statements.
                      Open

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

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

                            __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };
                        Severity: Major
                        Found in cabot/static/theme/js/chosen.jquery.js and 1 other location - About 4 hrs to fix
                        cabot/static/arachnys/js/morris.js on lines 5..5

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

                        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.search_container = this.container.find('div.chosen-search').first();
                                this.selected_item = this.container.find('.chosen-single').first();
                              }
                        Severity: Major
                        Found in cabot/static/theme/js/chosen.jquery.js and 1 other location - About 1 hr to fix
                        cabot/static/theme/js/chosen.jquery.js on lines 544..547

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

                        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 (this.is_multiple) {
                                this.search_choices = this.container.find('ul.chosen-choices').first();
                                this.search_container = this.container.find('li.search-field').first();
                              } else {
                        Severity: Major
                        Found in cabot/static/theme/js/chosen.jquery.js and 1 other location - About 1 hr to fix
                        cabot/static/theme/js/chosen.jquery.js on lines 547..550

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

                        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

                              target = $(evt.target).hasClass("active-result") ? $(evt.target) : $(evt.target).parents(".active-result").first();
                        Severity: Major
                        Found in cabot/static/theme/js/chosen.jquery.js and 1 other location - About 1 hr to fix
                        cabot/static/theme/js/chosen.jquery.js on lines 853..853

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

                        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

                              target = $(evt.target).hasClass("active-result") ? $(evt.target) : $(evt.target).parents(".active-result").first();
                        Severity: Major
                        Found in cabot/static/theme/js/chosen.jquery.js and 1 other location - About 1 hr to fix
                        cabot/static/theme/js/chosen.jquery.js on lines 842..842

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

                        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

                            Chosen.prototype.result_clear_highlight = function() {
                              if (this.result_highlight) {
                                this.result_highlight.removeClass("highlighted");
                              }
                              return this.result_highlight = null;
                        Severity: Major
                        Found in cabot/static/theme/js/chosen.jquery.js and 1 other location - About 1 hr to fix
                        cabot/static/theme/js/chosen.jquery.js on lines 1094..1099

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

                        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

                            Chosen.prototype.clear_backstroke = function() {
                              if (this.pending_backstroke) {
                                this.pending_backstroke.removeClass("search-choice-focus");
                              }
                              return this.pending_backstroke = null;
                        Severity: Major
                        Found in cabot/static/theme/js/chosen.jquery.js and 1 other location - About 1 hr to fix
                        cabot/static/theme/js/chosen.jquery.js on lines 762..767

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

                        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

                                if (this.is_multiple && this.max_selected_options <= this.choices_count()) {
                                  this.form_field_jq.trigger("chosen:maxselected", {
                                    chosen: this
                                  });
                                  return false;
                        Severity: Major
                        Found in cabot/static/theme/js/chosen.jquery.js and 1 other location - About 1 hr to fix
                        cabot/static/theme/js/chosen.jquery.js on lines 770..775

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

                        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

                              if (this.is_multiple && this.max_selected_options <= this.choices_count()) {
                                this.form_field_jq.trigger("chosen:maxselected", {
                                  chosen: this
                                });
                                return false;
                        Severity: Major
                        Found in cabot/static/theme/js/chosen.jquery.js and 1 other location - About 1 hr to fix
                        cabot/static/theme/js/chosen.jquery.js on lines 929..934

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

                        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

                            for (_i = 0, _len = _ref.length; _i < _len; _i++) {
                              child = _ref[_i];
                              parser.add_node(child);
                            }
                        Severity: Minor
                        Found in cabot/static/theme/js/chosen.jquery.js and 1 other location - About 55 mins to fix
                        cabot/static/arachnys/js/morris.js on lines 1593..1596

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

                        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

                        There are no issues that match your filters.

                        Category
                        Status