swimlane/ngx-datatable

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

Summary

Maintainability
D
2 days
Test Coverage

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

import {
  Component,
  Output,
  EventEmitter,
  Input,

    DataTableBodyComponent has 41 functions (exceeds 20 allowed). Consider refactoring.
    Open

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

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

        updateRows(): void {
          const { first, last } = this.indexes;
          let rowIndex = first;
          let idx = 0;
          const temp: any[] = [];

      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 34 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[] = [];

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

          Function refreshRowHeightCache has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
          Open

            refreshRowHeightCache(): void {
              if (!this.scrollbarV || (this.scrollbarV && !this.virtualization)) {
                return;
              }
          
          

          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 8 (exceeds 5 allowed). Consider refactoring.
          Open

            getRowsStyles(rows: any): any {
              const styles: any = {};
          
              // only add styles for the group if there is a group
              if (this.groupedRows) {

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

          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