siemens/ngx-datatable

View on GitHub

Showing 89 of 89 total issues

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

Function selectRow has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
Open

  selectRow(event: KeyboardEvent | MouseEvent, index: number, row: any): void {
    if (!this.selectEnabled) {return;}

    const chkbox = this.selectionType === SelectionType.checkbox;
    const multi = this.selectionType === SelectionType.multi;

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

Function setColumnDefaults has 43 lines of code (exceeds 25 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 1 hr to fix

    Function columnCssClasses has 40 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 selectRowsBetween has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
      Open

      export function selectRowsBetween(
        selected: any[],
        rows: any[],
        index: number,
        prevIndex: number,
      Severity: Minor
      Found in projects/ngx-datatable/src/lib/utils/selection.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 groupRowsByParents has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
      Open

      export function groupRowsByParents(rows: any[], from?: OptionalValueGetter, to?: OptionalValueGetter): any[] {
        if (from && to) {
          const nodeById = {};
          const l = rows.length;
          let node: TreeNode | null = null;
      Severity: Minor
      Found in projects/ngx-datatable/src/lib/utils/tree.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 translateTemplates has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
      Open

      export function translateTemplates(templates: DataTableColumnDirective[]): any[] {
        const result: any[] = [];
        for (const temp of templates) {
          const col: any = {};
      
      
      Severity: Minor
      Found in projects/ngx-datatable/src/lib/utils/column-helper.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 forceFillColumnWidths has 39 lines of code (exceeds 25 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 1 hr to fix

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

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

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

          Function groupRowsByParents has 34 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          export function groupRowsByParents(rows: any[], from?: OptionalValueGetter, to?: OptionalValueGetter): any[] {
            if (from && to) {
              const nodeById = {};
              const l = rows.length;
              let node: TreeNode | null = null;
          Severity: Minor
          Found in projects/ngx-datatable/src/lib/utils/tree.ts - About 1 hr to fix

            Function sortRows has 34 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            export function sortRows(rows: any[], columns: any[], dirs: SortPropDir[]): any[] {
              if (!rows) {return [];}
              if (!dirs || !dirs.length || !columns) {return [...rows];}
            
              /**
            Severity: Minor
            Found in projects/ngx-datatable/src/lib/utils/sort.ts - About 1 hr to fix

              Function initCache has 33 lines of code (exceeds 25 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/ngx-datatable/src/lib/utils/row-height-cache.ts - About 1 hr to fix

                Function exports has 33 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                module.exports = function (config) {
                  config.set({
                    basePath: '',
                    frameworks: ['jasmine', '@angular-devkit/build-angular'],
                    plugins: [
                Severity: Minor
                Found in projects/ngx-datatable/karma.conf.js - About 1 hr to fix

                  Function onColumnReorder has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                  Open

                    onColumnReorder({ column, newValue, prevValue }: any): void {
                      const cols = this._internalColumns.map(c => ({ ...c }));
                  
                      if (this.swapColumns) {
                        const prevCol = cols[newValue];
                  Severity: Minor
                  Found in projects/ngx-datatable/src/lib/components/datatable.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

                  Function selectRow has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                    selectRow(event: KeyboardEvent | MouseEvent, index: number, row: any): void {
                      if (!this.selectEnabled) {return;}
                  
                      const chkbox = this.selectionType === SelectionType.checkbox;
                      const multi = this.selectionType === SelectionType.multi;

                    Function throttle has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                    export function throttle(func: any, wait: number, options?: any) {
                      options = options || {};
                      let context: any;
                      let args: any;
                      let result: any;
                    Severity: Minor
                    Found in projects/ngx-datatable/src/lib/utils/throttle.ts - About 1 hr to fix
                      Severity
                      Category
                      Status
                      Source
                      Language