mambax7/alumni-26x

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

Summary

Maintainability
F
3 days
Test Coverage

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

/*! Widget: math - updated 5/3/2017 (v2.28.9) *//*
* Requires tablesorter v2.16+ and jQuery 1.7+
* by Rob Garrison
*/
/*jshint browser:true, jquery:true, unused:false */
Severity: Major
Found in media/jquery/tablesorter-master/js/widgets/widget-math.js - About 1 day to fix

    Function getColumn has 77 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

            getColumn : function( c, $el, type, hasFilter ) {
                var index, $t, $tr, len, $mathRows, mathAbove,
                    wo = c.widgetOptions,
                    arry = [],
                    $row = $el.closest( 'tr' ),
    Severity: Major
    Found in media/jquery/tablesorter-master/js/widgets/widget-math.js - About 3 hrs to fix

      Function formatMask has 72 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          ts.formatMask = function( mask, val, tmpPrefix, tmpSuffix ) {
              if ( !mask || isNaN( +val ) ) {
                  return val; // return as it is.
              }
      
      
      Severity: Major
      Found in media/jquery/tablesorter-master/js/widgets/widget-math.js - About 2 hrs to fix

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

                recalculate : function(c, wo, init) {
                    if ( c && ( !wo.math_isUpdating || init ) ) {
        
                        var undef, time, mathAttr, $mathCells, indx, len,
                            changed = false,
        Severity: Major
        Found in media/jquery/tablesorter-master/js/widgets/widget-math.js - About 2 hrs to fix

          Function mathType has 48 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

                  mathType : function( c, $cells, priority, hasFilter ) {
                      if ( $cells.length ) {
                          var getAll,
                              changed = false,
                              wo = c.widgetOptions,
          Severity: Minor
          Found in media/jquery/tablesorter-master/js/widgets/widget-math.js - About 1 hr to fix

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

                    output : function( $cell, c, value, arry ) {
                        // get mask from cell data-attribute: data-math-mask="#,##0.00"
                        var $el,
                            wo = c.widgetOptions,
                            changed = false,
            Severity: Minor
            Found in media/jquery/tablesorter-master/js/widgets/widget-math.js - About 1 hr to fix

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

                      getAll : function( c, hasFilter ) {
                          var $t, col, $row, rowIndex, rowLen, $cells, cellIndex, cellLen,
                              arry = [],
                              wo = c.widgetOptions,
                              mathAttr = wo.math_dataAttrib,
              Severity: Minor
              Found in media/jquery/tablesorter-master/js/widgets/widget-math.js - About 1 hr to fix

                Consider simplifying this complex logical expression.
                Open

                            if ( c && ( !wo.math_isUpdating || init ) ) {
                
                                var undef, time, mathAttr, $mathCells, indx, len,
                                    changed = false,
                                    filters = {};
                Severity: Major
                Found in media/jquery/tablesorter-master/js/widgets/widget-math.js - About 1 hr to fix

                  Avoid deeply nested control flow statements.
                  Open

                                                  if ( arry.length ) {
                                                      result = equations[ formula ]( arry, c );
                                                      if ( c.debug || wo.math_debug ) {
                                                          console.log( $el.attr( mathAttr ), hasFilter ? '("' + hasFilter + '")' : '', arry, '=', result );
                                                      }
                  Severity: Major
                  Found in media/jquery/tablesorter-master/js/widgets/widget-math.js - About 45 mins to fix

                    Consider simplifying this complex logical expression.
                    Open

                                        if ( ( ( hasFilter || !$tr.hasClass( filtered ) ) &&
                                                $tr.not( mathIgnore ).length &&
                                                index !== len ) ||
                                                mathAbove && index !== len ) {
                                            // stop calculating 'above', when encountering another 'above'
                    Severity: Major
                    Found in media/jquery/tablesorter-master/js/widgets/widget-math.js - About 40 mins to fix

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

                                          $t = $tr.children().filter( function() {
                                              return math.getCellIndex( $( this ) ) === cIndex;
                                          });
                      Severity: Minor
                      Found in media/jquery/tablesorter-master/js/widgets/widget-math.js and 1 other location - About 35 mins to fix
                      media/jquery/tablesorter-master/js/widgets/widget-math.js on lines 143..145

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

                      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

                                          $t = $tr.children().filter( function() {
                                              return math.getCellIndex( $( this ) ) === cIndex;
                                          });
                      Severity: Minor
                      Found in media/jquery/tablesorter-master/js/widgets/widget-math.js and 1 other location - About 35 mins to fix
                      media/jquery/tablesorter-master/js/widgets/widget-math.js on lines 126..128

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

                      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

                              stdevp : function( arry, c ) {
                                  var varp = ts.equations.variance( arry, true, c );
                                  return Math.sqrt( varp );
                              }
                      Severity: Minor
                      Found in media/jquery/tablesorter-master/js/widgets/widget-math.js and 1 other location - About 35 mins to fix
                      media/jquery/tablesorter-master/js/widgets/widget-math.js on lines 583..586

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

                      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

                              stdevs : function( arry, c ) {
                                  var vars = ts.equations.variance( arry, false, c );
                                  return Math.sqrt( vars );
                              },
                      Severity: Minor
                      Found in media/jquery/tablesorter-master/js/widgets/widget-math.js and 1 other location - About 35 mins to fix
                      media/jquery/tablesorter-master/js/widgets/widget-math.js on lines 588..591

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

                      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