src/app/lore/engine/engine.service.ts
File engine.service.ts
has 537 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
import { Injectable } from '@angular/core';
import { denormalize } from '@app/function';
import { Actor, Lore, Planet, Vector3Serializable } from '@app/model/data';
import { tweenMap } from '@app/operator/tween-map.operator';
EngineService
has 32 functions (exceeds 20 allowed). Consider refactoring. Open
Open
@Injectable()
export class EngineService {
/**
* These subscriptions are for ensuring the side effects are happening always, even when there are no other subscirbers end the listeners
* (Since they are shared, side effects will only happen once)
Function pan
has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring. Open
Open
public pan(coord: Vector2, velocity: Vector2, button: number, start: boolean, end: boolean) {
// this.control.enabled = this.interactionMode === 'move';
this.raycaster.setFromCamera(coord, this.stage.camera);
const intersections = this.raycaster.intersectObject(this.globe, true);
const intersectionsFiltered = intersections.filter(i => i.object.type === 'Globe' || i.object.type === 'Point'); // Ignoring arcs
- 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 initializePostprocessing
has 71 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
private initializePostprocessing(): void {
// PostProcessing
this.composer = new EffectComposer(this.renderer, {
stencilBuffer: true
Function pan
has 62 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public pan(coord: Vector2, velocity: Vector2, button: number, start: boolean, end: boolean) {
// this.control.enabled = this.interactionMode === 'move';
this.raycaster.setFromCamera(coord, this.stage.camera);
const intersections = this.raycaster.intersectObject(this.globe, true);
const intersectionsFiltered = intersections.filter(i => i.object.type === 'Globe' || i.object.type === 'Point'); // Ignoring arcs
Function createScene
has 51 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public createScene(canvas: HTMLCanvasElement): void {
this.renderer = new WebGLRenderer({
canvas: canvas,
alpha: false,
logarithmicDepthBuffer: true,
Function constructor
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
constructor(private storeFacade: StoreFacade, private databaseService: DatabaseService) {
this.selection$.subscribe();
this.hover$.subscribe();
this.storeFacade.isDebugMode$.subscribe(isDebugMode => {
Function click
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public click(coord: Vector2, shift: boolean) {
this.control.enabled = true;
this.raycaster.setFromCamera(coord, this.stage.camera);
const intersection = this.raycaster
.intersectObject(this.globe, true)
Function click
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
Open
public click(coord: Vector2, shift: boolean) {
this.control.enabled = true;
this.raycaster.setFromCamera(coord, this.stage.camera);
const intersection = this.raycaster
.intersectObject(this.globe, true)
- 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"