Showing 13 of 40 total issues
Function ngAfterViewInit
has 42 lines of code (exceeds 25 allowed). Consider refactoring. Open
public ngAfterViewInit() {
super.ngAfterViewInit();
this.addMarker();
this.startVehicleUpdater();
const ourCustomControl = L.Control.extend({
Function addMarker
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
public addMarker(): void {
this.updateObservable = this.vehicleLocationSubject
.pipe(map((loc: ITimestampVehicleLocation) => loc.vehicle))
.subscribe((location) => {
if (this.stopMarkerLayer) {
Function setVehicles
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
public setVehicles(vehicles: IVehicleLocationList): void {
if (this.vehicleMarkerLayer !== undefined) {
this.vehicleMarkerLayer.clearLayers();
} else {
this.vehicleMarkerLayer = L.featureGroup();
- 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 start
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
public start(): void {
if (this.subscription && !this.subscription.closed) {
return;
}
this.subscription = this.updateSubject
- 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 ngAfterViewInit
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
public ngAfterViewInit(): void {
this.mTimerObservable = timer(this.tickInterval, this.tickInterval);
this.mTimerObservable.subscribe((tick: number) => {
const ticksLeft: number = this.ticksToRefresh - (tick % this.ticksToRefresh);
const diff: number = Math.round((ticksLeft * this.tickInterval) / 1000);
Function onAdd
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
onAdd: () => {
const container = L.DomUtil.create('i', 'material-icons leaflet-bar leaflet-control leaflet-control-custom');
container.style.backgroundColor = 'white';
container.style.width = '42px';
container.style.height = '42px';
Function startUpdater
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
public startUpdater(): void {
if (this.updateSubscription) {
return;
}
this.updateSubscription = this.stopLocationSubject
Function addMarker
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
public addMarker() {
this.stopService.stopLocationsObservable
.subscribe((stops: IStopLocation[]) => {
const stopList: L.Marker[] = [];
for (const stop of stops) {
Function exports
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
module.exports = function (config) {
config.set({
basePath: '',
frameworks: ['jasmine', '@angular-devkit/build-angular'],
plugins: [
Function calculateDelay
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
public calculateDelay(data: IDeparture): false | number {
if (data && data.actualTime && data.plannedTime) {
if (data.actualTime !== data.plannedTime) {
const actual: moment.Moment = moment(data.actualTime, 'HH:mm');
const planned: moment.Moment = moment(data.plannedTime, 'HH:mm');
- 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 handleHttpErrorResponse
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public handleHttpErrorResponse(errorResponse: HttpErrorResponse, notificationService: AppNotificationService): void {
// Server or connection error happened
if (this.isClientOffline()) {
// Handle offline error
return notificationService.notify({
- 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 handleError
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
private handleError(err?: any): Observable<any> {
let status: UpdateStatus = UpdateStatus.ERROR;
if (err.status) {
// Http Error
const statusCode: number = err.status;
- 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 startUpdater
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public startUpdater(): void {
if (this.updateSubscription) {
return;
}
this.updateSubscription = this.stopLocationSubject
- 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"