wikimedia/mediawiki-core

View on GitHub
resources/src/jquery.tablesorter/jquery.tablesorter.js

Summary

Maintainability
F
5 days
Test Coverage

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

/**
 * TableSorter for MediaWiki
 *
 * Written 2011 Leo Koppelkamm
 * Based on tablesorter.com plugin, written (c) 2007 Christian Bach.
Severity: Major
Found in resources/src/jquery.tablesorter/jquery.tablesorter.js - About 2 days to fix

    Function construct has 121 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

            construct: function ( $tables, settings ) {
                return $tables.each( function ( i, table ) {
                    // Declare and cache.
                    var cache,
                        $table = $( table ),
    Severity: Major
    Found in resources/src/jquery.tablesorter/jquery.tablesorter.js - About 4 hrs to fix

      Function explodeRowspans has 71 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          function explodeRowspans( $table ) {
              var spanningRealCellIndex, colSpan,
                  rowspanCells = $table.find( '> tbody > tr > [rowspan]' ).get();
      
              // Short circuit
      Severity: Major
      Found in resources/src/jquery.tablesorter/jquery.tablesorter.js - About 2 hrs to fix

        Function buildHeaders has 70 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            function buildHeaders( table, msg ) {
                var config = $( table ).data( 'tablesorter' ).config,
                    maxSeen = 0,
                    colspanOffset = 0,
                    $tableHeaders = $( [] ),
        Severity: Major
        Found in resources/src/jquery.tablesorter/jquery.tablesorter.js - About 2 hrs to fix

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

              function detectParserForColumn( table, rows, column ) {
                  var l = parsers.length,
                      config = $( table ).data( 'tablesorter' ).config,
                      nextRow = false,
                      // Start with 1 because 0 is the fallback parser
          Severity: Major
          Found in resources/src/jquery.tablesorter/jquery.tablesorter.js - About 2 hrs to fix

            Function format has 35 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                    format: function ( s ) {
                        s = s.toLowerCase();
            
                        var match;
                        if ( ( match = s.match( ts.dateRegex[ 0 ] ) ) !== null ) {
            Severity: Minor
            Found in resources/src/jquery.tablesorter/jquery.tablesorter.js - About 1 hr to fix

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

                  function getElementSortKey( node ) {
                      // Browse the node to build the raw sort key, which will then be normalized.
                      function buildRawSortKey( currentNode ) {
                          // Get data-sort-value attribute. Uses jQuery to allow live value
                          // changes from other code paths via data(), which reside only in jQuery.
              Severity: Minor
              Found in resources/src/jquery.tablesorter/jquery.tablesorter.js - About 1 hr to fix

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

                    function emulateTHeadAndFoot( $table ) {
                        var $rows = $table.find( '> tbody > tr' );
                
                        if ( !$table.get( 0 ).tHead ) {
                            var $thead = $( '<thead>' );
                Severity: Minor
                Found in resources/src/jquery.tablesorter/jquery.tablesorter.js - About 1 hr to fix

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

                      function buildCache( table ) {
                          var totalRows = ( table.tBodies[ 0 ] && table.tBodies[ 0 ].rows.length ) || 0,
                              config = $( table ).data( 'tablesorter' ).config,
                              cachedParsers = config.parsers,
                              cellIndex,
                  Severity: Minor
                  Found in resources/src/jquery.tablesorter/jquery.tablesorter.js - About 1 hr to fix

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

                        function multisort( table, sortList, cache ) {
                            var sortFn = [],
                                cachedParsers = $( table ).data( 'tablesorter' ).config.parsers;
                    
                            for ( var i = 0; i < sortList.length; i++ ) {
                    Severity: Minor
                    Found in resources/src/jquery.tablesorter/jquery.tablesorter.js - About 1 hr to fix

                      Function buildDateTable has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          function buildDateTable() {
                              var regex = [];
                      
                              ts.monthNames = {};
                      
                      
                      Severity: Minor
                      Found in resources/src/jquery.tablesorter/jquery.tablesorter.js - About 1 hr to fix

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

                                function buildRawSortKey( currentNode ) {
                                    // Get data-sort-value attribute. Uses jQuery to allow live value
                                    // changes from other code paths via data(), which reside only in jQuery.
                                    // Must use $().data() instead of $.data(), as the latter *only*
                                    // accesses the live values, without reading HTML5 attribs first (T40152).
                        Severity: Minor
                        Found in resources/src/jquery.tablesorter/jquery.tablesorter.js - About 1 hr to fix

                          Avoid deeply nested control flow statements.
                          Open

                                                              if ( isValueInArray( s[ 0 ], newSortList ) ) {
                                                                  $( o ).data( 'count', s[ 1 ] + 1 );
                                                                  s[ 1 ] = $( o ).data( 'count' ) % numSortOrders;
                                                              }
                          Severity: Major
                          Found in resources/src/jquery.tablesorter/jquery.tablesorter.js - About 45 mins to fix

                            Function setHeadersCss has 6 arguments (exceeds 4 allowed). Consider refactoring.
                            Open

                                function setHeadersCss( table, $headers, list, css, msg, columnToHeader ) {
                            Severity: Minor
                            Found in resources/src/jquery.tablesorter/jquery.tablesorter.js - About 45 mins to fix

                              Avoid too many return statements within this function.
                              Open

                                                  return buildRawSortKey( elem );
                              Severity: Major
                              Found in resources/src/jquery.tablesorter/jquery.tablesorter.js - About 30 mins to fix

                                Avoid too many return statements within this function.
                                Open

                                                return null;
                                Severity: Major
                                Found in resources/src/jquery.tablesorter/jquery.tablesorter.js - About 30 mins to fix

                                  Avoid too many return statements within this function.
                                  Open

                                                      return elem.textContent;
                                  Severity: Major
                                  Found in resources/src/jquery.tablesorter/jquery.tablesorter.js - About 30 mins to fix

                                    There are no issues that match your filters.

                                    Category
                                    Status