jonshaffer/angular-data-table

View on GitHub

Showing 98 of 102 total issues

Function BodyDirective has 68 lines of code (exceeds 25 allowed). Consider refactoring.
Open

export default function BodyDirective() {
return {
restrict: 'E',
controller: BodyController,
controllerAs: 'body',
Severity: Major
Found in src/components/body/BodyDirective.js - About 2 hrs to fix

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 HeaderCellDirective has 61 lines of code (exceeds 25 allowed). Consider refactoring.
Open

export default function HeaderCellDirective($compile) {
return {
restrict: 'E',
controller: HeaderCellController,
controllerAs: 'hcell',
Severity: Major
Found in src/components/header/HeaderCellDirective.js - About 2 hrs to fix

Function getRows has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
Open

getRows(refresh) {
// only proceed when we have pre-aggregated the values
if ((this.treeColumn || this.groupColumn) && !this.rowsByGroup) {
return false;
}
Severity: Minor
Found in src/components/body/BodyController.js - About 2 hrs to fix

Function SortableDirective has 56 lines of code (exceeds 25 allowed). Consider refactoring.
Open

export default function SortableDirective() {
return {
restrict: 'A',
scope: {
isSortable: '=sortable',
Severity: Major
Found in src/components/header/SortableDirective.js - About 2 hrs to fix

DataTableController has 21 functions (exceeds 20 allowed). Consider refactoring.
Open

export default class DataTableController {
/**
* Creates an instance of the DataTable Controller
* @param {scope}
* @param {filter}
Severity: Minor
Found in src/components/DataTableController.js - About 2 hrs to fix

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

export default function ResizableDirective($document, $timeout) {
return {
restrict: 'A',
scope: {
isResizable: '=resizable',
Severity: Major
Found in src/components/header/ResizableDirective.js - About 2 hrs to fix

Function ScrollerDirective has 50 lines of code (exceeds 25 allowed). Consider refactoring.
Open

export default function ScrollerDirective() {
return {
restrict: 'E',
require: '^dtBody',
transclude: true,
Severity: Minor
Found in src/components/body/ScrollerDirective.js - About 2 hrs to fix

Function compile has 49 lines of code (exceeds 25 allowed). Consider refactoring.
Open

compile() {
return {
pre($scope, $elm, $attrs, ctrl) {
DataTableService.buildColumns($scope, $parse);
 
 
Severity: Minor
Found in src/components/DataTableDirective.js - About 1 hr to fix

Function onSorted has 48 lines of code (exceeds 25 allowed). Consider refactoring.
Open

onSorted() {
if (!this.rows) {
return;
}
 
 
Severity: Minor
Found in src/components/DataTableController.js - About 1 hr to fix

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

(function extendArray() {
/**
* Array.prototype.find()
* https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/find
*/
Severity: Minor
Found in src/utils/polyfill.js - About 1 hr to fix

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

link($scope, $element) {
let dragEl;
let nextEl;
 
function isbefore(a, b) {
Severity: Minor
Found in src/components/header/SortableDirective.js - About 1 hr to fix

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

pre($scope, $elm, $attrs, ctrl) {
DataTableService.buildColumns($scope, $parse);
 
// Check and see if we had expressive columns
// and if so, lets use those
Severity: Minor
Found in src/components/DataTableDirective.js - About 1 hr to fix

Function HeaderCellDirective has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
Open

export default function HeaderCellDirective($compile) {
return {
restrict: 'E',
controller: HeaderCellController,
controllerAs: 'hcell',
Severity: Minor
Found in src/components/header/HeaderCellDirective.js - About 1 hr to fix

Function buildColumns has 42 lines of code (exceeds 25 allowed). Consider refactoring.
Open

buildColumns(scope, parse) {
// FIXME: Too many nested for loops. O(n3)
 
// Iterate through each dTable
angular.forEach(this.dTables, (columnElms, id) => {
Severity: Minor
Found in src/components/DataTableService.js - About 1 hr to fix

Function link has 42 lines of code (exceeds 25 allowed). Consider refactoring.
Open

link($scope, $element) {
if ($scope.isResizable) {
$element.addClass('resizable');
}
 
 
Severity: Minor
Found in src/components/header/ResizableDirective.js - About 1 hr to fix

Function buildRowsByGroup has 42 lines of code (exceeds 25 allowed). Consider refactoring.
Open

buildRowsByGroup() {
this.index = {};
this.rowsByGroup = {};
 
const parentProp = this.treeColumn ?
Severity: Minor
Found in src/components/body/BodyController.js - About 1 hr to fix

Function getRows has 42 lines of code (exceeds 25 allowed). Consider refactoring.
Open

getRows(refresh) {
// only proceed when we have pre-aggregated the values
if ((this.treeColumn || this.groupColumn) && !this.rowsByGroup) {
return false;
}
Severity: Minor
Found in src/components/body/BodyController.js - About 1 hr to fix

Function link has 41 lines of code (exceeds 25 allowed). Consider refactoring.
Open

link($scope, $elm, $attrs, ctrl) {
const parent = $elm.parent();
 
let ticking = false;
let lastScrollY = 0;
Severity: Minor
Found in src/components/body/ScrollerDirective.js - About 1 hr 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
Severity
Category
Status
Source
Language