jonshaffer/angular-data-table

View on GitHub

Showing 98 of 102 total issues

Function PopoverDirective has 176 lines of code (exceeds 25 allowed). Consider refactoring.
Open

export default function PopoverDirective($animate, $compile, $document, $http,
$q, $templateCache, $timeout, PopoverRegistry, PositionHelper) {
/**
* Loads a template from the template cache
* @param {string} template
Severity: Major
Found in src/components/popover/PopoverDirective.js - About 7 hrs to fix

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

link($scope, $element, $attributes) {
$scope.popover = null;
 
$scope.options = {
alignment: $attributes.popoverAlignment || 'middle',
Severity: Major
Found in src/components/popover/PopoverDirective.js - About 6 hrs to fix

File BodyController.js has 413 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import { isOldAngular } from '../../utils/utils';
 
const TREE_TYPES = {
GROUP: 'refreshGroups',
TREE: 'refreshTree',
Severity: Minor
Found in src/components/body/BodyController.js - About 5 hrs to fix

Function buildRowsByGroup has a Cognitive Complexity of 38 (exceeds 5 allowed). Consider refactoring.
Open

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

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

calculateVerticalCaret(elDimensions, popoverDimensions, caretDimensions, alignment) {
switch (alignment) {
case POSITION.TOP:
return subtractAll([
elDimensions.height / 2,
Severity: Major
Found in src/components/popover/PositionHelper.js and 1 other location - About 5 hrs to fix
src/components/popover/PositionHelper.js on lines 75..95

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

calculateHorizontalCaret(elDimensions, popoverDimensions, caretDimensions, alignment) {
switch (alignment) {
case POSITION.LEFT:
return subtractAll([
elDimensions.width / 2,
Severity: Major
Found in src/components/popover/PositionHelper.js and 1 other location - About 5 hrs to fix
src/components/popover/PositionHelper.js on lines 49..73

Function onSorted has a Cognitive Complexity of 33 (exceeds 5 allowed). Consider refactoring.
Open

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

Function PopoverDirective has a Cognitive Complexity of 31 (exceeds 5 allowed). Consider refactoring.
Open

export default function PopoverDirective($animate, $compile, $document, $http,
$q, $templateCache, $timeout, PopoverRegistry, PositionHelper) {
/**
* Loads a template from the template cache
* @param {string} template
Severity: Minor
Found in src/components/popover/PopoverDirective.js - About 4 hrs to fix

Function DataTableDirective has 104 lines of code (exceeds 25 allowed). Consider refactoring.
Open

export default function DataTableDirective($window, $timeout, $parse) {
return {
restrict: 'E',
replace: true,
controller: DataTableController,
Severity: Major
Found in src/components/DataTableDirective.js - About 4 hrs to fix

Function extendArray has a Cognitive Complexity of 28 (exceeds 5 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 4 hrs to fix

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

calculateHorizontalAlignment(elDimensions, popoverDimensions, alignment) {
switch (alignment) {
case POSITION.LEFT:
return elDimensions.left;
case POSITION.RIGHT:
Severity: Major
Found in src/components/popover/PositionHelper.js and 1 other location - About 3 hrs to fix
src/components/popover/PositionHelper.js on lines 36..47

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

calculateVerticalAlignment(elDimensions, popoverDimensions, alignment) {
switch (alignment) {
case POSITION.TOP:
return elDimensions.top;
case POSITION.BOTTOM:
Severity: Major
Found in src/components/popover/PositionHelper.js and 1 other location - About 3 hrs to fix
src/components/popover/PositionHelper.js on lines 22..34

Function HeaderDirective has 97 lines of code (exceeds 25 allowed). Consider refactoring.
Open

export default function HeaderDirective($timeout) {
return {
restrict: 'E',
controller: HeaderController,
controllerAs: 'header',
Severity: Major
Found in src/components/header/HeaderDirective.js - About 3 hrs to fix

Function rowsUpdated has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring.
Open

rowsUpdated(newVal, oldVal) {
if (!newVal) {
this.getRows(true);
} else {
if (this.options.paging.mode !== 'external') {
Severity: Minor
Found in src/components/body/BodyController.js - About 3 hrs to fix

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

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

Function DataTableDirective has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
Open

export default function DataTableDirective($window, $timeout, $parse) {
return {
restrict: 'E',
replace: true,
controller: DataTableController,
Severity: Minor
Found in src/components/DataTableDirective.js - About 3 hrs to fix

Function PositionHelper has 80 lines of code (exceeds 25 allowed). Consider refactoring.
Open

export default function PositionHelper($log) {
function subtractAll(items) {
let total = 0;
 
items.forEach((count, index) => {
Severity: Major
Found in src/components/popover/PositionHelper.js - About 3 hrs to fix

BodyController has 27 functions (exceeds 20 allowed). Consider refactoring.
Open

export default class BodyController {
/**
* A body controller
* @param {$scope}
* @return {BodyController}
Severity: Minor
Found in src/components/body/BodyController.js - About 3 hrs to fix

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

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

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

export default function CellDirective($rootScope, $compile) {
return {
restrict: 'E',
controller: CellController,
scope: true,
Severity: Major
Found in src/components/body/CellDirective.js - About 2 hrs to fix
Severity
Category
Status
Source
Language