AlexAegis/loreplotter

View on GitHub
src/app/lore/store/reducers/scene.reducer.ts

Summary

Maintainability
F
3 days
Test Coverage

Function sceneReducer has 95 lines of code (exceeds 25 allowed). Consider refactoring.
Open

export function sceneReducer(state: SceneState = initialSceneState, action: SceneActions): SceneState {
    switch (action.type) {
        case setPlaySpeed.type: {
            return {
                ...state,
Severity: Major
Found in src/app/lore/store/reducers/scene.reducer.ts - About 3 hrs to fix

    File scene.reducer.ts has 302 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    import { toUnit } from '@app/function';
    import { DeltaProperty, OverridableProperty } from '@app/model';
    import {
        bakeCursorOverride,
        bakeFrame,
    Severity: Minor
    Found in src/app/lore/store/reducers/scene.reducer.ts - About 3 hrs to fix

      Function frameReducer has 76 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      function frameReducer(frame: FrameState, action: SceneActions): FrameState {
          switch (action.type) {
              case setFrameTo.type: {
                  const start = action.payload.start || frame.start.base;
                  const end = action.payload.end || frame.end.base;
      Severity: Major
      Found in src/app/lore/store/reducers/scene.reducer.ts - About 3 hrs to fix

        Function frameReducer has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
        Open

        function frameReducer(frame: FrameState, action: SceneActions): FrameState {
            switch (action.type) {
                case setFrameTo.type: {
                    const start = action.payload.start || frame.start.base;
                    const end = action.payload.end || frame.end.base;
        Severity: Minor
        Found in src/app/lore/store/reducers/scene.reducer.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

        Avoid too many return statements within this function.
        Open

                    return { ...state, sidebarOpen: action.payload };
        Severity: Major
        Found in src/app/lore/store/reducers/scene.reducer.ts - About 30 mins to fix

          Avoid too many return statements within this function.
          Open

                      return { ...state, playing: !state.playing };
          Severity: Major
          Found in src/app/lore/store/reducers/scene.reducer.ts - About 30 mins to fix

            Avoid too many return statements within this function.
            Open

                        return { ...state, frame: frameReducer(state.frame, action) };
            Severity: Major
            Found in src/app/lore/store/reducers/scene.reducer.ts - About 30 mins to fix

              Avoid too many return statements within this function.
              Open

                          return { ...state, loading: false };
              Severity: Major
              Found in src/app/lore/store/reducers/scene.reducer.ts - About 30 mins to fix

                Avoid too many return statements within this function.
                Open

                            return { ...state, interactionMode: action.payload };
                Severity: Major
                Found in src/app/lore/store/reducers/scene.reducer.ts - About 30 mins to fix

                  Avoid too many return statements within this function.
                  Open

                              return { ...state, manualLightAlwaysOn: !state.manualLightAlwaysOn };
                  Severity: Major
                  Found in src/app/lore/store/reducers/scene.reducer.ts - About 30 mins to fix

                    Avoid too many return statements within this function.
                    Open

                                return { ...frame, end: { ...frame.end, base: action.payload || frame.end.base } };
                    Severity: Major
                    Found in src/app/lore/store/reducers/scene.reducer.ts - About 30 mins to fix

                      Avoid too many return statements within this function.
                      Open

                                  return { ...frame, end: { ...frame.end, base: bakedEnd, delta: undefined } };
                      Severity: Major
                      Found in src/app/lore/store/reducers/scene.reducer.ts - About 30 mins to fix

                        Avoid too many return statements within this function.
                        Open

                                    return frame;
                        Severity: Major
                        Found in src/app/lore/store/reducers/scene.reducer.ts - About 30 mins to fix

                          Avoid too many return statements within this function.
                          Open

                                      return { ...state, manualLightAlwaysOn: action.payload };
                          Severity: Major
                          Found in src/app/lore/store/reducers/scene.reducer.ts - About 30 mins to fix

                            Avoid too many return statements within this function.
                            Open

                                        return { ...frame, end: { ...frame.end, delta: action.payload } };
                            Severity: Major
                            Found in src/app/lore/store/reducers/scene.reducer.ts - About 30 mins to fix

                              Avoid too many return statements within this function.
                              Open

                                          return { ...frame, start: { ...frame.start, base: bakedStart, delta: undefined } };
                              Severity: Major
                              Found in src/app/lore/store/reducers/scene.reducer.ts - About 30 mins to fix

                                Avoid too many return statements within this function.
                                Open

                                            return { ...state, debugMode: !state.debugMode };
                                Severity: Major
                                Found in src/app/lore/store/reducers/scene.reducer.ts - About 30 mins to fix

                                  Avoid too many return statements within this function.
                                  Open

                                              return {
                                                  ...frame,
                                                  start: { ...frame.start, delta: action.payload.start },
                                                  end: { ...frame.end, delta: action.payload.end }
                                              };
                                  Severity: Major
                                  Found in src/app/lore/store/reducers/scene.reducer.ts - About 30 mins to fix

                                    Avoid too many return statements within this function.
                                    Open

                                                return { ...frame, start: { ...frame.start, delta: action.payload } };
                                    Severity: Major
                                    Found in src/app/lore/store/reducers/scene.reducer.ts - About 30 mins to fix

                                      Avoid too many return statements within this function.
                                      Open

                                                  return {
                                                      ...frame,
                                                      start: { ...frame.start, base: start },
                                                      end: { ...frame.end, base: end }
                                                  };
                                      Severity: Major
                                      Found in src/app/lore/store/reducers/scene.reducer.ts - About 30 mins to fix

                                        Avoid too many return statements within this function.
                                        Open

                                                    return { ...state, actorObjectSizeBias: action.payload };
                                        Severity: Major
                                        Found in src/app/lore/store/reducers/scene.reducer.ts - About 30 mins to fix

                                          Avoid too many return statements within this function.
                                          Open

                                                      return { ...state, drawHeight: action.payload };
                                          Severity: Major
                                          Found in src/app/lore/store/reducers/scene.reducer.ts - About 30 mins to fix

                                            Avoid too many return statements within this function.
                                            Open

                                                        return { ...state, manualLight: action.payload };
                                            Severity: Major
                                            Found in src/app/lore/store/reducers/scene.reducer.ts - About 30 mins to fix

                                              Avoid too many return statements within this function.
                                              Open

                                                          return { ...state, debugMode: action.payload };
                                              Severity: Major
                                              Found in src/app/lore/store/reducers/scene.reducer.ts - About 30 mins to fix

                                                Avoid too many return statements within this function.
                                                Open

                                                                return frame;
                                                Severity: Major
                                                Found in src/app/lore/store/reducers/scene.reducer.ts - About 30 mins to fix

                                                  Avoid too many return statements within this function.
                                                  Open

                                                              return { ...state, sidebarOpen: !state.sidebarOpen };
                                                  Severity: Major
                                                  Found in src/app/lore/store/reducers/scene.reducer.ts - About 30 mins to fix

                                                    Avoid too many return statements within this function.
                                                    Open

                                                                return {
                                                                    ...frame,
                                                                    start: { ...frame.start, base: bakedStart, delta: undefined },
                                                                    end: { ...frame.end, base: bakedEnd, delta: undefined }
                                                                };
                                                    Severity: Major
                                                    Found in src/app/lore/store/reducers/scene.reducer.ts - About 30 mins to fix

                                                      Avoid too many return statements within this function.
                                                      Open

                                                                  return { ...state, playing: action.payload, loading: false };
                                                      Severity: Major
                                                      Found in src/app/lore/store/reducers/scene.reducer.ts - About 30 mins to fix

                                                        Avoid too many return statements within this function.
                                                        Open

                                                                    return cursor;
                                                        Severity: Major
                                                        Found in src/app/lore/store/reducers/scene.reducer.ts - About 30 mins to fix

                                                          Avoid too many return statements within this function.
                                                          Open

                                                                      return state;
                                                          Severity: Major
                                                          Found in src/app/lore/store/reducers/scene.reducer.ts - About 30 mins to fix

                                                            Avoid too many return statements within this function.
                                                            Open

                                                                        return { ...state, mediaLarge: action.payload };
                                                            Severity: Major
                                                            Found in src/app/lore/store/reducers/scene.reducer.ts - About 30 mins to fix

                                                              Avoid too many return statements within this function.
                                                              Open

                                                                          return { ...state, cursor: cursorReducer(state.cursor, action) };
                                                              Severity: Major
                                                              Found in src/app/lore/store/reducers/scene.reducer.ts - About 30 mins to fix

                                                                Avoid too many return statements within this function.
                                                                Open

                                                                            return { ...state, drawSize: action.payload };
                                                                Severity: Major
                                                                Found in src/app/lore/store/reducers/scene.reducer.ts - About 30 mins to fix

                                                                  Avoid too many return statements within this function.
                                                                  Open

                                                                              return { ...state, manualLight: !state.manualLight };
                                                                  Severity: Major
                                                                  Found in src/app/lore/store/reducers/scene.reducer.ts - About 30 mins to fix

                                                                    Avoid too many return statements within this function.
                                                                    Open

                                                                                    return frame;
                                                                    Severity: Major
                                                                    Found in src/app/lore/store/reducers/scene.reducer.ts - About 30 mins to fix

                                                                      There are no issues that match your filters.

                                                                      Category
                                                                      Status