gsouf/zero-table

View on GitHub

Showing 51 of 51 total issues

Function render has a Cognitive Complexity of 45 (exceeds 5 allowed). Consider refactoring.
Open

    render: function(renderer, set){

        var self = this;

        // TODO : compile and cache
Severity: Minor
Found in src/ZeroTable/StringRenderParser.js - About 6 hrs 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 3 locations. Consider refactoring.
Open

    __bindEvents: function($elm){
        var self = this;

        var $input = $elm.find("input");

Severity: Major
Found in src/ZeroTable/Plugin/SearchHeader/String.js and 2 other locations - About 5 hrs to fix
src/ZeroTable/Plugin/SearchHeader/Int.js on lines 20..38
src/ZeroTable/Plugin/SearchHeader/Select.js on lines 26..44

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

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 3 locations. Consider refactoring.
Open

    __bindEvents: function($elm){
        var self = this;

        var $input = $elm.find("select");

Severity: Major
Found in src/ZeroTable/Plugin/SearchHeader/Select.js and 2 other locations - About 5 hrs to fix
src/ZeroTable/Plugin/SearchHeader/Int.js on lines 20..38
src/ZeroTable/Plugin/SearchHeader/String.js on lines 21..39

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

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 3 locations. Consider refactoring.
Open

    __bindEvents: function($elm){
        var self = this;

        var $input = $elm.find("input");

Severity: Major
Found in src/ZeroTable/Plugin/SearchHeader/Int.js and 2 other locations - About 5 hrs to fix
src/ZeroTable/Plugin/SearchHeader/Select.js on lines 26..44
src/ZeroTable/Plugin/SearchHeader/String.js on lines 21..39

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

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

Function makeRowSelection has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
Open

        makeRowSelection: function(tableInstance, $row, largeSelection){

            // check if we already reached the max selection
            var maxSelection = this.getOption("maxSelection", tableInstance);
            if(maxSelection === 0){
Severity: Minor
Found in src/plugins/selection.js - About 3 hrs 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 selectRow has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
Open

        selectRow : function(tableInstance, $row, selectionType){

            var maxSelection = this.getOption("maxSelection", tableInstance);
            var plugin = this;

Severity: Minor
Found in src/plugins/selection.js - About 2 hrs 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 drawHeaderColumns has 72 lines of code (exceeds 25 allowed). Consider refactoring.
Open

        drawHeaderColumns : function($row, tableInstance){

            var self = this;
            var currentOrderingIndexed = ZeroTable.clone(tableInstance.dataConnector.getOrder());
            var i = 0;
Severity: Major
Found in src/plugins/header.js - About 2 hrs to fix

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

    module.exports = function(grunt) {
    
    
        // Source files to include
        var sourceFiles = grunt.file.readJSON('build.json');
    Severity: Major
    Found in Gruntfile.js - About 2 hrs to fix

      Function SearchDetails has 69 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      ZeroTable.Tools.SearchDetails = function(table, options){
      
          this.options = {};
          options = options || {};
      
      
      Severity: Major
      Found in src/ZeroTable/Tools/SearchDetails.js - About 2 hrs to fix

        Function render has 53 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            render: function(renderer, set){
        
                var self = this;
        
                // TODO : compile and cache
        Severity: Major
        Found in src/ZeroTable/StringRenderParser.js - About 2 hrs to fix

          Function foreach has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
          Open

          ZeroTable.foreach = function(set,callback){
          
            if(set instanceof Array){
              for(var i = 0; i < set.length ; i++ ){
                var r = callback(set[i],i,set);
          Severity: Minor
          Found in src/ZeroTable/foreach.js - About 2 hrs 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 tableKeys has 45 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              "tableKeys" : function(plugin){
          
                  return {
          
                      internalSelection: {},
          Severity: Minor
          Found in src/plugins/selection.js - About 1 hr to fix

            Function drawInnerRow has 45 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                drawInnerRow: function(tableInstance, dataRow, $row){
            
                    // Remove custom class because they depend on the data
                    var customClass = $row.attr('data-zt-rowcustom-class');
                    if(customClass){
            Severity: Minor
            Found in src/ZeroTable/Plugin/TableBodyMode/Table.js - About 1 hr to fix

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

                  ZeroTable.foreach(this.columns, function(item,i,set){
                      if ( !(item instanceof ZeroTable.Column.Definition) ) {
                          set[i] = new ZeroTable.Column.Definition(item);
                      }
                  });
              Severity: Major
              Found in src/ZeroTable/Table.js and 1 other location - About 1 hr to fix
              src/ZeroTable/DataConnector.js on lines 20..24

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

              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

                  ZeroTable.foreach(this.columns, function(item,i,set){
                      if ( !(item instanceof ZeroTable.Column.Definition) ) {
                          set[i] = new ZeroTable.Column.Definition(item);
                      }
                  });
              Severity: Major
              Found in src/ZeroTable/DataConnector.js and 1 other location - About 1 hr to fix
              src/ZeroTable/Table.js on lines 42..46

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

              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

              Function fire has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
              Open

                  fire : function(what, params){
              
                      var event = new ZeroTable.Bindable.Event(this);
              
                      if(this.bindable_bounds && this.bindable_bounds[what]) {
              Severity: Minor
              Found in src/ZeroTable/Bindable.js - About 1 hr 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 data.orderChange has 39 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                      "data.orderChange": function(e){
                          var tableInstance = this.context;
                          var dataConnector = e.originalEvent.context;
              
                          var order = dataConnector.getOrder();
              Severity: Minor
              Found in src/plugins/header.js - About 1 hr to fix

                Function update has 38 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    update : function(delay){
                
                        var transactionId = this.__generateGuid;
                        this._currentTransaction = transactionId;
                
                
                Severity: Minor
                Found in src/ZeroTable/DataConnector.js - About 1 hr to fix

                  Function Paginator has 38 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  ZeroTable.Tools.Paginator = function(table){
                      this.table = table;
                      this.$item = $('<div class="zt-paginator"></div>');
                  
                      var $firstPage = $('<div class="zt-pagi-ico zt-first-page">&lt;&lt;</div>');
                  Severity: Minor
                  Found in src/ZeroTable/Tools/Paginator.js - About 1 hr to fix

                    Function Table has 38 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                    ZeroTable.Table = function(options){
                    
                        var self = this;
                    
                        ZeroTable.extend(this,[
                    Severity: Minor
                    Found in src/ZeroTable/Table.js - About 1 hr to fix
                      Severity
                      Category
                      Status
                      Source
                      Language