jonshaffer/angular-data-table

View on GitHub
src/components/body/SelectionController.js

Summary

Maintainability
B
6 hrs
Test Coverage

Showing 5 of 5 total issues

Function selectRow has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
Open

selectRow(event, index, row) {
if (this.options.selectable) {
if (this.options.multiSelect) {
const isShiftKeyDown = event.shiftKey;
 
 
Severity: Minor
Found in src/components/body/SelectionController.js - About 2 hrs to fix

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

selectRowsBetween(index) {
const reverse = index < this.prevIndex;
const selecteds = [];
 
for (let i = 0, len = this.body.rows.length; i < len; i += 1) {
Severity: Minor
Found in src/components/body/SelectionController.js - About 1 hr to fix

Function selectRowsBetween has 31 lines of code (exceeds 25 allowed). Consider refactoring.
Open

selectRowsBetween(index) {
const reverse = index < this.prevIndex;
const selecteds = [];
 
for (let i = 0, len = this.body.rows.length; i < len; i += 1) {
Severity: Minor
Found in src/components/body/SelectionController.js - About 1 hr to fix

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

keyDown(ev, index, row) {
if (KEYS[ev.keyCode]) {
ev.preventDefault();
}
 
 
Severity: Minor
Found in src/components/body/SelectionController.js - About 45 mins to fix

Avoid deeply nested control flow statements.
Open

if (this.options.multiSelectOnShift && this.selected.length === 1) {
this.selected.splice(0, 1);
}
Severity: Major
Found in src/components/body/SelectionController.js - About 45 mins to fix

There are no issues that match your filters.

Category
Status