siemens/ngx-datatable

View on GitHub

Showing 89 of 89 total issues

File body.component.ts has 714 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import {
  ChangeDetectionStrategy,
  ChangeDetectorRef,
  Component,
  EventEmitter,
Severity: Major
Found in projects/ngx-datatable/src/lib/components/body/body.component.ts - About 1 day to fix

    File datatable.component.ts has 634 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    import {
      AfterContentInit,
      AfterViewInit,
      ChangeDetectionStrategy,
      ChangeDetectorRef,
    Severity: Major
    Found in projects/ngx-datatable/src/lib/components/datatable.component.ts - About 1 day to fix

      DatatableComponent has 58 functions (exceeds 20 allowed). Consider refactoring.
      Open

      @Component({
        selector: 'ngx-datatable',
        templateUrl: './datatable.component.html',
        changeDetection: ChangeDetectionStrategy.OnPush,
        // eslint-disable-next-line @angular-eslint/use-component-view-encapsulation
      Severity: Major
      Found in projects/ngx-datatable/src/lib/components/datatable.component.ts - About 1 day to fix

        Function scaleColumns has a Cognitive Complexity of 50 (exceeds 5 allowed). Consider refactoring.
        Open

        function scaleColumns(colsByGroup: any, maxWidth: any, totalFlexGrow: any) {
          // calculate total width and flexgrow points for columns that can be resized
          for (const attr in colsByGroup) {
            if (colsByGroup.hasOwnProperty(attr)) {
              for (const column of colsByGroup[attr]) {
        Severity: Minor
        Found in projects/ngx-datatable/src/lib/utils/math.ts - About 7 hrs to fix

        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 checkGroup has a Cognitive Complexity of 48 (exceeds 5 allowed). Consider refactoring.
        Open

          checkGroup(event, row, rowIndex, group) {
            let groupStatus = 'Pending';
            let expectedPaymentDealtWith = true;
        
            row.exppayyes = 0;
        Severity: Minor
        Found in src/app/basic/row-grouping.component.ts - About 7 hrs to fix

        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

        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">
        Severity: Minor
        Found in projects/ngx-datatable/src/lib/components/body/body.component.ts - About 6 hrs to fix

          File body-cell.component.ts has 390 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          import {
            ChangeDetectionStrategy,
            ChangeDetectorRef,
            Component,
            DoCheck,
          Severity: Minor
          Found in projects/ngx-datatable/src/lib/components/body/body-cell.component.ts - About 5 hrs to fix

            DataTableBodyCellComponent has 39 functions (exceeds 20 allowed). Consider refactoring.
            Open

            @Component({
              selector: 'datatable-body-cell',
              changeDetection: ChangeDetectionStrategy.OnPush,
              template: `
              <ng-container *ngIf="row else ghostLoaderTemplate;">
            Severity: Minor
            Found in projects/ngx-datatable/src/lib/components/body/body-cell.component.ts - About 5 hrs to fix

              Function setColumnDefaults has a Cognitive Complexity of 31 (exceeds 5 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
              Severity: Minor
              Found in projects/ngx-datatable/src/lib/utils/column-helper.ts - About 4 hrs to fix

              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

              File datatable.component.spec.ts has 319 lines of code (exceeds 250 allowed). Consider refactoring.
              Open

              import { Component } from '@angular/core';
              import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing';
              import { By } from '@angular/platform-browser';
              
              import { ColumnChangesService } from '../services/column-changes.service';
              Severity: Minor
              Found in projects/ngx-datatable/src/lib/components/datatable.component.spec.ts - About 3 hrs to fix

                Function columnCssClasses has a Cognitive Complexity of 23 (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') {
                Severity: Minor
                Found in projects/ngx-datatable/src/lib/components/body/body-cell.component.ts - About 3 hrs to fix

                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

                File header.component.ts has 297 lines of code (exceeds 250 allowed). Consider refactoring.
                Open

                import {
                  ChangeDetectionStrategy,
                  ChangeDetectorRef,
                  Component,
                  EventEmitter,
                Severity: Minor
                Found in projects/ngx-datatable/src/lib/components/header/header.component.ts - About 3 hrs to fix

                  Function checkGroup has 76 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                    checkGroup(event, row, rowIndex, group) {
                      let groupStatus = 'Pending';
                      let expectedPaymentDealtWith = true;
                  
                      row.exppayyes = 0;
                  Severity: Major
                  Found in src/app/basic/row-grouping.component.ts - About 3 hrs to fix

                    DataTableHeaderComponent has 25 functions (exceeds 20 allowed). Consider refactoring.
                    Open

                    @Component({
                      selector: 'datatable-header',
                      template: `
                        <div
                          role="row"
                    Severity: Minor
                    Found in projects/ngx-datatable/src/lib/components/header/header.component.ts - About 2 hrs to fix

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

                        @HostBinding('class')
                        get columnCssClasses(): any {
                          let cls = 'datatable-header-cell';
                      
                          if (this.column.sortable) {cls += ' sortable';}

                      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 a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
                      Open

                      export function forceFillColumnWidths(
                        allColumns: any[],
                        expectedWidth: number,
                        startIdx: number,
                        allowBleed: boolean,
                      Severity: Minor
                      Found in projects/ngx-datatable/src/lib/utils/math.ts - About 2 hrs to fix

                      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 orderByComparator has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
                      Open

                      export function orderByComparator(a: any, b: any): number {
                        if (a === null || typeof a === 'undefined') {a = 0;}
                        if (b === null || typeof b === 'undefined') {b = 0;}
                        if (a instanceof Date && b instanceof Date) {
                          if (a < b) {return -1;}
                      Severity: Minor
                      Found in projects/ngx-datatable/src/lib/utils/sort.ts - About 2 hrs to fix

                      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 scaleColumns has 57 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                      function scaleColumns(colsByGroup: any, maxWidth: any, totalFlexGrow: any) {
                        // calculate total width and flexgrow points for columns that can be resized
                        for (const attr in colsByGroup) {
                          if (colsByGroup.hasOwnProperty(attr)) {
                            for (const column of colsByGroup[attr]) {
                      Severity: Major
                      Found in projects/ngx-datatable/src/lib/utils/math.ts - About 2 hrs to fix

                        Function cssClass has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
                        Open

                          @HostBinding('class')
                          get cssClass() {
                            let cls = 'datatable-body-row';
                            if (this.isSelected) {
                              cls += ' active';
                        Severity: Minor
                        Found in projects/ngx-datatable/src/lib/components/body/body-row.component.ts - About 2 hrs to fix

                        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[] = [];
                        Severity: Minor
                        Found in projects/ngx-datatable/src/lib/components/body/body.component.ts - About 1 hr to fix

                        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

                        Severity
                        Category
                        Status
                        Source
                        Language