swimlane/angular2-data-table

View on GitHub

Showing 79 of 79 total issues

Function cssClass has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
Open

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

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

export function setColumnDefaults(columns: TableColumn[]) {
  if (!columns) return;

  // Only one column should hold the tree view
  // Thus if multiple columns are provided with
Severity: Minor
Found in projects/swimlane/ngx-datatable/src/lib/utils/column-helper.ts - About 1 hr to fix

    Function selectRowsBetween has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
    Open

    export function selectRowsBetween(
      selected: any[],
      rows: any[],
      index: number,
      prevIndex: number,
    Severity: Minor
    Found in projects/swimlane/ngx-datatable/src/lib/utils/selection.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 groupRowsByParents has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
    Open

    export function groupRowsByParents(rows: any[], from?: OptionalValueGetter, to?: OptionalValueGetter): any[] {
      if (from && to) {
        const nodeById = {};
        const l = rows.length;
        let node: TreeNode | null = null;
    Severity: Minor
    Found in projects/swimlane/ngx-datatable/src/lib/utils/tree.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 forceFillColumnWidths has 38 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    export function forceFillColumnWidths(
      allColumns: any[],
      expectedWidth: number,
      startIdx: number,
      allowBleed: boolean,
    Severity: Minor
    Found in projects/swimlane/ngx-datatable/src/lib/utils/math.ts - About 1 hr to fix

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

        @HostBinding('class')
        get columnCssClasses(): any {
          let cls = 'datatable-body-cell';
          if (this.column.cellClass) {
            if (typeof this.column.cellClass === 'string') {

        Function sortRows has 34 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        export function sortRows(rows: any[], columns: any[], dirs: SortPropDir[]): any[] {
          if (!rows) return [];
          if (!dirs || !dirs.length || !columns) return [...rows];
        
          /**
        Severity: Minor
        Found in projects/swimlane/ngx-datatable/src/lib/utils/sort.ts - About 1 hr to fix

          Function groupRowsByParents has 34 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          export function groupRowsByParents(rows: any[], from?: OptionalValueGetter, to?: OptionalValueGetter): any[] {
            if (from && to) {
              const nodeById = {};
              const l = rows.length;
              let node: TreeNode | null = null;
          Severity: Minor
          Found in projects/swimlane/ngx-datatable/src/lib/utils/tree.ts - About 1 hr to fix

            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 exports has 33 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 projects/swimlane/ngx-datatable/karma.conf.js - About 1 hr to fix

                Function initCache has 33 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                  initCache(details: any): void {
                    const { rows, rowHeight, detailRowHeight, externalVirtual, rowCount, rowIndexes, rowExpansions } = details;
                    const isFn = typeof rowHeight === 'function';
                    const isDetailFn = typeof detailRowHeight === 'function';
                
                
                Severity: Minor
                Found in projects/swimlane/ngx-datatable/src/lib/utils/row-height-cache.ts - About 1 hr to fix

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

                  export function translateTemplates(templates: DataTableColumnDirective[]): any[] {
                    const result: any[] = [];
                    for (const temp of templates) {
                      const col: any = {};
                  
                  
                  Severity: Minor
                  Found in projects/swimlane/ngx-datatable/src/lib/utils/column-helper.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 onColumnReorder has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                  Open

                    onColumnReorder({ column, newValue, prevValue }: any): void {
                      const cols = this._internalColumns.map(c => {
                        return { ...c };
                      });
                  
                  

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

                  function scaleColumns(colsByGroup: any, maxWidth: any, totalFlexGrow: any) {
                    // calculate total width and flexgrow points for coulumns that can be resized
                    for (const attr in colsByGroup) {
                      for (const column of colsByGroup[attr]) {
                        if (!column.canAutoResize) {
                  Severity: Minor
                  Found in projects/swimlane/ngx-datatable/src/lib/utils/math.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/swimlane/ngx-datatable/src/lib/utils/throttle.ts - About 1 hr to fix

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

                        onColumnReorder({ column, newValue, prevValue }: any): void {
                          const cols = this._internalColumns.map(c => {
                            return { ...c };
                          });
                      
                      

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

                          focusCell(cellElement: any, rowElement: any, keyCode: number, cellIndex: number): void {
                            let nextCellElement: HTMLElement;
                        
                            if (keyCode === Keys.left) {
                              nextCellElement = cellElement.previousElementSibling;

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

                          selectRow(event: KeyboardEvent | MouseEvent, index: number, row: any): void {
                            if (!this.selectEnabled) return;
                        
                            const chkbox = this.selectionType === SelectionType.checkbox;
                            const multi = this.selectionType === SelectionType.multi;

                        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
                          Severity
                          Category
                          Status
                          Source
                          Language