codenautas/tabulator

View on GitHub
tabulator.js

Summary

Maintainability
F
1 wk
Test Coverage

Function Tabulator has a Cognitive Complexity of 147 (exceeds 5 allowed). Consider refactoring.
Open

})(/*jshint -W040 */this, function Tabulator() {
/*jshint +W040 */

/*jshint node:false */
if(typeof window !== 'undefined'){
Severity: Minor
Found in tabulator.js - About 2 days to fix

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

Function Tabulator has 397 lines of code (exceeds 25 allowed). Consider refactoring.
Open

})(/*jshint -W040 */this, function Tabulator() {
/*jshint +W040 */

/*jshint node:false */
if(typeof window !== 'undefined'){
Severity: Major
Found in tabulator.js - About 1 day to fix

    File tabulator.js has 412 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    /*!
     * tabulator
     * 2015 Codenautas
     * MIT Licensed
     */
    Severity: Minor
    Found in tabulator.js - About 5 hrs to fix

      Function getBaseMatrix has 61 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      Tabulator.prototype.getBaseMatrix = function getBaseMatrix(datum){
          var places={
              left:{place:'lineVariables'},
              top:{place:'columnVariables'},
              data:{place:'dataVariables'},
      Severity: Major
      Found in tabulator.js - About 2 hrs to fix

        Function tHeadPart has 55 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        Tabulator.prototype.tHeadPart = function tHeadPart(matrix){
            var tabulator = this;
            if(!matrix.columnVariables) return null;
            function labelVariable(varName){
                return ((matrix.vars||{})[varName]||{}).label||varName;
        Severity: Major
        Found in tabulator.js - About 2 hrs to fix

          Function tBodyPart has 37 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          Tabulator.prototype.tBodyPart = function tBodyPart(matrix){
              var trList=[];
              var previousLineTitles=[];
              var titleLineAttrs=[];    
              for(var i=0; i<matrix.lines.length;i++){
          Severity: Minor
          Found in tabulator.js - About 1 hr to fix

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

            Tabulator.prototype.controls=function controls(matrix){
                var  matrixLineVariables=matrix.lineVariables;
                var  matrixLines=matrix.lines;
                var  matrixColumnVariables=matrix.columnVariables;
                var  matrixColumns=matrix.columns;
            Severity: Minor
            Found in tabulator.js - About 1 hr to fix

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

              Tabulator.prototype.matrixJoin = function matrixJoin(matrixList){
                  this.controlsJoin(matrixList);
                  
                  var matrix={columnGroups:[], lineVariables:[], lines:[], vars:{}};
                  var captions = matrixList.map(function(obj){return obj.caption});
              Severity: Minor
              Found in tabulator.js - About 1 hr to fix

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

                Tabulator.prototype.toExcel = function toExcel(tableElem, params){
                    var type = 'xlsx'
                    var wb = XLSX.utils.table_to_book(tableElem, {
                        sheet: "Tabulado"
                    });
                Severity: Minor
                Found in tabulator.js - About 1 hr to fix

                  Avoid deeply nested control flow statements.
                  Open

                                      if((matrix.lineVariables||{})[j]){
                                          titleLineAttrs[j]['class']='var_'+(matrix.lineVariables||{})[j];
                                      }
                  Severity: Major
                  Found in tabulator.js - About 45 mins to fix

                    Function webpackUniversalModuleDefinition has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                    Open

                    (function webpackUniversalModuleDefinition(root, factory) {
                        /* global define */
                        /* global globalModuleName */
                        if(typeof root.globalModuleName !== 'string'){
                            root.globalModuleName = factory.name;
                    Severity: Minor
                    Found in tabulator.js - About 25 mins to fix

                    Cognitive Complexity

                    Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                    A method's cognitive complexity is based on a few simple rules:

                    • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                    • Code is considered more complex for each "break in the linear flow of the code"
                    • Code is considered more complex when "flow breaking structures are nested"

                    Further reading

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

                            for (var i = 0; i != s.length; ++i)
                                view[i] = s.charCodeAt(i) & 0xFF;
                    Severity: Minor
                    Found in tabulator.js and 1 other location - About 35 mins to fix
                    tabulator.js on lines 263..264

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

                    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 (var i = 0; i != s.length; ++i)
                                buf[i] = s.charCodeAt(i) & 0xFF;
                    Severity: Minor
                    Found in tabulator.js and 1 other location - About 35 mins to fix
                    tabulator.js on lines 258..259

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

                    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