AlexAegis/loreplotter

View on GitHub
src/app/lore/engine/control/orbit-control.class.ts

Summary

Maintainability
F
4 days
Test Coverage

File orbit-control.class.ts has 576 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import { EventDispatcher, OrthographicCamera, PerspectiveCamera, Quaternion, Spherical, Vector2, Vector3 } from 'three';

const MOUSE = { LEFT: 0, MIDDLE: 1, RIGHT: 2 };

// This set of controls performs orbiting, dollying (zooming), and panning.
Severity: Major
Found in src/app/lore/engine/control/orbit-control.class.ts - About 1 day to fix

    OrbitControls has 51 functions (exceeds 20 allowed). Consider refactoring.
    Open

    export class OrbitControls extends EventDispatcher {
        static STATE = { NONE: -1, ROTATE: 0, DOLLY: 1, PAN: 2, TOUCH_ROTATE: 3, TOUCH_DOLLY_PAN: 4 };
    
        constructor(public object: PerspectiveCamera | OrthographicCamera, private domElement: HTMLCanvasElement) {
            super();
    Severity: Major
    Found in src/app/lore/engine/control/orbit-control.class.ts - About 7 hrs to fix

      Function onMouseDown has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring.
      Open

          static onMouseDown(scope: OrbitControls) {
              return function _onMouseDown(event) {
                  if (scope.enabled === false) {
                      return;
                  }
      Severity: Minor
      Found in src/app/lore/engine/control/orbit-control.class.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 onTouchMove has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
      Open

          static onTouchMove(scope: OrbitControls) {
              return function _onTouchMove(event) {
                  if (scope.enabled === false) {
                      return;
                  }
      Severity: Minor
      Found in src/app/lore/engine/control/orbit-control.class.ts - About 2 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 onMouseDown has 43 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          static onMouseDown(scope: OrbitControls) {
              return function _onMouseDown(event) {
                  if (scope.enabled === false) {
                      return;
                  }
      Severity: Minor
      Found in src/app/lore/engine/control/orbit-control.class.ts - About 1 hr to fix

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

                return function _onMouseDown(event) {
                    if (scope.enabled === false) {
                        return;
                    }
        
        
        Severity: Minor
        Found in src/app/lore/engine/control/orbit-control.class.ts - About 1 hr to fix

          Function update has 40 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              update() {
                  const position = this.object.position;
          
                  this._updateOffset.copy(position).sub(this.target);
          
          
          Severity: Minor
          Found in src/app/lore/engine/control/orbit-control.class.ts - About 1 hr to fix

            Function onTouchStart has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
            Open

                static onTouchStart(scope: OrbitControls) {
                    return function _onTouchStart(event) {
                        if (scope.enabled === false) {
                            return;
                        }
            Severity: Minor
            Found in src/app/lore/engine/control/orbit-control.class.ts - About 1 hr 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 onMouseMove has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
            Open

                static onMouseMove(scope: OrbitControls) {
                    return function _onMouseMove(event) {
                        if (scope.enabled === false) {
                            return;
                        }
            Severity: Minor
            Found in src/app/lore/engine/control/orbit-control.class.ts - About 1 hr 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 onTouchMove has 29 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                static onTouchMove(scope: OrbitControls) {
                    return function _onTouchMove(event) {
                        if (scope.enabled === false) {
                            return;
                        }
            Severity: Minor
            Found in src/app/lore/engine/control/orbit-control.class.ts - About 1 hr to fix

              Function onTouchStart has 27 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  static onTouchStart(scope: OrbitControls) {
                      return function _onTouchStart(event) {
                          if (scope.enabled === false) {
                              return;
                          }
              Severity: Minor
              Found in src/app/lore/engine/control/orbit-control.class.ts - About 1 hr to fix

                Function _onTouchMove has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                        return function _onTouchMove(event) {
                            if (scope.enabled === false) {
                                return;
                            }
                
                
                Severity: Minor
                Found in src/app/lore/engine/control/orbit-control.class.ts - About 1 hr to fix

                  Function onMouseMove has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      static onMouseMove(scope: OrbitControls) {
                          return function _onMouseMove(event) {
                              if (scope.enabled === false) {
                                  return;
                              }
                  Severity: Minor
                  Found in src/app/lore/engine/control/orbit-control.class.ts - About 1 hr to fix

                    Avoid too many return statements within this function.
                    Open

                                            return;
                    Severity: Major
                    Found in src/app/lore/engine/control/orbit-control.class.ts - About 30 mins to fix

                      Avoid too many return statements within this function.
                      Open

                                              return;
                      Severity: Major
                      Found in src/app/lore/engine/control/orbit-control.class.ts - About 30 mins to fix

                        There are no issues that match your filters.

                        Category
                        Status