mambax7/alumni-26x

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

Summary

Maintainability
D
2 days
Test Coverage

File widget-build-table.js has 313 lines of code (exceeds 250 allowed). Consider refactoring.
Open

/*! Widget: Build Table - updated 4/2/2017 (v2.28.6) *//*
 * for tableSorter v2.16.0+
 * by Rob Garrison
 */
/*jshint browser:true, jquery:true, unused:false */
Severity: Minor
Found in media/jquery/tablesorter-master/js/widgets/widget-build-table.js - About 3 hrs to fix

    Function object has 76 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        bt.object = function(table, data, wo) {
            // 'rows'
            var j, l, t, $c, $t, $tb, $tr,
                c = table.config,
                kh = wo.build_objectHeaderKey,
    Severity: Major
    Found in media/jquery/tablesorter-master/js/widgets/widget-build-table.js - About 3 hrs to fix

      Function buildTable has 47 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          bt = ts.buildTable = function(tar, c){
              // add build options to defaults to prevent warnings
              $.extend(true, ts.defaults.widgetOptions, bt.defaults);
              // add table if one doesn't exist
              var $tbl = tar.nodeName === 'TABLE' ? $(tar) : $('<table>').appendTo(tar),
      Severity: Minor
      Found in media/jquery/tablesorter-master/js/widgets/widget-build-table.js - About 1 hr to fix

        Function csv has 46 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            bt.csv = function(table, data, wo) {
                var c, h,
                    csv = wo.build_type === 'csv' || typeof data === 'string',
                    $t = $(table),
                    lines = csv ? data.replace('\r', '').split('\n') : data,
        Severity: Minor
        Found in media/jquery/tablesorter-master/js/widgets/widget-build-table.js - About 1 hr to fix

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

                  rows : function(items, txt, c, wo, num, ftr){
          Severity: Minor
          Found in media/jquery/tablesorter-master/js/widgets/widget-build-table.js - About 45 mins to fix

            Function cell has 5 arguments (exceeds 4 allowed). Consider refactoring.
            Open

                    cell : function(d, wo, typ, col, first){
            Severity: Minor
            Found in media/jquery/tablesorter-master/js/widgets/widget-build-table.js - About 35 mins to fix

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

                              for ( j = 0; j < l; j++ ) {
                                  // cell(cellData, widgetOptions, 'td')
                                  $c = bt.build.cell(d[j], wo, 'td', j);
                                  if ($c[0] && $c[0].length) { $c[0].appendTo( $tr ); } // add cell
                              }
              media/jquery/tablesorter-master/js/widgets/widget-build-table.js on lines 442..446

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

              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

                                  for ( j = 0; j < l; j++ ) {
                                      // cell(cellData, widgetOptions, 'th')
                                      $tb = bt.build.cell(d[j], wo, 'th', j);
                                      if ($tb[0] && $tb[0].length) { $tb[0].appendTo( $tr ); } // add cell
                                  }
              media/jquery/tablesorter-master/js/widgets/widget-build-table.js on lines 423..427

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

              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

                          r = data.hasOwnProperty(kr) && !$.isEmptyObject(data.kr) ? data.kr : data.hasOwnProperty('rows') ? data.rows : false;
              media/jquery/tablesorter-master/js/widgets/widget-build-table.js on lines 360..360

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

              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

                          h = data.hasOwnProperty(kh) && !$.isEmptyObject(data.kh) ? data.kh : data.hasOwnProperty('headers') ? data.headers : false,
              media/jquery/tablesorter-master/js/widgets/widget-build-table.js on lines 361..361

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

              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