Showing 79 of 79 total issues
Function ngOnInit
has 26 lines of code (exceeds 25 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);
Consider simplifying this complex logical expression. Open
if (
group.filter(rowFilter => rowFilter.exppaypending === 1).length === 0 &&
group.filter(rowFilter => rowFilter.exppaypending === 0 && rowFilter.exppayyes === 0 && rowFilter.exppayno === 0)
.length === 0
) {
Function nextSortDir
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
export function nextSortDir(sortType: SortType, current: SortDirection): SortDirection | undefined {
if (sortType === SortType.single) {
if (current === SortDirection.asc) {
return SortDirection.desc;
} else {
- 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 onTargetChanged
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
onTargetChanged({ prevIndex, newIndex, initialIndex }: any): void {
if (prevIndex || prevIndex === 0) {
const oldColumn = this.getColumn(prevIndex);
oldColumn.isTarget = false;
oldColumn.targetMarkerContext = undefined;
- 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 deepValueGetter
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
export function deepValueGetter(obj: any, path: string): any {
if (obj == null) {
return '';
}
if (!obj || !path) {
- 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
Avoid deeply nested control flow statements. Open
if (column.minWidth !== undefined && newWidth < column.minWidth) {
remainingWidth += newWidth - column.minWidth;
column.width = column.minWidth;
hasMinWidth[column.prop] = true;
} else {
Avoid deeply nested control flow statements. Open
if (res[k] === true) cls += ` ${k}`;
Function onActivate
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
onActivate(model: Model, index: number): void {
const { type, event, row } = model;
const chkbox = this.selectionType === SelectionType.checkbox;
const select = (!chkbox && (type === 'click' || type === 'dblclick')) || (chkbox && type === 'checkbox');
- 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 columnsByPin
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
export function columnsByPin(cols: any[]) {
const ret: { left: any; center: any; right: any } = {
left: [],
center: [],
right: []
- 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
Avoid deeply nested control flow statements. Open
if (res[k] === true) {
cls += ` ${k}`;
}
Function calcNewSorts
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
calcNewSorts(column: any, prevValue: number, newValue: number): any[] {
let idx = 0;
if (!this.sorts) {
this.sorts = [];
- 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
Avoid deeply nested control flow statements. Open
if (group[index].source !== row.source) {
if (event.target.value === '0') {
// expected payment yes selected
group[index].exppayyes = 0;
group[index].exppaypending = 0;
Function refreshRowHeightCache
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
refreshRowHeightCache(): void {
if (!this.scrollbarV || (this.scrollbarV && !this.virtualization)) {
return;
}
- 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
Avoid deeply nested control flow statements. Open
if (group[index].exppayyes === 0 && group[index].exppayno === 0 && group[index].exppaypending === 0) {
expectedPaymentDealtWith = false;
}
Function toHaveText
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
function toHaveText(): jasmine.CustomMatcher {
return {
compare(actual: any, expectedText: string, expectationFailOutput?: any): jasmine.CustomMatcherResult {
const actualText = elementText(actual);
const pass = actualText.indexOf(expectedText) > -1;
- 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 getRowsStyles
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
getRowsStyles(rows: any): 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 forceFillColumnWidths
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
allColumns: any[],
expectedWidth: number,
startIdx: number,
allowBleed: boolean,
defaultColWidth: number = 300
Function selectRowsBetween
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
selected: any[],
rows: any[],
index: number,
prevIndex: number,
comparefn: any
Function calcRowCount
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
calcRowCount(val: any[] = this.rows): number {
if (!this.externalPaging) {
if (!val) return 0;
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 sortRows
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
export function sortRows(rows: any[], columns: any[], dirs: SortPropDir[]): any[] {
if (!rows) return [];
if (!dirs || !dirs.length || !columns) return [...rows];
/**
- 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"