siemens/ngx-datatable

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

Summary

Maintainability
F
3 days
Test Coverage

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

    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

      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 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 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 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 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 ngOnInit has 26 lines of code (exceeds 25 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

          Function offset has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
          Open

            @Input() set offset(val: number) {
              if (val !== this._offset) {
                this._offset = val;
                if (!this.scrollbarV || (this.scrollbarV && !this.virtualization)) {
                  if (!isNaN(this._offset) && this.ghostLoadingIndicator) {
          Severity: Minor
          Found in projects/ngx-datatable/src/lib/components/body/body.component.ts - About 55 mins 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 refreshRowHeightCache has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
          Open

            refreshRowHeightCache(): void {
              if (!this.scrollbarV || (this.scrollbarV && !this.virtualization)) {
                return;
              }
          
          
          Severity: Minor
          Found in projects/ngx-datatable/src/lib/components/body/body.component.ts - About 45 mins 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 updateIndexes has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
          Open

            updateIndexes(): void {
              let first = 0;
              let last = 0;
          
              if (this.scrollbarV) {
          Severity: Minor
          Found in projects/ngx-datatable/src/lib/components/body/body.component.ts - About 35 mins 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

          There are no issues that match your filters.

          Category
          Status