siemens/ngx-datatable

View on GitHub

Showing 96 of 96 total issues

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

  ngDoCheck(): void {
    if (this.disableCheck) {
      const isRowDisabled = this.disableCheck(this.row);
      if (isRowDisabled !== this.disable$.value) {
        this.disable$.next(isRowDisabled);

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

  focusCell(
    cellElement: HTMLElement,
    rowElement: HTMLElement,
    keyCode: number,
    cellIndex: number

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 recalculateColumns has 31 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  recalculateColumns(
    columns: TableColumn[] = this._internalColumns,
    forceIdx: number = -1,
    allowBleed: boolean = this.scrollbarH
  ): TableColumn[] | undefined {
Severity: Minor
Found in projects/ngx-datatable/src/lib/components/datatable.component.ts - About 1 hr to fix

    Function columnCssClasses has 31 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      @HostBinding('class')
      get columnCssClasses(): string {
        let cls = 'datatable-header-cell';
    
        if (this.column.sortable) {

      Function orderByComparator has 31 lines of code (exceeds 25 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') {
      Severity: Minor
      Found in projects/ngx-datatable/src/lib/utils/sort.ts - About 1 hr to fix

        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

          Function setPage has 28 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            setPage(pageInfo: PageInfo) {
              // Current page number is determined by last call to setPage
              // This is the page the UI is currently displaying
              // The current page is based on the UI pagesize and scroll position
              // Pagesize can change depending on browser size
          Severity: Minor
          Found in src/app/paging/paging-virtual.component.ts - About 1 hr to fix

            Function checkValueUpdates has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
            Open

              checkValueUpdates(): void {
                let value = '';
            
                if (!this.row || !this.column) {
                  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 onActivate has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
            Open

              onActivate(model: Model<TRow>, index: number): void {
                const { type, event, row } = model;
                const chkbox = this.selectionType === SelectionType.checkbox;
                const select =
                  (!chkbox && (type === 'click' || type === 'dblclick')) || (chkbox && type === 'checkbox');

            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 exports has 27 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 karma.conf.js - About 1 hr to fix

              Function cssClass has 27 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

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

                Function onMouseDown has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                  @HostListener('mousedown', ['$event'])
                  onMouseDown(event: MouseEvent): void {
                    // don't do right/middle clicks
                    if (event.which !== 1 || !this.pressEnabled) {
                      return;
                Severity: Minor
                Found in projects/ngx-datatable/src/lib/directives/long-press.directive.ts - About 1 hr to fix

                  Function onColumnReorder has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                    onColumnReorder({ column, newValue, prevValue }: ReorderEvent): 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

                    Consider simplifying this complex logical expression.
                    Open

                        if (
                          group.filter(rowFilter => rowFilter.exppaypending === 1).length === 0 &&
                          group.filter(
                            rowFilter =>
                              rowFilter.exppaypending === 0 && rowFilter.exppayyes === 0 && rowFilter.exppayno === 0
                    Severity: Major
                    Found in src/app/basic/row-grouping.component.ts - About 1 hr to fix

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

                      export function deepValueGetter(obj: any, path: string): any {
                        if (obj == null) {
                          return '';
                        }
                        if (!obj || !path) {
                      Severity: Minor
                      Found in projects/ngx-datatable/src/lib/utils/column-prop-getters.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 onKeyboardFocus has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                      Open

                        onKeyboardFocus(model: Model<TRow>): void {
                          const { keyCode } = model.event as KeyboardEvent;
                          const shouldFocus =
                            keyCode === Keys.up ||
                            keyCode === Keys.down ||
                      Severity: Minor
                      Found in projects/ngx-datatable/src/lib/components/body/selection.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 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 onHeaderSelect has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                      Open

                        onHeaderSelect(): void {
                          if (this.bodyComponent && this.selectAllRowsOnPage) {
                            // before we splice, chk if we currently have all selected
                            const first = this.bodyComponent.indexes.first;
                            const last = this.bodyComponent.indexes.last;
                      Severity: Minor
                      Found in projects/ngx-datatable/src/lib/components/datatable.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 nextSortDir has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                      Open

                      export function nextSortDir(
                        sortType: SortType,
                        current: SortDirection | 'desc' | 'asc'
                      ): SortDirection | undefined {
                        if (sortType === SortType.single) {
                      Severity: Minor
                      Found in projects/ngx-datatable/src/lib/utils/sort.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 onTargetChanged has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                      Open

                        onTargetChanged({ prevIndex, newIndex, initialIndex }: TargetChangedEvent): void {
                          if (prevIndex || prevIndex === 0) {
                            const oldColumn = this.getColumn(prevIndex);
                            oldColumn.isTarget = false;
                            oldColumn.targetMarkerContext = undefined;
                      Severity: Minor
                      Found in projects/ngx-datatable/src/lib/components/header/header.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

                      Severity
                      Category
                      Status
                      Source
                      Language