Showing 89 of 89 total issues
Function initCache
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
initCache(details: any): void {
const { rows, rowHeight, detailRowHeight, externalVirtual, rowCount, rowIndexes, rowExpansions } = details;
const isFn = typeof rowHeight === 'function';
const isDetailFn = typeof detailRowHeight === 'function';
- Read upRead up
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 updateRows
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
updateRows(): void {
const { first, last } = this.indexes;
let rowIndex = first;
let idx = 0;
const temp: any[] = [];
- Read upRead up
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 14 (exceeds 5 allowed). Consider refactoring. Open
selectRow(event: KeyboardEvent | MouseEvent, index: number, row: any): void {
if (!this.selectEnabled) {return;}
const chkbox = this.selectionType === SelectionType.checkbox;
const multi = this.selectionType === SelectionType.multi;
- Read upRead up
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 ngOnInit
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
ngOnInit(): void {
if (this.rowDetail) {
this.listener = this.rowDetail.toggle.subscribe(({ type, value }: { type: string; value: any }) => {
if (type === 'row') {
this.toggleRowExpansion(value);
- Read upRead up
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 setColumnDefaults
has 43 lines of code (exceeds 25 allowed). Consider refactoring. Open
export function setColumnDefaults(columns: TableColumn[]) {
if (!columns) {return;}
// Only one column should hold the tree view
// Thus if multiple columns are provided with
Function columnCssClasses
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
@HostBinding('class')
get columnCssClasses(): any {
let cls = 'datatable-body-cell';
if (this.column.cellClass) {
if (typeof this.column.cellClass === 'string') {
Function selectRowsBetween
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
export function selectRowsBetween(
selected: any[],
rows: any[],
index: number,
prevIndex: number,
- Read upRead up
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 groupRowsByParents
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
export function groupRowsByParents(rows: any[], from?: OptionalValueGetter, to?: OptionalValueGetter): any[] {
if (from && to) {
const nodeById = {};
const l = rows.length;
let node: TreeNode | null = null;
- Read upRead up
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 translateTemplates
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
export function translateTemplates(templates: DataTableColumnDirective[]): any[] {
const result: any[] = [];
for (const temp of templates) {
const col: any = {};
- Read upRead up
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 forceFillColumnWidths
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
export function forceFillColumnWidths(
allColumns: any[],
expectedWidth: number,
startIdx: number,
allowBleed: boolean,
Function updateRows
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
updateRows(): void {
const { first, last } = this.indexes;
let rowIndex = first;
let idx = 0;
const temp: any[] = [];
Function getRowsStyles
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
getRowsStyles(rows: any, index = 0): any {
const styles: any = {};
// only add styles for the group if there is a group
if (this.groupedRows) {
- Read upRead up
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 updatePage
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
updatePage(direction: string): void {
let offset = this.indexes.first / this.pageSize;
const scrollInBetween = !Number.isInteger(offset);
if (direction === 'up') {
offset = Math.ceil(offset);
- Read upRead up
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 groupRowsByParents
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
export function groupRowsByParents(rows: any[], from?: OptionalValueGetter, to?: OptionalValueGetter): any[] {
if (from && to) {
const nodeById = {};
const l = rows.length;
let node: TreeNode | null = null;
Function sortRows
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
export function sortRows(rows: any[], columns: any[], dirs: SortPropDir[]): any[] {
if (!rows) {return [];}
if (!dirs || !dirs.length || !columns) {return [...rows];}
/**
Function initCache
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
initCache(details: any): void {
const { rows, rowHeight, detailRowHeight, externalVirtual, rowCount, rowIndexes, rowExpansions } = details;
const isFn = typeof rowHeight === 'function';
const isDetailFn = typeof detailRowHeight === 'function';
Function exports
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
module.exports = function (config) {
config.set({
basePath: '',
frameworks: ['jasmine', '@angular-devkit/build-angular'],
plugins: [
Function onColumnReorder
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
onColumnReorder({ column, newValue, prevValue }: any): void {
const cols = this._internalColumns.map(c => ({ ...c }));
if (this.swapColumns) {
const prevCol = cols[newValue];
- Read upRead up
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 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
selectRow(event: KeyboardEvent | MouseEvent, index: number, row: any): void {
if (!this.selectEnabled) {return;}
const chkbox = this.selectionType === SelectionType.checkbox;
const multi = this.selectionType === SelectionType.multi;
Function throttle
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
export function throttle(func: any, wait: number, options?: any) {
options = options || {};
let context: any;
let args: any;
let result: any;