swimlane/ngx-datatable

View on GitHub
projects/swimlane/ngx-datatable/src/lib/components/body/body-cell.component.ts

Summary

Maintainability
D
1 day
Test Coverage

DataTableBodyCellComponent has 37 functions (exceeds 20 allowed). Consider refactoring.
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

    import {
      Component,
      Input,
      PipeTransform,
      HostBinding,

      Function columnCssClasses has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
      Open

        @HostBinding('class')
        get columnCssClasses(): any {
          let cls = 'datatable-body-cell';
          if (this.column.cellClass) {
            if (typeof this.column.cellClass === 'string') {

      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

        @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

          checkValueUpdates(): void {
            let value = '';
        
            if (!this.row || !this.column) {
              value = '';

        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}`;
                    }

          There are no issues that match your filters.

          Category
          Status