dsi-icl/optimise

View on GitHub
packages/optimise-core/src/core/patientDiagnosis.js

Summary

Maintainability
B
6 hrs
Test Coverage

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

    static updatePatientDiagnosis(user, idDiagnosis, updatedObj) {
        return new Promise((resolve, reject) => updateEntry('PATIENT_DIAGNOSIS', user, '*', { id: idDiagnosis }, updatedObj).then((result) => resolve(result)).catch((error) => reject(ErrorHelper(message.errorMessages.GETFAIL, error))));
    }
Severity: Major
Found in packages/optimise-core/src/core/patientDiagnosis.js and 3 other locations - About 2 hrs to fix
packages/optimise-core/src/core/patientPii.js on lines 15..17
packages/optimise-core/src/core/treatment.js on lines 16..18
packages/optimise-core/src/core/treatment.js on lines 32..34

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

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

    static deletePatientDiagnosis(user, whereObj) {
        return new Promise((resolve, reject) => deleteEntry('PATIENT_DIAGNOSIS', user, whereObj).then((result) => resolve(result)).catch((error) => reject(ErrorHelper(message.errorMessages.GETFAIL, error))));
    }
Severity: Major
Found in packages/optimise-core/src/core/patientDiagnosis.js and 8 other locations - About 1 hr to fix
packages/optimise-core/src/core/comorbidity.js on lines 18..20
packages/optimise-core/src/core/concomitantMeds.js on lines 14..16
packages/optimise-core/src/core/demographic.js on lines 28..30
packages/optimise-core/src/core/demographic.js on lines 84..86
packages/optimise-core/src/core/demographic.js on lines 126..128
packages/optimise-core/src/core/patientPii.js on lines 19..21
packages/optimise-core/src/core/test.js on lines 19..21
packages/optimise-core/src/core/user.js on lines 57..59

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

    static createPatientDiagnosis(entryObj) {
        return new Promise((resolve, reject) => createEntry('PATIENT_DIAGNOSIS', entryObj).then((result) => resolve(result)).catch((error) => reject(ErrorHelper(message.errorMessages.GETFAIL, error))));
    }
Severity: Major
Found in packages/optimise-core/src/core/patientDiagnosis.js and 9 other locations - About 1 hr to fix
packages/optimise-core/src/core/comorbidity.js on lines 6..8
packages/optimise-core/src/core/comorbidity.js on lines 10..12
packages/optimise-core/src/core/concomitantMeds.js on lines 6..8
packages/optimise-core/src/core/demographic.js on lines 24..26
packages/optimise-core/src/core/demographic.js on lines 80..82
packages/optimise-core/src/core/demographic.js on lines 122..124
packages/optimise-core/src/core/patientPii.js on lines 11..13
packages/optimise-core/src/core/test.js on lines 11..13
packages/optimise-core/src/core/treatment.js on lines 12..14

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

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