mambax7/alumni-26x

View on GitHub
media/jquery/tablesorter-master/js/widgets/widget-columnSelector.js

Summary

Maintainability
D
2 days
Test Coverage

File widget-columnSelector.js has 447 lines of code (exceeds 250 allowed). Consider refactoring.
Open

/* Widget: columnSelector (responsive table widget) - updated 9/27/2017 (v2.29.0) *//*
 * Requires tablesorter v2.8+ and jQuery 1.7+
 * by Justin Hallett & Rob Garrison
 */
/*jshint browser:true, jquery:true, unused:false */
Severity: Minor
Found in media/jquery/tablesorter-master/js/widgets/widget-columnSelector.js - About 6 hrs to fix

    Function setupSelector has 52 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

            setupSelector: function(c, wo) {
                var index, name, $header, priority, col, colId, $el,
                    colSel = c.selector,
                    $container = colSel.$container,
                    useStorage = wo.columnSelector_saveColumns && ts.storage,
    Severity: Major
    Found in media/jquery/tablesorter-master/js/widgets/widget-columnSelector.js - About 2 hrs to fix

      Function updateBreakpoints has 43 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

              updateBreakpoints: function(c, wo) {
                  var priority, col, column, breaks,
                      isHidden = [],
                      colSel = c.selector,
                      prefix = c.namespace + 'columnselector',
      Severity: Minor
      Found in media/jquery/tablesorter-master/js/widgets/widget-columnSelector.js - About 1 hr to fix

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

                refreshColumns: function( c, optName, optState ) {
                    var i, arry, $el, val,
                        colSel = c.selector,
                        isArry = $.isArray(optState || optName),
                        wo = c.widgetOptions;
        Severity: Minor
        Found in media/jquery/tablesorter-master/js/widgets/widget-columnSelector.js - About 1 hr to fix

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

                  attachTo : function(table, elm) {
                      table = $(table)[0];
                      var colSel, wo, indx,
                          c = table.config,
                          $popup = $(elm);
          Severity: Minor
          Found in media/jquery/tablesorter-master/js/widgets/widget-columnSelector.js - About 1 hr to fix

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

                    setUpColspan: function(c, wo) {
                        var index, span, nspace,
                            $window = $( window ),
                            hasSpans = false,
                            $cells = c.$table
            Severity: Minor
            Found in media/jquery/tablesorter-master/js/widgets/widget-columnSelector.js - About 1 hr to fix

              Function setupBreakpoints has 29 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                      setupBreakpoints: function(c, wo) {
                          var colSel = c.selector;
              
                          // add responsive breakpoints
                          if (wo.columnSelector_mediaquery) {
              Severity: Minor
              Found in media/jquery/tablesorter-master/js/widgets/widget-columnSelector.js - About 1 hr to fix

                Function adjustColspans has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                        adjustColspans: function(c, wo) {
                            var index, cols, col, span, end, $cell,
                                colSel = c.selector,
                                filtered = wo.filter_filteredRow || 'filtered',
                                autoModeOn = wo.columnSelector_mediaquery && colSel.auto,
                Severity: Minor
                Found in media/jquery/tablesorter-master/js/widgets/widget-columnSelector.js - About 1 hr to fix

                  Function init has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                          init: function(table, c, wo) {
                              var $t, colSel;
                  
                              // abort if no input is contained within the layout
                              $t = $(wo.columnSelector_layout);
                  Severity: Minor
                  Found in media/jquery/tablesorter-master/js/widgets/widget-columnSelector.js - About 1 hr to fix

                    Consider simplifying this complex logical expression.
                    Open

                                if (typeof optName !== 'undefined' && optName !== null && colSel.$container.length) {
                                    // pass "selectors" to update the all of the container contents
                                    if ( optName === 'selectors' ) {
                                        colSel.$container.empty();
                                        tsColSel.setupSelector(c, wo);
                    Severity: Major
                    Found in media/jquery/tablesorter-master/js/widgets/widget-columnSelector.js - About 40 mins to fix

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

                          ts.window_resize = function() {
                              if ( ts.timer_resize ) {
                                  clearTimeout( ts.timer_resize );
                              }
                              ts.timer_resize = setTimeout( function() {
                      media/jquery/tablesorter-master/js/widgets/widget-scroller.js on lines 94..101

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

                      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