mariuszfoltak/angular2-datatable

View on GitHub

Showing 4 of 8 total issues

File DataTable.spec.ts has 390 lines of code (exceeds 250 allowed). Consider refactoring.
Open

///<reference path="../node_modules/@types/jasmine/index.d.ts"/>
import {SimpleChange, Component} from "@angular/core";
import {DataTable, PageEvent, SortEvent} from "./DataTable";
import {TestBed, ComponentFixture} from "@angular/core/testing";
import {By} from "@angular/platform-browser";
Severity: Minor
Found in src/DataTable.spec.ts - About 5 hrs to fix

    Function exports has 100 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    module.exports = function (config) {
    
        var appBase = 'lib/';       // transpiled app JS and map files
        var appSrcBase = 'src/';       // app source TS files
        var appAssets = '/base/lib/'; // component assets fetched by Angular's compiler
    Severity: Major
    Found in karma.conf.js - About 4 hrs to fix

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

          public ngOnChanges(changes: {[key: string]: SimpleChange}): any {
              if (changes["rowsOnPage"]) {
                  this.rowsOnPage = changes["rowsOnPage"].previousValue;
                  this.setPage(this.activePage, changes["rowsOnPage"].currentValue);
                  this.mustRecalculateData = true;
      Severity: Minor
      Found in src/DataTable.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 setPage has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

          public setPage(activePage: number, rowsOnPage: number): void {
              if (this.rowsOnPage !== rowsOnPage || this.activePage !== activePage) {
                  this.activePage = this.activePage !== activePage ? activePage : this.calculateNewActivePage(this.rowsOnPage, rowsOnPage);
                  this.rowsOnPage = rowsOnPage;
                  this.mustRecalculateData = true;
      Severity: Minor
      Found in src/DataTable.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

      Severity
      Category
      Status
      Source
      Language