dsi-icl/optimise

View on GitHub
packages/optimise-ui/src/redux/reducers.js

Summary

Maintainability
F
1 wk
Test Coverage

Function availableFields has 121 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function availableFields(state = initialState.availableFields, action) {
    let newState;
    let hash;
    switch (action.type) {
        case actionTypes.availableFields.GET_CE_TYPES_SUCCESS:
Severity: Major
Found in packages/optimise-ui/src/redux/reducers.js - About 4 hrs to fix

    File reducers.js has 358 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    import initialState from './initialState';
    import { combineReducers } from 'redux';
    import actionTypes from './actions/listOfActions';
    import { dispatch as workerDispatch } from '../webWorker';
    
    
    Severity: Minor
    Found in packages/optimise-ui/src/redux/reducers.js - About 4 hrs to fix

      Function login has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
      Open

      function login(state = initialState.login, action) {
          switch (action.type) {
              case actionTypes.login.LOGIN_REQUESTED:
                  return { ...state, loggingIn: true, loginFailed: false, loggedIn: false, initialCheckingStatus: false, username: action.payload.username };
              case actionTypes.login.LOGIN_FAILURE:
      Severity: Minor
      Found in packages/optimise-ui/src/redux/reducers.js - About 1 hr to fix

      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 patientProfile has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

      function patientProfile(state = initialState.patientProfile, action) {
          switch (action.type) {
              case actionTypes.getPatientProfileById.GET_PATIENT_PROFILE_BY_ID_REQUEST:
                  if (state.currentPatient === action.payload)
                      return state;
      Severity: Minor
      Found in packages/optimise-ui/src/redux/reducers.js - About 35 mins to fix

      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 log has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

      function log(state = initialState.log, action) {
          let body;
          let json;
          switch (action.type) {
              case actionTypes.admin.GET_LOG_REQUEST:
      Severity: Minor
      Found in packages/optimise-ui/src/redux/reducers.js - About 25 mins to fix

      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 availableFields has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

      function availableFields(state = initialState.availableFields, action) {
          let newState;
          let hash;
          switch (action.type) {
              case actionTypes.availableFields.GET_CE_TYPES_SUCCESS:
      Severity: Minor
      Found in packages/optimise-ui/src/redux/reducers.js - About 25 mins to fix

      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

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

              case actionTypes.availableFields.GET_ICD11_SUCCESS:
                  hash = action.payload.reduce((map, el) => { map[el.id] = el; return map; }, {});
                  workerDispatch({
                      type: actionTypes.availableFields.GET_ICD11_TREE_SUCESS,
                      work: 'tree',
      Severity: Major
      Found in packages/optimise-ui/src/redux/reducers.js and 1 other location - About 4 hrs to fix
      packages/optimise-ui/src/redux/reducers.js on lines 141..149

      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 121.

      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

              case actionTypes.availableFields.GET_MEDDRA_SUCESS:
                  hash = action.payload.reduce((map, el) => { map[el.id] = el; return map; }, {});
                  workerDispatch({
                      type: actionTypes.availableFields.GET_MEDDRA_TREE_SUCESS,
                      work: 'tree',
      Severity: Major
      Found in packages/optimise-ui/src/redux/reducers.js and 1 other location - About 4 hrs to fix
      packages/optimise-ui/src/redux/reducers.js on lines 153..161

      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 121.

      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 7 locations. Consider refactoring.
      Open

              case actionTypes.availableFields.GET_PREGNANCY_ENTRY_TYPES_SUCCESS:
                  hash = action.payload.reduce((map, el) => { map[el.id] = el.value; return map; }, {});
                  newState = { ...state, pregnancyEntryTypes: action.payload, pregnancyEntryTypes_Hash: [hash] };
                  break;
      Severity: Major
      Found in packages/optimise-ui/src/redux/reducers.js and 6 other locations - About 2 hrs to fix
      packages/optimise-ui/src/redux/reducers.js on lines 60..63
      packages/optimise-ui/src/redux/reducers.js on lines 87..90
      packages/optimise-ui/src/redux/reducers.js on lines 117..120
      packages/optimise-ui/src/redux/reducers.js on lines 125..128
      packages/optimise-ui/src/redux/reducers.js on lines 129..132
      packages/optimise-ui/src/redux/reducers.js on lines 165..168

      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 90.

      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 7 locations. Consider refactoring.
      Open

              case actionTypes.availableFields.GET_CE_TYPES_SUCCESS:
                  hash = action.payload.reduce((map, el) => { map[el.id] = el.name; return map; }, {});
                  newState = { ...state, clinicalEventTypes: action.payload, clinicalEventTypes_Hash: [hash] };
                  break;
      Severity: Major
      Found in packages/optimise-ui/src/redux/reducers.js and 6 other locations - About 2 hrs to fix
      packages/optimise-ui/src/redux/reducers.js on lines 87..90
      packages/optimise-ui/src/redux/reducers.js on lines 117..120
      packages/optimise-ui/src/redux/reducers.js on lines 125..128
      packages/optimise-ui/src/redux/reducers.js on lines 129..132
      packages/optimise-ui/src/redux/reducers.js on lines 133..136
      packages/optimise-ui/src/redux/reducers.js on lines 165..168

      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 90.

      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 7 locations. Consider refactoring.
      Open

              case actionTypes.availableFields.GET_VISIT_SECTIONS_SUCCESS:
                  hash = action.payload.reduce((map, el) => { map[el.id] = el.name; return map; }, {});
                  newState = { ...state, visitSections: action.payload, visitSections_Hash: [hash] };
                  break;
      Severity: Major
      Found in packages/optimise-ui/src/redux/reducers.js and 6 other locations - About 2 hrs to fix
      packages/optimise-ui/src/redux/reducers.js on lines 60..63
      packages/optimise-ui/src/redux/reducers.js on lines 87..90
      packages/optimise-ui/src/redux/reducers.js on lines 117..120
      packages/optimise-ui/src/redux/reducers.js on lines 125..128
      packages/optimise-ui/src/redux/reducers.js on lines 129..132
      packages/optimise-ui/src/redux/reducers.js on lines 133..136

      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 90.

      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 7 locations. Consider refactoring.
      Open

              case actionTypes.availableFields.GET_TEST_TYPES_SUCCESS:
                  hash = action.payload.reduce((map, el) => { map[el.id] = el.name; return map; }, {});
                  newState = { ...state, testTypes: action.payload, testTypes_Hash: [hash] };
                  break;
      Severity: Major
      Found in packages/optimise-ui/src/redux/reducers.js and 6 other locations - About 2 hrs to fix
      packages/optimise-ui/src/redux/reducers.js on lines 60..63
      packages/optimise-ui/src/redux/reducers.js on lines 117..120
      packages/optimise-ui/src/redux/reducers.js on lines 125..128
      packages/optimise-ui/src/redux/reducers.js on lines 129..132
      packages/optimise-ui/src/redux/reducers.js on lines 133..136
      packages/optimise-ui/src/redux/reducers.js on lines 165..168

      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 90.

      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 7 locations. Consider refactoring.
      Open

              case actionTypes.availableFields.GET_PREGNANCY_ENTRY_FIELDS_SUCCESS:
                  hash = action.payload.reduce((map, el) => { map[el.id] = el.value; return map; }, {});
                  newState = { ...state, pregnancyEntryFields: action.payload, pregnancyEntryFields_Hash: [hash] };
                  break;
      Severity: Major
      Found in packages/optimise-ui/src/redux/reducers.js and 6 other locations - About 2 hrs to fix
      packages/optimise-ui/src/redux/reducers.js on lines 60..63
      packages/optimise-ui/src/redux/reducers.js on lines 87..90
      packages/optimise-ui/src/redux/reducers.js on lines 117..120
      packages/optimise-ui/src/redux/reducers.js on lines 125..128
      packages/optimise-ui/src/redux/reducers.js on lines 133..136
      packages/optimise-ui/src/redux/reducers.js on lines 165..168

      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 90.

      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 7 locations. Consider refactoring.
      Open

              case actionTypes.availableFields.GET_PREGNANCY_OUTCOMES_SUCCESS:
                  hash = action.payload.reduce((map, el) => { map[el.id] = el.value; return map; }, {});
                  newState = { ...state, pregnancyOutcomes: action.payload, pregnancyOutcomes_Hash: [hash] };
                  break;
      Severity: Major
      Found in packages/optimise-ui/src/redux/reducers.js and 6 other locations - About 2 hrs to fix
      packages/optimise-ui/src/redux/reducers.js on lines 60..63
      packages/optimise-ui/src/redux/reducers.js on lines 87..90
      packages/optimise-ui/src/redux/reducers.js on lines 117..120
      packages/optimise-ui/src/redux/reducers.js on lines 129..132
      packages/optimise-ui/src/redux/reducers.js on lines 133..136
      packages/optimise-ui/src/redux/reducers.js on lines 165..168

      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 90.

      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 7 locations. Consider refactoring.
      Open

              case actionTypes.availableFields.GET_DIAGNOSES_SUCCESS:
                  hash = action.payload.reduce((map, el) => { map[el.id] = el.value; return map; }, {});
                  newState = { ...state, diagnoses: action.payload, diagnoses_Hash: [hash] };
                  break;
      Severity: Major
      Found in packages/optimise-ui/src/redux/reducers.js and 6 other locations - About 2 hrs to fix
      packages/optimise-ui/src/redux/reducers.js on lines 60..63
      packages/optimise-ui/src/redux/reducers.js on lines 87..90
      packages/optimise-ui/src/redux/reducers.js on lines 125..128
      packages/optimise-ui/src/redux/reducers.js on lines 129..132
      packages/optimise-ui/src/redux/reducers.js on lines 133..136
      packages/optimise-ui/src/redux/reducers.js on lines 165..168

      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 90.

      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 5 locations. Consider refactoring.
      Open

              case actionTypes.availableFields.GET_CE_FIELDS_SUCCESS:
                  hash = action.payload.reduce((map, el) => { map[el.id] = el; return map; }, {});
                  newState = { ...state, clinicalEventFields: action.payload, clinicalEventFields_Hash: [hash] };
                  break;
      Severity: Major
      Found in packages/optimise-ui/src/redux/reducers.js and 4 other locations - About 2 hrs to fix
      packages/optimise-ui/src/redux/reducers.js on lines 76..79
      packages/optimise-ui/src/redux/reducers.js on lines 83..86
      packages/optimise-ui/src/redux/reducers.js on lines 137..140
      packages/optimise-ui/src/redux/reducers.js on lines 169..172

      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 86.

      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 5 locations. Consider refactoring.
      Open

              case actionTypes.availableFields.GET_DRUGS_SUCCESS:
                  hash = action.payload.reduce((map, el) => { map[el.id] = el; return map; }, {});
                  newState = { ...state, drugs: action.payload, drugs_Hash: [hash] };
                  break;
      Severity: Major
      Found in packages/optimise-ui/src/redux/reducers.js and 4 other locations - About 2 hrs to fix
      packages/optimise-ui/src/redux/reducers.js on lines 83..86
      packages/optimise-ui/src/redux/reducers.js on lines 121..124
      packages/optimise-ui/src/redux/reducers.js on lines 137..140
      packages/optimise-ui/src/redux/reducers.js on lines 169..172

      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 86.

      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 5 locations. Consider refactoring.
      Open

              case actionTypes.availableFields.GET_CONCOMITANT_MEDS_SUCCESS:
                  hash = action.payload.reduce((map, el) => { map[el.id] = el; return map; }, {});
                  newState = { ...state, concomitantMedsList: action.payload, concomitantMedsList_hash: [hash] };
                  break;
      Severity: Major
      Found in packages/optimise-ui/src/redux/reducers.js and 4 other locations - About 2 hrs to fix
      packages/optimise-ui/src/redux/reducers.js on lines 76..79
      packages/optimise-ui/src/redux/reducers.js on lines 83..86
      packages/optimise-ui/src/redux/reducers.js on lines 121..124
      packages/optimise-ui/src/redux/reducers.js on lines 137..140

      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 86.

      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 5 locations. Consider refactoring.
      Open

              case actionTypes.availableFields.GET_TEST_FIELDS_SUCCESS:
                  hash = action.payload.reduce((map, el) => { map[el.id] = el; return map; }, {});
                  newState = { ...state, testFields: action.payload, testFields_Hash: [hash] };
                  break;
      Severity: Major
      Found in packages/optimise-ui/src/redux/reducers.js and 4 other locations - About 2 hrs to fix
      packages/optimise-ui/src/redux/reducers.js on lines 76..79
      packages/optimise-ui/src/redux/reducers.js on lines 121..124
      packages/optimise-ui/src/redux/reducers.js on lines 137..140
      packages/optimise-ui/src/redux/reducers.js on lines 169..172

      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 86.

      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 5 locations. Consider refactoring.
      Open

              case actionTypes.availableFields.GET_INTERRUPTION_REASONS_SUCESS:
                  hash = action.payload.reduce((map, el) => { map[el.id] = el; return map; }, {});
                  newState = { ...state, interruptionReasons: action.payload, interruptionReasons_Hash: [hash] };
                  break;
      Severity: Major
      Found in packages/optimise-ui/src/redux/reducers.js and 4 other locations - About 2 hrs to fix
      packages/optimise-ui/src/redux/reducers.js on lines 76..79
      packages/optimise-ui/src/redux/reducers.js on lines 83..86
      packages/optimise-ui/src/redux/reducers.js on lines 121..124
      packages/optimise-ui/src/redux/reducers.js on lines 169..172

      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 86.

      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 3 locations. Consider refactoring.
      Open

      function edssCalc(state = initialState.edssCalc, action) {
          switch (action.type) {
              case actionTypes.edssCalc.CLEAR_CALCULATOR:
                  return { display: false };
              case actionTypes.edssCalc.DISPLAY_CALCULATOR:
      Severity: Major
      Found in packages/optimise-ui/src/redux/reducers.js and 2 other locations - About 1 hr to fix
      packages/optimise-ui/src/redux/reducers.js on lines 294..303
      packages/optimise-ui/src/redux/reducers.js on lines 305..314

      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 73.

      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 3 locations. Consider refactoring.
      Open

      function baselineVisitFrontPage(state = initialState.baselineVisitFrontPage, action) {
          switch (action.type) {
              case actionTypes.visitFrontPage.CLEAR_BASELINE_VISIT_FRONTPAGE:
                  return { display: false };
              case actionTypes.visitFrontPage.DISPLAY_BASELINE_VISIT_FRONTPAGE:
      Severity: Major
      Found in packages/optimise-ui/src/redux/reducers.js and 2 other locations - About 1 hr to fix
      packages/optimise-ui/src/redux/reducers.js on lines 283..292
      packages/optimise-ui/src/redux/reducers.js on lines 305..314

      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 73.

      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 3 locations. Consider refactoring.
      Open

      function followupVisitFrontPage(state = initialState.followupVisitFrontPage, action) {
          switch (action.type) {
              case actionTypes.visitFrontPage.CLEAR_FOLLOWUP_VISIT_FRONTPAGE:
                  return { display: false };
              case actionTypes.visitFrontPage.DISPLAY_FOLLOWUP_VISIT_FRONTPAGE:
      Severity: Major
      Found in packages/optimise-ui/src/redux/reducers.js and 2 other locations - About 1 hr to fix
      packages/optimise-ui/src/redux/reducers.js on lines 283..292
      packages/optimise-ui/src/redux/reducers.js on lines 294..303

      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 73.

      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

      function alert(state = initialState.alert, action) {
          switch (action.type) {
              case actionTypes.alert.ADD_ALERT:
                  return action.payload;
              case actionTypes.alert.CLEAR_ALERT:
      Severity: Major
      Found in packages/optimise-ui/src/redux/reducers.js and 1 other location - About 1 hr to fix
      packages/optimise-ui/src/redux/reducers.js on lines 261..270

      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

      function appLevelError(state = initialState.appLevelError, action) {
          switch (action.type) {
              case actionTypes.appLevelError.ADD_ERROR:
                  return action.payload;
              case actionTypes.appLevelError.CLEAR_ERROR:
      Severity: Major
      Found in packages/optimise-ui/src/redux/reducers.js and 1 other location - About 1 hr to fix
      packages/optimise-ui/src/redux/reducers.js on lines 272..281

      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

                      medicalConditions_Hash: [
                          action.payload.conditions.reduce((map, el) => { map[el.id] = el.value; return map; }, {})
                      ]
      Severity: Minor
      Found in packages/optimise-ui/src/redux/reducers.js and 1 other location - About 55 mins to fix
      packages/optimise-ui/src/redux/reducers.js on lines 109..111

      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

                      relations_Hash: [
                          action.payload.relations.reduce((map, el) => { map[el.id] = el.value; return map; }, {})
                      ],
      Severity: Minor
      Found in packages/optimise-ui/src/redux/reducers.js and 1 other location - About 55 mins to fix
      packages/optimise-ui/src/redux/reducers.js on lines 112..114

      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

      There are no issues that match your filters.

      Category
      Status