src/frontend/packages/store/src/reducers/pagination-reducer/pagination.reducer.ts
Function paginate
has 45 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function paginate(action, state: PaginationState = {}, updatePagination) {
if (action.type === ApiActionTypes.API_REQUEST_START) {
return state;
}
Function paginate
has a Cognitive Complexity of 16 (exceeds 8 allowed). Consider refactoring. Open
Open
function paginate(action, state: PaginationState = {}, updatePagination) {
if (action.type === ApiActionTypes.API_REQUEST_START) {
return state;
}
- 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 getPaginationUpdater
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
const getPaginationUpdater = (types: [string, string, string]) => {
const [requestType, successType, failureType] = types;
return (state: PaginationEntityState = getDefaultPaginationEntityState(), action): PaginationEntityState => {
switch (action.type) {
case requestType:
Avoid too many return
statements within this function. Wontfix
Wontfix
return paginationIgnoreMaxed(state, action as IgnorePaginationMaxedState);
Avoid too many return
statements within this function. Wontfix
Wontfix
return hydratePagination(state, action as HydratePaginationStateAction);
Avoid too many return
statements within this function. Wontfix
Wontfix
return setPaginationIsList(state, action as SetPaginationIsList);
Avoid too many return
statements within this function. Wontfix
Wontfix
return paginationClearAllTypes(state, [clearEntityType]);
Avoid too many return
statements within this function. Open
Open
return paginationResetPagination(state, action);
Avoid too many return
statements within this function. Open
Open
return paginationClearOfEntity(state, action);
Avoid too many return
statements within this function. Wontfix
Wontfix
return resetEndpointEntities(state, action);
Avoid too many return
statements within this function. Open
Open
return paginationMaxReached(state, action as UpdatePaginationMaxedState);
Avoid too many return
statements within this function. Wontfix
Wontfix
return paginationResetPagination(state, action, true);
Avoid too many return
statements within this function. Wontfix
Wontfix
return paginationResetSortAndFilter(state, action as ResetPaginationSortFilter);
Avoid too many return
statements within this function. Open
Open
return enterPaginationReducer(state, action, updatePagination);