dsi-icl/optimise

View on GitHub

Showing 1,390 of 1,390 total issues

Function render has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
Open

    render() {
        let _style = style;
        if (this.props.override_style) {
            _style = { ...style, ...this.props.override_style };
        }

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

    static _getNewStateFromProps(props) {

        const { patientProfile, data, match } = props;
        const { params } = match;

Severity: Minor
Found in packages/optimise-ui/src/components/pregnancyForms/pregnancyEntry.jsx - About 2 hrs 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 render has 64 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    render() {
        return (
            <>
                You can append these pre-composed paragraphs:<br /><br />
                <div className={style.commentButtonsGroup}>

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

                        <div className={scaffold_style.ariane}>
                            <h2>Edit {this.props.category.toUpperCase()}</h2>
                            <BackButton to={`/patientProfile/${match.params.patientId}`} />
                        </div>
    packages/optimise-ui/src/components/medicalData/visitDataPage.jsx on lines 135..138

    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_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

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

                        <div className={scaffold_style.ariane}>
                            <h2>Edit {this.props.category.toUpperCase()}</h2>
                            <BackButton to={`/patientProfile/${match.params.patientId}`} />
                        </div>
    packages/optimise-ui/src/components/medicalData/visitDataPage.jsx on lines 163..166

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

        _handleExportCDISC(e) {
            e.preventDefault();
            const { data: { currentSearchType, currentSearchString } } = this.props;
            let opener = window.ipcOpen || window.open;
            opener(`/api/export?cdisc&field=${currentSearchType}&value=${currentSearchString}`);
    packages/optimise-ui/src/components/exportCDSIC/exportSet.jsx on lines 26..31

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

                    case 1: // lab test
                        entry = associatedData.map(e => ({
                            lab_test_id: data.id,
                            lab_test_name: e.definition,
                            lab_test_value: e.value,
    packages/optimise-core/src/controllers/exportDataController.js on lines 224..231

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

        _handleExport(e) {
            e.preventDefault();
            const { data: { currentSearchType, currentSearchString } } = this.props;
            let opener = window.ipcOpen || window.open;
            opener(`/api/export?field=${currentSearchType}&value=${currentSearchString}`);
    packages/optimise-ui/src/components/exportCDSIC/exportSet.jsx on lines 40..45

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

                    case 3: // MRI
                        entry = associatedData.map(e => ({
                            mri_id: data.id,
                            mri_result_name: e.definition,
                            mri_result_value: e.value,
    packages/optimise-core/src/controllers/exportDataController.js on lines 216..223

    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

    Function _updateStatus has 63 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        _updateStatus() {
    
            const now = (new Date()).getTime();
            const { syncInfo: { config, status: { syncing, error, status } }, loggedIn } = this.props;
            const { lastCall, triggered } = this.state;
    Severity: Major
    Found in packages/optimise-ui/src/components/scaffold/syncIndicator.jsx - About 2 hrs to fix

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

          static editImmunisation(user, demogEntry) {
              return new Promise((resolve, reject) => updateEntry('PATIENT_IMMUNISATION', user, '*', { id: demogEntry.id }, demogEntry).then((result) => resolve(result)).catch((error) => reject(ErrorHelper(message.errorMessages.UPDATEFAIL, error))));
          }
      Severity: Major
      Found in packages/optimise-core/src/core/demographic.js and 5 other locations - About 2 hrs to fix
      packages/optimise-core/src/core/comorbidity.js on lines 14..16
      packages/optimise-core/src/core/concomitantMeds.js on lines 10..12
      packages/optimise-core/src/core/demographic.js on lines 20..22
      packages/optimise-core/src/core/demographic.js on lines 76..78
      packages/optimise-core/src/core/test.js on lines 15..17

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

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

          static updateConcomitantMed(user, updatedObj) {
              return new Promise((resolve, reject) => updateEntry('CONCOMITANT_MED', user, '*', { id: updatedObj.id }, updatedObj).then((result) => resolve(result)).catch((error) => reject(ErrorHelper(messages.errorMessages.GETFAIL, error))));
          }
      Severity: Major
      Found in packages/optimise-core/src/core/concomitantMeds.js and 5 other locations - About 2 hrs to fix
      packages/optimise-core/src/core/comorbidity.js on lines 14..16
      packages/optimise-core/src/core/demographic.js on lines 20..22
      packages/optimise-core/src/core/demographic.js on lines 76..78
      packages/optimise-core/src/core/demographic.js on lines 118..120
      packages/optimise-core/src/core/test.js on lines 15..17

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

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

          static editDemographic(user, demogEntry) {
              return new Promise((resolve, reject) => updateEntry('PATIENT_DEMOGRAPHIC', user, '*', { id: demogEntry.id }, demogEntry).then((result) => resolve(result)).catch((error) => reject(ErrorHelper(message.errorMessages.UPDATEFAIL, error))));
          }
      Severity: Major
      Found in packages/optimise-core/src/core/demographic.js and 5 other locations - About 2 hrs to fix
      packages/optimise-core/src/core/comorbidity.js on lines 14..16
      packages/optimise-core/src/core/concomitantMeds.js on lines 10..12
      packages/optimise-core/src/core/demographic.js on lines 76..78
      packages/optimise-core/src/core/demographic.js on lines 118..120
      packages/optimise-core/src/core/test.js on lines 15..17

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

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

          static updateTest(user, entryTest) {
              return new Promise((resolve, reject) => updateEntry('ORDERED_TESTS', user, '*', { id: entryTest.id }, entryTest).then((result) => resolve(result)).catch((error) => reject(ErrorHelper(message.errorMessages.UPDATEFAIL, error))));
          }
      Severity: Major
      Found in packages/optimise-core/src/core/test.js and 5 other locations - About 2 hrs to fix
      packages/optimise-core/src/core/comorbidity.js on lines 14..16
      packages/optimise-core/src/core/concomitantMeds.js on lines 10..12
      packages/optimise-core/src/core/demographic.js on lines 20..22
      packages/optimise-core/src/core/demographic.js on lines 76..78
      packages/optimise-core/src/core/demographic.js on lines 118..120

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

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

          static updateComorbidity(user, updatedObj) {
              return new Promise((resolve, reject) => updateEntry('COMORBIDITY', user, '*', { id: updatedObj.id }, updatedObj).then((result) => resolve(result)).catch((error) => reject(ErrorHelper(messages.errorMessages.GETFAIL, error))));
          }
      Severity: Major
      Found in packages/optimise-core/src/core/comorbidity.js and 5 other locations - About 2 hrs to fix
      packages/optimise-core/src/core/concomitantMeds.js on lines 10..12
      packages/optimise-core/src/core/demographic.js on lines 20..22
      packages/optimise-core/src/core/demographic.js on lines 76..78
      packages/optimise-core/src/core/demographic.js on lines 118..120
      packages/optimise-core/src/core/test.js on lines 15..17

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

      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

      Severity
      Category
      Status
      Source
      Language