swimlane/angular2-data-table

View on GitHub

Showing 79 of 79 total issues

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

import {
  Component,
  Input,
  Output,
  ElementRef,

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

    import {
      Component,
      Output,
      EventEmitter,
      Input,

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

      @Component({
        selector: 'ngx-datatable',
        templateUrl: './datatable.component.html',
        changeDetection: ChangeDetectionStrategy.OnPush,
        encapsulation: ViewEncapsulation.None,

        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 41 functions (exceeds 20 allowed). Consider refactoring.
        Open

        @Component({
          selector: 'datatable-body',
          template: `
            <datatable-progress *ngIf="loadingIndicator"> </datatable-progress>
            <datatable-selection

          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 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/swimlane/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

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

              function scaleColumns(colsByGroup: any, maxWidth: any, totalFlexGrow: any) {
                // calculate total width and flexgrow points for coulumns that can be resized
                for (const attr in colsByGroup) {
                  for (const column of colsByGroup[attr]) {
                    if (!column.canAutoResize) {
              Severity: Minor
              Found in projects/swimlane/ngx-datatable/src/lib/utils/math.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 325 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';

                Function checkGroup has 74 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 2 hrs to fix

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

                  import {
                    Component,
                    Output,
                    EventEmitter,
                    Input,

                    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 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/swimlane/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/swimlane/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 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

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

                    @Component({
                      selector: 'datatable-header',
                      template: `
                        <div
                          role="row"

                      Function initCache has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
                      Open

                        initCache(details: any): void {
                          const { rows, rowHeight, detailRowHeight, externalVirtual, rowCount, rowIndexes, rowExpansions } = details;
                          const isFn = typeof rowHeight === 'function';
                          const isDetailFn = typeof detailRowHeight === 'function';
                      
                      
                      Severity: Minor
                      Found in projects/swimlane/ngx-datatable/src/lib/utils/row-height-cache.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

                      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);

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

                        @HostBinding('class')
                        get cssClass() {
                          let cls = 'datatable-body-row';
                          if (this.isSelected) {
                            cls += ' active';

                      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