Vizzuality/gfw-climate

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

Summary

Maintainability
F
5 days
Test Coverage

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

/* Chosen v1.4.2 | (c) 2011-2015 by Harvest | MIT License, https://github.com/harvesthq/chosen/blob/master/LICENSE.md */
(function() {
  var a,
    AbstractChosen,
    Chosen,
Severity: Major
Found in app/assets/javascripts/chosen.jquery.min.js - About 3 days to fix

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

            (Chosen.prototype.register_observers = function() {
              var a = this;
              return (
                this.container.bind('touchstart.chosen', function(b) {
                  return a.container_mousedown(b), b.preventDefault();
    Severity: Major
    Found in app/assets/javascripts/chosen.jquery.min.js - About 3 hrs to fix

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

              (Chosen.prototype.set_up_html = function() {
                var b, c;
                return (
                  (b = ['chosen-container']),
                  b.push(
      Severity: Major
      Found in app/assets/javascripts/chosen.jquery.min.js - About 2 hrs to fix

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

                (AbstractChosen.prototype.winnow_results = function() {
                  var a, b, c, d, e, f, g, h, i, j, k, l;
                  for (
                    this.no_results_clear(),
                      d = 0,
        Severity: Major
        Found in app/assets/javascripts/chosen.jquery.min.js - About 2 hrs to fix

          Function set_default_values has 49 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

                  (AbstractChosen.prototype.set_default_values = function() {
                    var a = this;
                    return (
                      (this.click_test_action = function(b) {
                        return a.test_active_click(b);
          Severity: Minor
          Found in app/assets/javascripts/chosen.jquery.min.js - About 1 hr to fix

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

                    (Chosen.prototype.result_select = function(a) {
                      var b, c;
                      return this.result_highlight
                        ? ((b = this.result_highlight),
                          this.result_clear_highlight(),
            Severity: Minor
            Found in app/assets/javascripts/chosen.jquery.min.js - About 1 hr to fix

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

                      (Chosen.prototype.search_field_scale = function() {
                        var b, c, d, e, f, g, h, i, j;
                        if (this.is_multiple) {
                          for (
                            d = 0,
              Severity: Minor
              Found in app/assets/javascripts/chosen.jquery.min.js - About 1 hr to fix

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

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

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

                          (Chosen.prototype.keydown_checker = function(a) {
                            var b, c;
                            switch (((b = null != (c = a.which) ? c : a.keyCode),
                            this.search_field_scale(),
                            8 !== b && this.pending_backstroke && this.clear_backstroke(),
                  Severity: Minor
                  Found in app/assets/javascripts/chosen.jquery.min.js - About 1 hr to fix

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

                                  ? ((this.search_choices = this.container
                                      .find('ul.chosen-choices')
                                      .first()),
                                    (this.search_container = this.container
                                      .find('li.search-field')
                    Severity: Major
                    Found in app/assets/javascripts/chosen.jquery.min.js and 1 other location - About 1 hr to fix
                    app/assets/javascripts/chosen.jquery.min.js on lines 549..554

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

                    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

                                  : ((this.search_container = this.container
                                      .find('div.chosen-search')
                                      .first()),
                                    (this.selected_item = this.container
                                      .find('.chosen-single')
                    Severity: Major
                    Found in app/assets/javascripts/chosen.jquery.min.js and 1 other location - About 1 hr to fix
                    app/assets/javascripts/chosen.jquery.min.js on lines 543..548

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

                    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

                                (c = a(b.target).hasClass('active-result')
                                  ? a(b.target)
                                  : a(b.target)
                                      .parents('.active-result')
                                      .first()),
                    Severity: Major
                    Found in app/assets/javascripts/chosen.jquery.min.js and 1 other location - About 1 hr to fix
                    app/assets/javascripts/chosen.jquery.min.js on lines 899..903

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

                    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

                                (c = a(b.target).hasClass('active-result')
                                  ? a(b.target)
                                  : a(b.target)
                                      .parents('.active-result')
                                      .first()),
                    Severity: Major
                    Found in app/assets/javascripts/chosen.jquery.min.js and 1 other location - About 1 hr to fix
                    app/assets/javascripts/chosen.jquery.min.js on lines 884..888

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

                    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() {
                              return (
                                this.pending_backstroke &&
                                  this.pending_backstroke.removeClass('search-choice-focus'),
                                (this.pending_backstroke = null)
                    Severity: Minor
                    Found in app/assets/javascripts/chosen.jquery.min.js and 1 other location - About 50 mins to fix
                    app/assets/javascripts/chosen.jquery.min.js on lines 809..815

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

                    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() {
                              return (
                                this.result_highlight &&
                                  this.result_highlight.removeClass('highlighted'),
                                (this.result_highlight = null)
                    Severity: Minor
                    Found in app/assets/javascripts/chosen.jquery.min.js and 1 other location - About 50 mins to fix
                    app/assets/javascripts/chosen.jquery.min.js on lines 1118..1124

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

                    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

                            (AbstractChosen.prototype.results_search = function() {
                              return this.results_showing
                                ? this.winnow_results()
                                : this.results_show();
                            }),
                    Severity: Minor
                    Found in app/assets/javascripts/chosen.jquery.min.js and 1 other location - About 30 mins to fix
                    app/assets/javascripts/chosen.jquery.min.js on lines 289..293

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

                    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

                            (AbstractChosen.prototype.results_toggle = function() {
                              return this.results_showing
                                ? this.results_hide()
                                : this.results_show();
                            }),
                    Severity: Minor
                    Found in app/assets/javascripts/chosen.jquery.min.js and 1 other location - About 30 mins to fix
                    app/assets/javascripts/chosen.jquery.min.js on lines 294..298

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

                    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