gsouf/zero-table

View on GitHub
src/plugins/selection.js

Summary

Maintainability
D
1 day
Test Coverage

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 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 selectRow has 37 lines of code (exceeds 25 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 1 hr to fix

      Function makeRowSelection has 30 lines of code (exceeds 25 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 1 hr to fix

        Avoid deeply nested control flow statements.
        Open

                        }else if( selectionType === 1 ){
                            this.rowSetSelection(tableInstance, $row, true);
                        }else{
                            this.rowSetSelection(tableInstance, $row, false);
                        }
        Severity: Major
        Found in src/plugins/selection.js - About 45 mins to fix

          Avoid deeply nested control flow statements.
          Open

                              if($row.hasClass(plugin.getOption("selectionClass"))){
                                  this.rowSetSelection(tableInstance, $row, false);
                              }else{
                                  this.rowSetSelection(tableInstance, $row, true);
                              }
          Severity: Major
          Found in src/plugins/selection.js - About 45 mins to fix

            Function clearTableSelection has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
            Open

                    clearTableSelection: function(tableInstance, includeHidden){
            
                        var self = this;
            
                        if(includeHidden){
            Severity: Minor
            Found in src/plugins/selection.js - About 45 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

            Avoid too many return statements within this function.
            Open

                                return true;
            Severity: Major
            Found in src/plugins/selection.js - About 30 mins to fix

              Avoid too many return statements within this function.
              Open

                              return true;
              Severity: Major
              Found in src/plugins/selection.js - About 30 mins to fix

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

                        rowSetSelection : function(tableInstance, $row, selected){
                            if(selected){
                                $row.addClass(this.getOption("selectionClass"));
                                if(this.getOption("keepSelection", tableInstance)){
                                    this.__internalSelectionAdd(tableInstance, $row);
                Severity: Minor
                Found in src/plugins/selection.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

                There are no issues that match your filters.

                Category
                Status