swimlane/angular2-data-table

View on GitHub

Showing 79 of 79 total issues

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

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 = ({ currentValue, previousValue }: 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 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

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

  getPrevNextRow(rowElement: any, keyCode: number): any {
    const parentElement = rowElement.parentElement;

    if (parentElement) {
      let focusElement: HTMLElement;

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 too many return statements within this function.
Open

    if (parseFloat(a) < parseFloat(b)) return -1;
Severity: Major
Found in projects/swimlane/ngx-datatable/src/lib/utils/sort.ts - About 30 mins to fix

    Avoid too many return statements within this function.
    Open

      return current;
    Severity: Major
    Found in projects/swimlane/ngx-datatable/src/lib/utils/column-prop-getters.ts - About 30 mins to fix

      Avoid too many return statements within this function.
      Open

          return undefined;
      Severity: Major
      Found in projects/swimlane/ngx-datatable/src/lib/utils/sort.ts - About 30 mins to fix

        Avoid too many return statements within this function.
        Open

            return this.count;

          Avoid too many return statements within this function.
          Open

              if (parseFloat(a) > parseFloat(b)) return 1;
          Severity: Major
          Found in projects/swimlane/ngx-datatable/src/lib/utils/sort.ts - About 30 mins to fix

            Avoid too many return statements within this function.
            Open

              return 0;
            Severity: Major
            Found in projects/swimlane/ngx-datatable/src/lib/utils/sort.ts - About 30 mins to fix

              Avoid too many return statements within this function.
              Open

                    return undefined;
              Severity: Major
              Found in projects/swimlane/ngx-datatable/src/lib/utils/sort.ts - About 30 mins to fix

                Function elementText has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                Open

                function elementText(n: any): string {
                  if (n instanceof Array) {
                    return n.map(elementText).join('');
                  }
                
                
                Severity: Minor
                Found in projects/swimlane/ngx-datatable/src/lib/test/jasmine-matchers.ts - About 25 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 6 (exceeds 5 allowed). Consider refactoring.
                Open

                  onHeaderSelect(event: any): 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;

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

                export function getterForProp(prop: TableColumnProp): ValueGetter {
                  if (prop == null) {
                    return emptyStringGetter;
                  }
                
                
                Severity: Minor
                Found in projects/swimlane/ngx-datatable/src/lib/utils/column-prop-getters.ts - About 25 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 isTarget has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                Open

                  isTarget(model: any, event: any): any {
                    let i = 0;
                    const x = event.x || event.clientX;
                    const y = event.y || event.clientY;
                    const targets = this.document.elementsFromPoint(x, y);

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

                export function translateXY(styles: any, x: number, y: number) {
                  if (typeof transform !== 'undefined' && hasCSSTransforms) {
                    if (!isSafari && hasCSS3DTransforms) {
                      styles[transform] = `translate3d(${x}px, ${y}px, 0)`;
                      styles[backfaceVisibility] = 'hidden';
                Severity: Minor
                Found in projects/swimlane/ngx-datatable/src/lib/utils/translate.ts - About 25 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 flatten has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                Open

                  flatten(f: any, recursive: boolean) {
                    if (this.row['treeStatus'] === 'expanded') {
                      for (let i = 0, l = this.children.length; i < l; i++) {
                        const child = this.children[i];
                        f.apply(child, Array.prototype.slice.call(arguments, 2));
                Severity: Minor
                Found in projects/swimlane/ngx-datatable/src/lib/utils/tree.ts - About 25 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 calcPages has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                Open

                  calcPages(page?: number): any[] {
                    const pages = [];
                    let startPage = 1;
                    let endPage = this.totalPages;
                    const maxSize = 5;

                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