projects/swimlane/ngx-datatable/src/lib/components/body/body-cell.component.ts
DataTableBodyCellComponent
has 37 functions (exceeds 20 allowed). Consider refactoring. Open
Open
@Component({
selector: 'datatable-body-cell',
changeDetection: ChangeDetectionStrategy.OnPush,
template: `
<div class="datatable-body-cell-label" [style.margin-left.px]="calcLeftMargin(column, row)">
File body-cell.component.ts
has 367 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
import {
Component,
Input,
PipeTransform,
HostBinding,
Function columnCssClasses
has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring. Open
Open
@HostBinding('class')
get columnCssClasses(): any {
let cls = 'datatable-body-cell';
if (this.column.cellClass) {
if (typeof this.column.cellClass === 'string') {
- 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 columnCssClasses
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
@HostBinding('class')
get columnCssClasses(): any {
let cls = 'datatable-body-cell';
if (this.column.cellClass) {
if (typeof this.column.cellClass === 'string') {
Function checkValueUpdates
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
Open
checkValueUpdates(): void {
let value = '';
if (!this.row || !this.column) {
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
Avoid deeply nested control flow statements. Open
Open
if (res[k] === true) {
cls += ` ${k}`;
}