instacart/redux-rails

View on GitHub

Showing 45 of 45 total issues

File apiReducer.js has 327 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import { combineReducers } from 'redux'
import {
  apiDefaultState,
  findModel,
  createNewModel,
Severity: Minor
Found in src/apiReducer.js - About 3 hrs to fix

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

    export const index = ({resource, controller, queryParams}) => {
      return {
        type: `${resource}.INDEX`,
        data: { queryParams },
        controller
    Severity: Major
    Found in src/railsActions.js and 1 other location - About 1 hr to fix
    src/railsActions.js on lines 33..39

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 66.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

    export const destroy = ({id, resource, controller}) => {
      return {
        type: `${resource}.DESTROY`,
        data: { id },
        controller
    Severity: Major
    Found in src/railsActions.js and 1 other location - About 1 hr to fix
    src/railsActions.js on lines 1..7

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 66.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

    export const destroyMember = ({id, state}) => {
      return state.models.filter(model => model.id !== id)
    }
    Severity: Minor
    Found in src/reducerUtils.js and 1 other location - About 55 mins to fix
    src/reducerUtils.js on lines 99..101

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 54.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

    export const destroyTempMemeber = ({cId, state}) => {
      return state.models.filter(model => model.cId !== cId)
    }
    Severity: Minor
    Found in src/reducerUtils.js and 1 other location - About 55 mins to fix
    src/reducerUtils.js on lines 95..97

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 54.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

              dispatchFetchError({store, resource, railsAction, error: outError, id: data.id, cId, optimisticUpdateEnabled, reject})
    Severity: Minor
    Found in src/middleWare.js and 1 other location - About 50 mins to fix
    src/middleWare.js on lines 179..179

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 52.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

          dispatchFetchError({store, resource, railsAction, error, id: data.id, cId, optimisticUpdateEnabled, reject})
    Severity: Minor
    Found in src/middleWare.js and 1 other location - About 50 mins to fix
    src/middleWare.js on lines 175..175

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 52.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

              if (isSingleModel) {
                return createNewModel({id, cId,
                  attributes: { ...currentModel.attributes, ...data },
                  metaData: newMeta
                })
    Severity: Minor
    Found in src/apiReducer.js and 1 other location - About 35 mins to fix
    src/apiReducer.js on lines 184..189

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 46.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

              if (isSingleModel) {
                return createNewModel({id, cId,
                  attributes: { ...state.attributes, ...data },
                  metaData
                })
    Severity: Minor
    Found in src/apiReducer.js and 1 other location - About 35 mins to fix
    src/apiReducer.js on lines 336..341

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 46.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Avoid too many return statements within this function.
    Open

                return { 
                  ...state,
                  ...{
                    loading: false,
                    loadingError: error
    Severity: Major
    Found in src/apiReducer.js - About 30 mins to fix

      Avoid too many return statements within this function.
      Open

                return {
                  ...state,
                  ...{ models: setMemberLoading({id, state, queryParams}) }
                }
      Severity: Major
      Found in src/apiReducer.js - About 30 mins to fix

        Avoid too many return statements within this function.
        Open

                  return {
                    ...state,
                    ...{ models: setMemberLoadingError({state, id, error}) }
                  }
        Severity: Major
        Found in src/apiReducer.js - About 30 mins to fix

          Avoid too many return statements within this function.
          Open

            return true
          Severity: Major
          Found in src/utilities.js - About 30 mins to fix

            Avoid too many return statements within this function.
            Open

                        return createNewModel({id, cId,
                          attributes: { ...state.attributes, ...data },
                          metaData
                        })
            Severity: Major
            Found in src/apiReducer.js - About 30 mins to fix

              Avoid too many return statements within this function.
              Open

                        return {
                          ...state,
                          ...{ models: setMemberLoading({idAttribute, id, state}) }
                        }
              Severity: Major
              Found in src/apiReducer.js - About 30 mins to fix

                Avoid too many return statements within this function.
                Open

                          return state
                Severity: Major
                Found in src/apiReducer.js - About 30 mins to fix

                  Avoid too many return statements within this function.
                  Open

                            return createNewCollection({
                              models: setMemberAttributes({data, state, id, cId, metaData})
                            })
                  Severity: Major
                  Found in src/apiReducer.js - About 30 mins to fix

                    Avoid too many return statements within this function.
                    Open

                                return null
                    Severity: Major
                    Found in src/apiReducer.js - About 30 mins to fix

                      Avoid too many return statements within this function.
                      Open

                                return createNewCollection({
                                  models: setMemberAttributes({data, state, id, cId, metaData: newMeta})
                                })
                      Severity: Major
                      Found in src/apiReducer.js - About 30 mins to fix

                        Avoid too many return statements within this function.
                        Open

                                    return {
                                      ...state,
                                      ...{ models: destroyTempMemeber({cId, state}) }
                                    }
                        Severity: Major
                        Found in src/apiReducer.js - About 30 mins to fix
                          Severity
                          Category
                          Status
                          Source
                          Language