siemens/ngx-datatable

View on GitHub

Showing 96 of 96 total issues

Avoid deeply nested control flow statements.
Open

            if (res[k] === true) {
              cls += ` ${k}`;
            }

    Avoid deeply nested control flow statements.
    Open

                if (group[index].source !== row.source) {
                  if (event.target.value === '0') {
                    // expected payment yes selected
                    group[index].exppayyes = 0;
                    group[index].exppaypending = 0;
    Severity: Major
    Found in src/app/basic/row-grouping.component.ts - About 45 mins to fix

      Avoid deeply nested control flow statements.
      Open

                  if (res[k] === true) {
                    cls += ` ${k}`;
                  }
      Severity: Major
      Found in projects/ngx-datatable/src/lib/components/body/body-cell.component.ts - About 45 mins to fix

        Avoid deeply nested control flow statements.
        Open

                    if (
                      group[index].exppayyes === 0 &&
                      group[index].exppayno === 0 &&
                      group[index].exppaypending === 0
                    ) {
        Severity: Major
        Found in src/app/basic/row-grouping.component.ts - About 45 mins to fix

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

          export function columnsByPin(cols: TableColumn[]) {
            const ret: { left: TableColumn[]; center: TableColumn[]; right: TableColumn[] } = {
              left: [],
              center: [],
              right: []
          Severity: Minor
          Found in projects/ngx-datatable/src/lib/utils/column.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 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 calcNewSorts has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
          Open

            calcNewSorts(
              column: TableColumn,
              prevValue: SortDirection,
              newValue: SortDirection
            ): SortPropDir[] {
          Severity: Minor
          Found in projects/ngx-datatable/src/lib/components/header/header.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

          Avoid deeply nested control flow statements.
          Open

                    if (column.canAutoResize && !hasMinWidth[column.prop]) {
                      const newWidth = column.width + column.flexGrow * widthPerFlexPoint;
                      if (column.minWidth !== undefined && newWidth < column.minWidth) {
                        remainingWidth += newWidth - column.minWidth;
                        column.width = column.minWidth;
          Severity: Major
          Found in projects/ngx-datatable/src/lib/utils/math.ts - About 45 mins to fix

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

            function toHaveText(): jasmine.CustomMatcher {
              return {
                compare(
                  actual: any,
                  expectedText: string,
            Severity: Minor
            Found in projects/ngx-datatable/src/lib/test/jasmine-matchers.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

            Consider simplifying this complex logical expression.
            Open

                if (
                  (delta > 0 && (!col.maxWidth || col.width + delta <= col.maxWidth)) ||
                  (delta < 0 && (!col.minWidth || col.width + delta >= col.minWidth))
                ) {
                  col.width += delta;
            Severity: Major
            Found in projects/ngx-datatable/src/lib/utils/math.ts - About 40 mins to fix

              Function forceFillColumnWidths has 5 arguments (exceeds 4 allowed). Consider refactoring.
              Open

                allColumns: any[],
                expectedWidth: number,
                startIdx: number,
                allowBleed: boolean,
                defaultColWidth: number = 300
              Severity: Minor
              Found in projects/ngx-datatable/src/lib/utils/math.ts - About 35 mins to fix

                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

                Function checkVisibility has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                Open

                export function checkVisibility(element: any, callback: any, zone: NgZone) {
                  let timeout: any;
                
                  function check() {
                    // https://davidwalsh.name/offsetheight-visibility
                Severity: Minor
                Found in projects/ngx-datatable/src/lib/utils/visibility-observer.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

                Function sortInternalRows has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                Open

                  private sortInternalRows(): void {
                    // if there are no sort criteria we reset the rows with original rows
                    if (!this.sorts || !this.sorts?.length) {
                      this._internalRows = this._rows;
                      // if there is any tree relation then re-group rows accordingly
                Severity: Minor
                Found in projects/ngx-datatable/src/lib/components/datatable.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

                Function sortRows has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                Open

                export function sortRows(rows: any[], columns: any[], dirs: SortPropDir[]): any[] {
                  if (!rows) {
                    return [];
                  }
                  if (!dirs || !dirs.length || !columns) {
                Severity: Minor
                Found in projects/ngx-datatable/src/lib/utils/sort.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

                Function calcRowCount has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                Open

                  calcRowCount(): number {
                    if (!this.externalPaging) {
                      if (!this.rows) {
                        return 0;
                      }
                Severity: Minor
                Found in projects/ngx-datatable/src/lib/components/datatable.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

                Function getPrevNextRow has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                Open

                  getPrevNextRow(rowElement: HTMLElement, keyCode: number): any {
                    const parentElement = rowElement.parentElement;
                
                    if (parentElement) {
                      let focusElement: Element;
                Severity: Minor
                Found in projects/ngx-datatable/src/lib/components/body/selection.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

                Function ngDoCheck has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                Open

                  ngDoCheck(): void {
                    const rowDiffers = this.rowDiffer.diff(this.rows);
                    if (rowDiffers || this.disableRowCheck) {
                      if (!this.externalSorting) {
                        this.sortInternalRows();
                Severity: Minor
                Found in projects/ngx-datatable/src/lib/components/datatable.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

                Function updateSubscriptions has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                Open

                  updateSubscriptions(): void {
                    const diffs = this.differ.diff(this.createMapDiffs());
                
                    if (diffs) {
                      const subscribe = (record: KeyValueChangeRecord<string, DraggableDirective>) => {
                Severity: Minor
                Found in projects/ngx-datatable/src/lib/directives/orderable.directive.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

                Function columnTotalWidth has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                Open

                export function columnTotalWidth(columns: any[], prop?: string) {
                  let totalWidth = 0;
                
                  if (columns) {
                    for (const c of columns) {
                Severity: Minor
                Found in projects/ngx-datatable/src/lib/utils/column.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

                Severity
                Category
                Status
                Source
                Language