File body.component.ts
has 714 lines of code (exceeds 250 allowed). Consider refactoring. Open
import {
ChangeDetectionStrategy,
ChangeDetectorRef,
Component,
EventEmitter,
DataTableBodyComponent
has 49 functions (exceeds 20 allowed). Consider refactoring. Open
@Component({
selector: 'datatable-body',
template: `
<ng-container *ngIf="loadingIndicator">
<div class="custom-loading-indicator-wrapper">
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 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 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 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 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 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);
Function offset
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
@Input() set offset(val: number) {
if (val !== this._offset) {
this._offset = val;
if (!this.scrollbarV || (this.scrollbarV && !this.virtualization)) {
if (!isNaN(this._offset) && this.ghostLoadingIndicator) {
- 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 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
Function updateIndexes
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
updateIndexes(): void {
let first = 0;
let last = 0;
if (this.scrollbarV) {
- 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"