src/combineReducers.ts
Function combineReducers
has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring. Open
Open
export default function combineReducers(reducers: {
[key: string]: Reducer<any, any, any>
}) {
const reducerKeys = Object.keys(reducers)
const finalReducers: { [key: string]: Reducer<any, any, any> } = {}
- 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 combineReducers
has 66 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export default function combineReducers(reducers: {
[key: string]: Reducer<any, any, any>
}) {
const reducerKeys = Object.keys(reducers)
const finalReducers: { [key: string]: Reducer<any, any, any> } = {}
Function combination
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
return function combination(
state: StateFromReducersMapObject<typeof reducers> = {},
action: Action
) {
if (shapeAssertionError) {
Function getUnexpectedStateShapeWarningMessage
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function getUnexpectedStateShapeWarningMessage(
inputState: object,
reducers: { [key: string]: Reducer<any, any, any> },
action: Action,
unexpectedKeyCache: { [key: string]: true }
Function assertReducerShape
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function assertReducerShape(reducers: {
[key: string]: Reducer<any, any, any>
}) {
Object.keys(reducers).forEach(key => {
const reducer = reducers[key]
Function getUnexpectedStateShapeWarningMessage
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
Open
function getUnexpectedStateShapeWarningMessage(
inputState: object,
reducers: { [key: string]: Reducer<any, any, any> },
action: Action,
unexpectedKeyCache: { [key: string]: 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"