Showing 46 of 46 total issues

File chosen.jquery.js has 1109 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.1.0
Severity: Major
Found in app/assets/javascripts/chosen.jquery.js - About 2 days to fix

    Function factory has 371 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    var factory = function( $, DataTable ) {
    "use strict";
    
    /**
     * Responsive is a plug-in for the DataTables library that makes use of
    Severity: Major
    Found in app/assets/javascripts/dataTables.responsive.js - About 1 day to fix

      File dataTables.responsive.js has 385 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      /*! Responsive 1.0.1
       * 2014 SpryMedia Ltd - datatables.net/license
       */
      
      /**
      Severity: Minor
      Found in app/assets/javascripts/dataTables.responsive.js - About 5 hrs to fix

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

            _classLogic: function ()
            {
                var that = this;
                var calc = {};
                var breakpoints = this.c.breakpoints;
        Severity: Major
        Found in app/assets/javascripts/dataTables.responsive.js - About 3 hrs to fix

          Function register_observers has 73 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/chosen.jquery.js - About 2 hrs to fix

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

                        else if ( operator === 'min-' ) {
                            // Add this breakpoint and all larger
                            size = that._find( name ).width;
            
                            for ( i=0, ien=breakpoints.length ; i<ien ; i++ ) {
            Severity: Major
            Found in app/assets/javascripts/dataTables.responsive.js and 1 other location - About 2 hrs to fix
            app/assets/javascripts/dataTables.responsive.js on lines 281..309

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

            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 if ( operator === 'max-' ) {
                            // Add this breakpoint and all smaller
                            size = that._find( name ).width;
            
                            for ( i=0, ien=breakpoints.length ; i<ien ; i++ ) {
            Severity: Major
            Found in app/assets/javascripts/dataTables.responsive.js and 1 other location - About 2 hrs to fix
            app/assets/javascripts/dataTables.responsive.js on lines 291..309

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

            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

            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;
                  searchText = this.get_search_text();
            Severity: Major
            Found in app/assets/javascripts/chosen.jquery.js - About 2 hrs to fix

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

                        $(".filter-group").each(function(index) {
                          var name, val;
                          name = $(this).attr("id");
                          val = $(this).val();
                          data[name] = val;
              Severity: Major
              Found in app/assets/javascripts/variants.js and 1 other location - About 2 hrs to fix
              app/assets/javascripts/variants.js on lines 45..51

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

              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

                          return $(this).children("input").each(function(index) {
                            var name, val;
                            name = $(this).attr("id");
                            val = $(this).val();
                            data[name] = val;
              Severity: Major
              Found in app/assets/javascripts/variants.js and 1 other location - About 2 hrs to fix
              app/assets/javascripts/variants.js on lines 37..43

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

              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

              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"));
                    if (this.inherit_select_classes && this.form_field.className) {
              Severity: Minor
              Found in app/assets/javascripts/chosen.jquery.js - About 1 hr to fix

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

                    _columnsVisiblity: function ( breakpoint )
                    {
                        var dt = this.s.dt;
                        var columns = this.s.columns;
                        var i, ien;
                Severity: Minor
                Found in app/assets/javascripts/dataTables.responsive.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(evt) {
                        var high, item;
                        if (this.result_highlight) {
                          high = this.result_highlight;
                          this.result_clear_highlight();
                  Severity: Minor
                  Found in app/assets/javascripts/chosen.jquery.js - About 1 hr to fix

                    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 app/assets/javascripts/chosen.jquery.js and 1 other location - About 1 hr to fix
                    app/assets/javascripts/chosen.jquery.js on lines 587..590

                    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 app/assets/javascripts/chosen.jquery.js and 1 other location - About 1 hr to fix
                    app/assets/javascripts/chosen.jquery.js on lines 590..593

                    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

                    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();
                          switch (stroke) {
                    Severity: Minor
                    Found in app/assets/javascripts/chosen.jquery.js - About 1 hr to fix

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

                          _resizeAuto: function ()
                          {
                              var dt = this.s.dt;
                              var columns = this.s.columns;
                      
                      
                      Severity: Minor
                      Found in app/assets/javascripts/dataTables.responsive.js - About 1 hr to fix

                        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 app/assets/javascripts/chosen.jquery.js and 1 other location - About 1 hr to fix
                        app/assets/javascripts/chosen.jquery.js on lines 911..911

                        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 app/assets/javascripts/chosen.jquery.js and 1 other location - About 1 hr to fix
                        app/assets/javascripts/chosen.jquery.js on lines 901..901

                        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

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

                            _detailsInit: function ()
                            {
                                var that    = this;
                                var dt      = this.s.dt;
                                var details = this.c.details;
                        Severity: Minor
                        Found in app/assets/javascripts/dataTables.responsive.js - About 1 hr to fix
                          Severity
                          Category
                          Status
                          Source
                          Language