jonshaffer/angular-data-table

View on GitHub

Showing 98 of 102 total issues

Function positionPopover has 36 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function positionPopover(triggerElement, popover, options) {
$timeout(() => {
const elDimensions = triggerElement[0].getBoundingClientRect();
const popoverDimensions = popover[0].getBoundingClientRect();
 
 
Severity: Minor
Found in src/components/popover/PopoverDirective.js - About 1 hr to fix

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

Function ResizableDirective has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

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

Function MenuDirective has 34 lines of code (exceeds 25 allowed). Consider refactoring.
Open

export default function MenuDirective() {
return {
restrict: 'E',
controller: 'MenuController',
controllerAs: 'dtm',
Severity: Minor
Found in src/components/menu/MenuDirective.js - About 1 hr to fix

Function setConditionalWatches has 34 lines of code (exceeds 25 allowed). Consider refactoring.
Open

setConditionalWatches() {
for (let i = this.watchListeners.length - 1; i >= 0; i -= 1) {
this.watchListeners[i]();
 
this.watchListeners.splice(i, 1);
Severity: Minor
Found in src/components/body/BodyController.js - About 1 hr to fix

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

compile() {
return {
pre($scope, $elm, $attrs, ctrl) {
const content = angular.element($elm[0].querySelector('.dt-cell-content'));
 
 
Severity: Minor
Found in src/components/body/CellDirective.js - About 1 hr to fix

Function ScaleColumns has 33 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function ScaleColumns(colsByGroup, maxWidth, totalFlexGrow) {
// calculate total width and flexgrow points for coulumns that can be resized
angular.forEach(colsByGroup, (cols) => {
cols.forEach((column) => {
if (!column.canAutoResize) {
Severity: Minor
Found in src/utils/math.js - About 1 hr to fix

Function PagerDirective has 33 lines of code (exceeds 25 allowed). Consider refactoring.
Open

export default function PagerDirective() {
return {
restrict: 'E',
controller: PagerController,
controllerAs: 'pager',
Severity: Minor
Found in src/components/footer/PagerDirective.js - About 1 hr to fix

Function DropdownDirective has 33 lines of code (exceeds 25 allowed). Consider refactoring.
Open

export default function DropdownDirective($document, $timeout) {
return {
restrict: 'C',
controller: 'DropdownController',
link($scope, $elm) {
Severity: Minor
Found in src/components/menu/dropdown/DropdownDirective.js - About 1 hr to fix

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

template(element) {
// Gets the column nodes to transposes to column objects
// http://stackoverflow.com/questions/30845397/angular-expressive-directive-design/30847609#30847609
const columns = element[0].getElementsByTagName('column');
const id = ObjectId();
Severity: Minor
Found in src/components/DataTableDirective.js - About 1 hr to fix

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

export function ForceFillColumnWidths(allColumns, expectedWidth, startIdx) {
let contentWidth = 0;
const columnsToResize = startIdx > -1 ?
allColumns.slice(startIdx, allColumns.length).filter(c => c.canAutoResize) :
allColumns.filter(c => c.canAutoResize);
Severity: Minor
Found in src/utils/math.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 pre has 30 lines of code (exceeds 25 allowed). Consider refactoring.
Open

pre($scope, $elm, $attrs, ctrl) {
const content = angular.element($elm[0].querySelector('.dt-cell-content'));
 
let cellScope;
 
 
Severity: Minor
Found in src/components/body/CellDirective.js - About 1 hr to fix

Function addCaret has 30 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function addCaret(popoverEl, elDimensions, popoverDimensions) {
const caret = angular.element(`<span class="popover-caret caret-${$scope.options.placement}"></span>`);
popoverEl.append(caret);
const caretDimensions = caret[0].getBoundingClientRect();
 
 
Severity: Minor
Found in src/components/popover/PopoverDirective.js - About 1 hr to fix

Function PopoverDirective has 9 arguments (exceeds 4 allowed). Consider refactoring.
Open

export default function PopoverDirective($animate, $compile, $document, $http,
$q, $templateCache, $timeout, PopoverRegistry, PositionHelper) {
Severity: Major
Found in src/components/popover/PopoverDirective.js - About 1 hr to fix

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

link($scope, $elm, $attrs, ctrl) {
$scope.columnsResorted = function columnsResorted(event, columnId) {
const col = findColumnById(columnId);
const parent = angular.element(event.currentTarget);
 
 
Severity: Minor
Found in src/components/header/HeaderDirective.js - About 1 hr to fix

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

for (let i = 0; i < length; i += 1) {
value = list[i];
if (predicate.call(thisArg, value, i, list)) {
return i;
}
Severity: Major
Found in src/utils/polyfill.js and 1 other location - About 1 hr to fix
src/utils/polyfill.js on lines 24..29

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

for (let i = 0; i < length; i += 1) {
value = list[i];
if (predicate.call(thisArg, value, i, list)) {
return value;
}
Severity: Major
Found in src/utils/polyfill.js and 1 other location - About 1 hr to fix
src/utils/polyfill.js on lines 56..61

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

link($scope, $elm) {
function closeDropdown(ev) {
if ($elm[0].contains(ev.target)) {
return;
}
Severity: Minor
Found in src/components/menu/dropdown/DropdownDirective.js - About 1 hr to fix

Function ScrollerDirective has a Cognitive Complexity of 9 (exceeds 5 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 55 mins to fix
Severity
Category
Status
Source
Language