demo/app.component.ts
File app.component.ts
has 635 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
declare var APP_VERSION: string;
import { Component, OnInit, ViewEncapsulation } from '@angular/core';
import { Location, LocationStrategy, HashLocationStrategy } from '@angular/common';
import * as shape from 'd3-shape';
AppComponent
has 42 functions (exceeds 20 allowed). Consider refactoring. Open
Open
@Component({
selector: 'app',
providers: [Location, { provide: LocationStrategy, useClass: HashLocationStrategy }],
encapsulation: ViewEncapsulation.None,
styleUrls: ['../node_modules/@swimlane/ngx-ui/index.css', './app.component.scss'],
Function updateData
has 98 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
updateData() {
if (!this.realTimeData) {
return;
}
Function updateData
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
Open
updateData() {
if (!this.realTimeData) {
return;
}
- Read upRead up
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 getCalendarData
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
getCalendarData(): any[] {
// today
const now = new Date();
const todaysDay = now.getDate();
const thisDay = new Date(now.getFullYear(), now.getMonth(), todaysDay);
Function calcStatusData
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
calcStatusData(sales = this.statusData[0].value, dur = this.statusData[2].value) {
const ret = sales * this.salePrice;
const cost = ((sales * dur) / 60 / 60 / 1000) * this.personnelCost;
const ROI = (ret - cost) / cost;
return [
Function getCalendarData
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
Open
getCalendarData(): any[] {
// today
const now = new Date();
const todaysDay = now.getDate();
const thisDay = new Date(now.getFullYear(), now.getMonth(), todaysDay);
- Read upRead up
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"