dsi-icl/optimise

View on GitHub

Showing 1,390 of 1,390 total issues

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

        this.setState({
            lastSubmit: (new Date()).getTime(),
            error: false
        }, () => {
            store.dispatch(editComorbidityAPICall(body));
packages/optimise-ui/src/components/editMedicalElements/editComorbidity.jsx on lines 55..61
packages/optimise-ui/src/components/editMedicalElements/editPregnancy.jsx on lines 107..113
packages/optimise-ui/src/components/editMedicalElements/editPregnancy.jsx on lines 262..268
packages/optimise-ui/src/components/medicalData/treatmentInterruptions.jsx on lines 108..114
packages/optimise-ui/src/components/medicalData/treatmentInterruptions.jsx on lines 276..282
packages/optimise-ui/src/components/pregnancyForms/pregImage.jsx on lines 210..216

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

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

        this.setState({
            lastSubmit: (new Date()).getTime(),
            error: false
        }, () => {
            store.dispatch(createTreatmentInterruptionAPICall(body));
packages/optimise-ui/src/components/editMedicalElements/editComorbidity.jsx on lines 55..61
packages/optimise-ui/src/components/editMedicalElements/editComorbidity.jsx on lines 177..183
packages/optimise-ui/src/components/editMedicalElements/editPregnancy.jsx on lines 107..113
packages/optimise-ui/src/components/editMedicalElements/editPregnancy.jsx on lines 262..268
packages/optimise-ui/src/components/medicalData/treatmentInterruptions.jsx on lines 276..282
packages/optimise-ui/src/components/pregnancyForms/pregImage.jsx on lines 210..216

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

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

        this.setState({
            lastSubmit: (new Date()).getTime(),
            error: false
        }, () => {
            store.dispatch(editPregnancyAPICall(body));
packages/optimise-ui/src/components/editMedicalElements/editComorbidity.jsx on lines 55..61
packages/optimise-ui/src/components/editMedicalElements/editComorbidity.jsx on lines 177..183
packages/optimise-ui/src/components/editMedicalElements/editPregnancy.jsx on lines 107..113
packages/optimise-ui/src/components/medicalData/treatmentInterruptions.jsx on lines 108..114
packages/optimise-ui/src/components/medicalData/treatmentInterruptions.jsx on lines 276..282
packages/optimise-ui/src/components/pregnancyForms/pregImage.jsx on lines 210..216

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

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

        this.setState({
            lastSubmit: (new Date()).getTime(),
            error: false
        }, () => {
            store.dispatch(editTreatmentInterruptionAPICall(body));
packages/optimise-ui/src/components/editMedicalElements/editComorbidity.jsx on lines 55..61
packages/optimise-ui/src/components/editMedicalElements/editComorbidity.jsx on lines 177..183
packages/optimise-ui/src/components/editMedicalElements/editPregnancy.jsx on lines 107..113
packages/optimise-ui/src/components/editMedicalElements/editPregnancy.jsx on lines 262..268
packages/optimise-ui/src/components/medicalData/treatmentInterruptions.jsx on lines 108..114
packages/optimise-ui/src/components/pregnancyForms/pregImage.jsx on lines 210..216

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

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

        this.setState({
            lastSubmit: (new Date()).getTime(),
            error: false
        }, () => {
            store.dispatch(createPregnancyAPICall(body));
packages/optimise-ui/src/components/editMedicalElements/editComorbidity.jsx on lines 55..61
packages/optimise-ui/src/components/editMedicalElements/editComorbidity.jsx on lines 177..183
packages/optimise-ui/src/components/editMedicalElements/editPregnancy.jsx on lines 262..268
packages/optimise-ui/src/components/medicalData/treatmentInterruptions.jsx on lines 108..114
packages/optimise-ui/src/components/medicalData/treatmentInterruptions.jsx on lines 276..282
packages/optimise-ui/src/components/pregnancyForms/pregImage.jsx on lines 210..216

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

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

    const _handleAPGAR1Change = (index, event) => {
        if (!offsprings[index])
            offsprings[index] = {};
        offsprings[index].apgar1 = event.target.value;
        setOffsprings([...offsprings]);
packages/optimise-ui/src/components/pregnancyForms/pregnancyEntry.jsx on lines 51..56
packages/optimise-ui/src/components/pregnancyForms/pregnancyEntry.jsx on lines 58..63
packages/optimise-ui/src/components/pregnancyForms/pregnancyEntry.jsx on lines 72..77
packages/optimise-ui/src/components/pregnancyForms/pregnancyEntry.jsx on lines 79..84

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

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

    const _handleCongenitalAffectChange = (index, event) => {
        if (!offsprings[index])
            offsprings[index] = {};
        offsprings[index].congenitalAffect = event.target.value;
        setOffsprings([...offsprings]);
packages/optimise-ui/src/components/pregnancyForms/pregnancyEntry.jsx on lines 51..56
packages/optimise-ui/src/components/pregnancyForms/pregnancyEntry.jsx on lines 58..63
packages/optimise-ui/src/components/pregnancyForms/pregnancyEntry.jsx on lines 65..70
packages/optimise-ui/src/components/pregnancyForms/pregnancyEntry.jsx on lines 72..77

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

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

    const _handleWeigthChange = (index, event) => {
        if (!offsprings[index])
            offsprings[index] = {};
        offsprings[index].weight = event.target.value;
        setOffsprings([...offsprings]);
packages/optimise-ui/src/components/pregnancyForms/pregnancyEntry.jsx on lines 51..56
packages/optimise-ui/src/components/pregnancyForms/pregnancyEntry.jsx on lines 65..70
packages/optimise-ui/src/components/pregnancyForms/pregnancyEntry.jsx on lines 72..77
packages/optimise-ui/src/components/pregnancyForms/pregnancyEntry.jsx on lines 79..84

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

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

        this.setState({
            lastSubmit: (new Date()).getTime(),
            error: false
        }, () => {
            store.dispatch(createComorbidityAPICall(body));
packages/optimise-ui/src/components/editMedicalElements/editComorbidity.jsx on lines 177..183
packages/optimise-ui/src/components/editMedicalElements/editPregnancy.jsx on lines 107..113
packages/optimise-ui/src/components/editMedicalElements/editPregnancy.jsx on lines 262..268
packages/optimise-ui/src/components/medicalData/treatmentInterruptions.jsx on lines 108..114
packages/optimise-ui/src/components/medicalData/treatmentInterruptions.jsx on lines 276..282
packages/optimise-ui/src/components/pregnancyForms/pregImage.jsx on lines 210..216

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

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

    const _handleGenderChange = (index, event) => {
        if (!offsprings[index])
            offsprings[index] = {};
        offsprings[index].gender = event.target.value;
        setOffsprings([...offsprings]);
packages/optimise-ui/src/components/pregnancyForms/pregnancyEntry.jsx on lines 58..63
packages/optimise-ui/src/components/pregnancyForms/pregnancyEntry.jsx on lines 65..70
packages/optimise-ui/src/components/pregnancyForms/pregnancyEntry.jsx on lines 72..77
packages/optimise-ui/src/components/pregnancyForms/pregnancyEntry.jsx on lines 79..84

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

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

    const _handleAPGAR5Change = (index, event) => {
        if (!offsprings[index])
            offsprings[index] = {};
        offsprings[index].apgar5 = event.target.value;
        setOffsprings([...offsprings]);
packages/optimise-ui/src/components/pregnancyForms/pregnancyEntry.jsx on lines 51..56
packages/optimise-ui/src/components/pregnancyForms/pregnancyEntry.jsx on lines 58..63
packages/optimise-ui/src/components/pregnancyForms/pregnancyEntry.jsx on lines 65..70
packages/optimise-ui/src/components/pregnancyForms/pregnancyEntry.jsx on lines 79..84

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

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

        if (!this.state.noEndDate && (!this.state.endDate || !this.state.endDate.isValid())) {
            this.setState({
                error: 'Please select an end date'
            });
            return;
packages/optimise-ui/src/components/editMedicalElements/editPregnancy.jsx on lines 84..89
packages/optimise-ui/src/components/editMedicalElements/editPregnancy.jsx on lines 239..244
packages/optimise-ui/src/components/medicalData/treatmentInterruptions.jsx on lines 84..89

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

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

                                        <span className={this.props.data.pregnancySubStudyConsent ? '' : style.noConsentAlert}>{`This patient ${this.props.data.pregnancySubStudyConsent ? 'consents' : 'does NOT consent'} to have their pregnancy data shared for research purposes.`}</span><br /><br />
packages/optimise-ui/src/components/patientProfile/patientChart.jsx on lines 69..69
packages/optimise-ui/src/components/patientProfile/patientChart.jsx on lines 70..70

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

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

        this.setState({
            lastSubmit: (new Date()).getTime(),
            error: false
        }, () => {
            store.dispatch(editPregnancyImageAPICall(body));
packages/optimise-ui/src/components/editMedicalElements/editComorbidity.jsx on lines 55..61
packages/optimise-ui/src/components/editMedicalElements/editComorbidity.jsx on lines 177..183
packages/optimise-ui/src/components/editMedicalElements/editPregnancy.jsx on lines 107..113
packages/optimise-ui/src/components/editMedicalElements/editPregnancy.jsx on lines 262..268
packages/optimise-ui/src/components/medicalData/treatmentInterruptions.jsx on lines 108..114
packages/optimise-ui/src/components/medicalData/treatmentInterruptions.jsx on lines 276..282

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

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

        if (!this.state.noEndDate && (!this.state.newEndDate || !this.state.newEndDate.isValid())) {
            this.setState({
                error: 'Please select an end date'
            });
            return;
packages/optimise-ui/src/components/editMedicalElements/editPregnancy.jsx on lines 84..89
packages/optimise-ui/src/components/editMedicalElements/editPregnancy.jsx on lines 239..244
packages/optimise-ui/src/components/medicalData/treatmentInterruptions.jsx on lines 253..258

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

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

        if (!this.state.noEndDate && (!this.state.newEndDate || !this.state.newEndDate.isValid())) {
            this.setState({
                error: 'Please select the outcome date'
            });
            return;
packages/optimise-ui/src/components/editMedicalElements/editPregnancy.jsx on lines 239..244
packages/optimise-ui/src/components/medicalData/treatmentInterruptions.jsx on lines 84..89
packages/optimise-ui/src/components/medicalData/treatmentInterruptions.jsx on lines 253..258

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

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

        if (!this.state.noEndDate && (!this.state.outcomeDate || !this.state.outcomeDate.isValid())) {
            this.setState({
                error: 'Please select the outcome date'
            });
            return;
packages/optimise-ui/src/components/editMedicalElements/editPregnancy.jsx on lines 84..89
packages/optimise-ui/src/components/medicalData/treatmentInterruptions.jsx on lines 84..89
packages/optimise-ui/src/components/medicalData/treatmentInterruptions.jsx on lines 253..258

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

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

                            <span className={this.props.data.participation ? '' : style.noConsentAlert}>{`This patient ${this.props.data.participation ? 'is enrolled in' : 'has withdrawn from'} the study.`}</span><br /><br />
packages/optimise-ui/src/components/patientProfile/patientChart.jsx on lines 70..70
packages/optimise-ui/src/components/patientProfile/patientChart.jsx on lines 74..74

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

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

                            <span className={this.props.data.optimiseConsent ? '' : style.noConsentAlert}>{`This patient ${this.props.data.optimiseConsent ? 'consents' : 'does NOT consent'} to have their data shared for research purposes.`}</span><br /><br />
packages/optimise-ui/src/components/patientProfile/patientChart.jsx on lines 69..69
packages/optimise-ui/src/components/patientProfile/patientChart.jsx on lines 74..74

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

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 createCe has 43 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    static createCe({ body, user }, res) {
        if ((body.hasOwnProperty('visitId') || body.hasOwnProperty('patient')) && body.hasOwnProperty('dateStartDate') && body.hasOwnProperty('type') &&
            typeof body.visitId === 'number' && typeof body.dateStartDate === 'string' && typeof body.type === 'number') {
            const momentStart = moment(body.dateStartDate, moment.ISO_8601);
            if (!momentStart.isValid()) {
Severity: Minor
Found in packages/optimise-core/src/controllers/ceController.js - About 1 hr to fix
    Severity
    Category
    Status
    Source
    Language