AlexAegis/loreplotter

View on GitHub
src/app/lore/engine/engine.service.ts

Summary

Maintainability
F
3 days
Test Coverage

File engine.service.ts has 537 lines of code (exceeds 250 allowed). Consider refactoring.
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';
Severity: Major
Found in src/app/lore/engine/engine.service.ts - About 1 day to fix

    EngineService has 32 functions (exceeds 20 allowed). Consider refactoring.
    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)
    Severity: Minor
    Found in src/app/lore/engine/engine.service.ts - About 4 hrs to fix

      Function pan has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring.
      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
      Severity: Minor
      Found in src/app/lore/engine/engine.service.ts - About 3 hrs 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 initializePostprocessing has 71 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          private initializePostprocessing(): void {
              // PostProcessing
      
              this.composer = new EffectComposer(this.renderer, {
                  stencilBuffer: true
      Severity: Major
      Found in src/app/lore/engine/engine.service.ts - About 2 hrs to fix

        Function pan has 62 lines of code (exceeds 25 allowed). Consider refactoring.
        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
        Severity: Major
        Found in src/app/lore/engine/engine.service.ts - About 2 hrs to fix

          Function createScene has 51 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              public createScene(canvas: HTMLCanvasElement): void {
                  this.renderer = new WebGLRenderer({
                      canvas: canvas,
                      alpha: false,
                      logarithmicDepthBuffer: true,
          Severity: Major
          Found in src/app/lore/engine/engine.service.ts - About 2 hrs to fix

            Function constructor has 41 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                constructor(private storeFacade: StoreFacade, private databaseService: DatabaseService) {
                    this.selection$.subscribe();
                    this.hover$.subscribe();
            
                    this.storeFacade.isDebugMode$.subscribe(isDebugMode => {
            Severity: Minor
            Found in src/app/lore/engine/engine.service.ts - About 1 hr to fix

              Function click has 33 lines of code (exceeds 25 allowed). Consider refactoring.
              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)
              Severity: Minor
              Found in src/app/lore/engine/engine.service.ts - About 1 hr to fix

                Function click has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                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)
                Severity: Minor
                Found in src/app/lore/engine/engine.service.ts - About 55 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

                There are no issues that match your filters.

                Category
                Status