src/app/lore/store/reducers/scene.reducer.ts
Function sceneReducer
has 95 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export function sceneReducer(state: SceneState = initialSceneState, action: SceneActions): SceneState {
switch (action.type) {
case setPlaySpeed.type: {
return {
...state,
File scene.reducer.ts
has 302 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
import { toUnit } from '@app/function';
import { DeltaProperty, OverridableProperty } from '@app/model';
import {
bakeCursorOverride,
bakeFrame,
Function frameReducer
has 76 lines of code (exceeds 25 allowed). Consider refactoring. Open
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;
Function frameReducer
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
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;
- 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
Avoid too many return
statements within this function. Open
Open
return { ...state, sidebarOpen: action.payload };
Avoid too many return
statements within this function. Open
Open
return { ...state, playing: !state.playing };
Avoid too many return
statements within this function. Open
Open
return { ...state, frame: frameReducer(state.frame, action) };
Avoid too many return
statements within this function. Open
Open
return { ...state, loading: false };
Avoid too many return
statements within this function. Open
Open
return { ...state, interactionMode: action.payload };
Avoid too many return
statements within this function. Open
Open
return { ...state, manualLightAlwaysOn: !state.manualLightAlwaysOn };
Avoid too many return
statements within this function. Open
Open
return { ...frame, end: { ...frame.end, base: action.payload || frame.end.base } };
Avoid too many return
statements within this function. Open
Open
return { ...frame, end: { ...frame.end, base: bakedEnd, delta: undefined } };
Avoid too many return
statements within this function. Open
Open
return frame;
Avoid too many return
statements within this function. Open
Open
return { ...state, manualLightAlwaysOn: action.payload };
Avoid too many return
statements within this function. Open
Open
return { ...frame, end: { ...frame.end, delta: action.payload } };
Avoid too many return
statements within this function. Open
Open
return { ...frame, start: { ...frame.start, base: bakedStart, delta: undefined } };
Avoid too many return
statements within this function. Open
Open
return { ...state, debugMode: !state.debugMode };
Avoid too many return
statements within this function. Open
Open
return {
...frame,
start: { ...frame.start, delta: action.payload.start },
end: { ...frame.end, delta: action.payload.end }
};
Avoid too many return
statements within this function. Open
Open
return { ...frame, start: { ...frame.start, delta: action.payload } };
Avoid too many return
statements within this function. Open
Open
return {
...frame,
start: { ...frame.start, base: start },
end: { ...frame.end, base: end }
};
Avoid too many return
statements within this function. Open
Open
return { ...state, actorObjectSizeBias: action.payload };
Avoid too many return
statements within this function. Open
Open
return { ...state, drawHeight: action.payload };
Avoid too many return
statements within this function. Open
Open
return { ...state, manualLight: action.payload };
Avoid too many return
statements within this function. Open
Open
return { ...state, debugMode: action.payload };
Avoid too many return
statements within this function. Open
Open
return frame;
Avoid too many return
statements within this function. Open
Open
return { ...state, sidebarOpen: !state.sidebarOpen };
Avoid too many return
statements within this function. Open
Open
return {
...frame,
start: { ...frame.start, base: bakedStart, delta: undefined },
end: { ...frame.end, base: bakedEnd, delta: undefined }
};
Avoid too many return
statements within this function. Open
Open
return { ...state, playing: action.payload, loading: false };
Avoid too many return
statements within this function. Open
Open
return cursor;
Avoid too many return
statements within this function. Open
Open
return state;
Avoid too many return
statements within this function. Open
Open
return { ...state, mediaLarge: action.payload };
Avoid too many return
statements within this function. Open
Open
return { ...state, cursor: cursorReducer(state.cursor, action) };
Avoid too many return
statements within this function. Open
Open
return { ...state, drawSize: action.payload };
Avoid too many return
statements within this function. Open
Open
return { ...state, manualLight: !state.manualLight };
Avoid too many return
statements within this function. Open
Open
return frame;