Takumon/mean-blog

View on GitHub
src/app/drafts/state/draft.reducer.ts

Summary

Maintainability
C
1 day
Test Coverage

Function reducer has 59 lines of code (exceeds 25 allowed). Consider refactoring.
Open

export function reducer(
  state = initialState,
  action: DraftActions
): State {
  switch (action.type) {
Severity: Major
Found in src/app/drafts/state/draft.reducer.ts - About 2 hrs to fix

    Avoid too many return statements within this function.
    Open

          return adapter.addAll(action.payload.drafts,  {...state, loading: false});
    Severity: Major
    Found in src/app/drafts/state/draft.reducer.ts - About 30 mins to fix

      Avoid too many return statements within this function.
      Open

            return Object.assign({}, {...state, loading: false} );
      Severity: Major
      Found in src/app/drafts/state/draft.reducer.ts - About 30 mins to fix

        Avoid too many return statements within this function.
        Open

              return adapter.updateOne(action.payload.draft,  {...state, loading: false});
        Severity: Major
        Found in src/app/drafts/state/draft.reducer.ts - About 30 mins to fix

          Avoid too many return statements within this function.
          Open

                return adapter.removeOne(action.payload.draft._id,  {...state, loading: false});
          Severity: Major
          Found in src/app/drafts/state/draft.reducer.ts - About 30 mins to fix

            Avoid too many return statements within this function.
            Open

                  return Object.assign({}, {...state, loading: false} );
            Severity: Major
            Found in src/app/drafts/state/draft.reducer.ts - About 30 mins to fix

              Avoid too many return statements within this function.
              Open

                    return adapter.addMany(action.payload.drafts, state);
              Severity: Major
              Found in src/app/drafts/state/draft.reducer.ts - About 30 mins to fix

                Avoid too many return statements within this function.
                Open

                      return Object.assign({}, {...state, loading: true} );
                Severity: Major
                Found in src/app/drafts/state/draft.reducer.ts - About 30 mins to fix

                  Avoid too many return statements within this function.
                  Open

                        return adapter.removeMany(action.payload.ids, state);
                  Severity: Major
                  Found in src/app/drafts/state/draft.reducer.ts - About 30 mins to fix

                    Avoid too many return statements within this function.
                    Open

                          return adapter.updateMany(action.payload.drafts, state);
                    Severity: Major
                    Found in src/app/drafts/state/draft.reducer.ts - About 30 mins to fix

                      Avoid too many return statements within this function.
                      Open

                            return state;
                      Severity: Major
                      Found in src/app/drafts/state/draft.reducer.ts - About 30 mins to fix

                        Avoid too many return statements within this function.
                        Open

                              return Object.assign({}, {...state, loading: true} );
                        Severity: Major
                        Found in src/app/drafts/state/draft.reducer.ts - About 30 mins to fix

                          Avoid too many return statements within this function.
                          Open

                                return Object.assign({}, {...state, loading: false} );
                          Severity: Major
                          Found in src/app/drafts/state/draft.reducer.ts - About 30 mins to fix

                            Avoid too many return statements within this function.
                            Open

                                  return Object.assign({}, {...state, loading: true} );
                            Severity: Major
                            Found in src/app/drafts/state/draft.reducer.ts - About 30 mins to fix

                              Avoid too many return statements within this function.
                              Open

                                    return adapter.upsertMany(action.payload.drafts, state);
                              Severity: Major
                              Found in src/app/drafts/state/draft.reducer.ts - About 30 mins to fix

                                Avoid too many return statements within this function.
                                Open

                                      return adapter.removeAll(state);
                                Severity: Major
                                Found in src/app/drafts/state/draft.reducer.ts - About 30 mins to fix

                                  There are no issues that match your filters.

                                  Category
                                  Status