mambax7/alumni-26x

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

Summary

Maintainability
C
1 day
Test Coverage

Function sorter has 60 lines of code (exceeds 25 allowed). Consider refactoring.
Open

        sorter: function( c ) {
            var $table = c.$table,
                wo = c.widgetOptions;

            // prevent multiple calls while processing
Severity: Major
Found in media/jquery/tablesorter-master/js/widgets/widget-sortTbodies.js - About 2 hrs to fix

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

            init: function( c, wo ) {
    
                var index, rows, txt, max, $rows,
                    namespace = c.namespace + 'sortTbody',
                    $tbodies = c.$table.children( 'tbody' ),
    Severity: Minor
    Found in media/jquery/tablesorter-master/js/widgets/widget-sortTbodies.js - About 1 hr to fix

      Function restoreTbodies has 32 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

              restoreTbodies : function ( c, wo, $sortedTbodies ) {
                  var $nosort, $tbodies, $thisTbody, tbLen, nsLen, index, targetIndex,
                      $table = c.$table,
                      hasShuffled = true,
                      indx = 0;
      Severity: Minor
      Found in media/jquery/tablesorter-master/js/widgets/widget-sortTbodies.js - About 1 hr to fix

        Avoid deeply nested control flow statements.
        Open

                                        if ( typeof ( cts ) === 'function' ) {
                                            // custom OVERALL text sorter
                                            sort = cts( x, y, dir, col, table );
                                        } else if ( typeof ( cts ) === 'object' && cts.hasOwnProperty( col ) ) {
                                            // custom text sorter for a SPECIFIC COLUMN
        Severity: Major
        Found in media/jquery/tablesorter-master/js/widgets/widget-sortTbodies.js - About 45 mins to fix

          Avoid deeply nested control flow statements.
          Open

                                          if ( typeof ( ts.string[ c.strings[ col ] ] ) === 'boolean' ) {
                                              num = ( dir ? 1 : -1 ) * ( ts.string[ c.strings[ col ] ] ? -1 : 1 );
                                          } else {
                                              num = ( c.strings[ col ] ) ? ts.string[ c.strings[ col ] ] || 0 : 0;
                                          }
          Severity: Major
          Found in media/jquery/tablesorter-master/js/widgets/widget-sortTbodies.js - About 45 mins to fix

            Avoid deeply nested control flow statements.
            Open

                                        if ( targetIndex >= tbLen ) {
                                            // Are we trying to be the last tbody?
                                            $thisTbody.appendTo( $table );
                                        } else if ( targetIndex === 0 ) {
                                            // Are we trying to be the first tbody?
            Severity: Major
            Found in media/jquery/tablesorter-master/js/widgets/widget-sortTbodies.js - About 45 mins to fix

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

                                          if ( targetIndex >= tbLen ) {
                                              // Are we trying to be the last tbody?
                                              $thisTbody.appendTo( $table );
                                          } else if ( targetIndex === 0 ) {
                                              // Are we trying to be the first tbody?
              media/jquery/tablesorter-master/js/widgets/widget-staticRow.js on lines 94..103

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

              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