dsi-icl/optimise

View on GitHub

Showing 1,390 of 1,390 total issues

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

    static deleteConcomitantMed(user, whereObj) {
        return new Promise((resolve, reject) => deleteEntry('CONCOMITANT_MED', user, whereObj).then((result) => resolve(result)).catch((error) => reject(ErrorHelper(messages.errorMessages.GETFAIL, error))));
    }
Severity: Major
Found in packages/optimise-core/src/core/concomitantMeds.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/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/patientDiagnosis.js on lines 22..24
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 9 locations. Consider refactoring.
Open

    static deleteDemographic(user, whereObj) {
        return new Promise((resolve, reject) => deleteEntry('PATIENT_DEMOGRAPHIC', user, whereObj).then((result) => resolve(result)).catch((error) => reject(ErrorHelper(message.errorMessages.CREATIONFAIL, error))));
    }
Severity: Major
Found in packages/optimise-core/src/core/demographic.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 84..86
packages/optimise-core/src/core/demographic.js on lines 126..128
packages/optimise-core/src/core/patientDiagnosis.js on lines 22..24
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 9 locations. Consider refactoring.
Open

    static deleteImmunisation(user, whereObj) {
        return new Promise((resolve, reject) => deleteEntry('PATIENT_IMMUNISATION', user, whereObj).then((result) => resolve(result)).catch((error) => reject(ErrorHelper(message.errorMessages.CREATIONFAIL, error))));
    }
Severity: Major
Found in packages/optimise-core/src/core/demographic.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/patientDiagnosis.js on lines 22..24
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 9 locations. Consider refactoring.
Open

    static deleteTest(requester, idTest) {
        return new Promise((resolve, reject) => deleteEntry('ORDERED_TESTS', requester, idTest).then((result) => resolve(result)).catch((error) => reject(ErrorHelper(message.errorMessages.DELETEFAIL, error))));
    }
Severity: Major
Found in packages/optimise-core/src/core/test.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/patientDiagnosis.js on lines 22..24
packages/optimise-core/src/core/patientPii.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 9 locations. Consider refactoring.
Open

    static deleteMedicalHistory(user, whereObj) {
        return new Promise((resolve, reject) => deleteEntry('MEDICAL_HISTORY', user, whereObj).then((result) => resolve(result)).catch((error) => reject(ErrorHelper(message.errorMessages.CREATIONFAIL, error))));
    }
Severity: Major
Found in packages/optimise-core/src/core/demographic.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 126..128
packages/optimise-core/src/core/patientDiagnosis.js on lines 22..24
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 9 locations. Consider refactoring.
Open

    static deleteUser(user, userReq) {
        return new Promise((resolve, reject) => deleteEntry('USERS', user, userReq).then((result) => resolve(result)).catch((error) => reject(ErrorHelper(message.errorMessages.DELETEFAIL, error))));
    }
Severity: Major
Found in packages/optimise-core/src/core/user.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/patientDiagnosis.js on lines 22..24
packages/optimise-core/src/core/patientPii.js on lines 19..21
packages/optimise-core/src/core/test.js on lines 19..21

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

        dataPromises.push(dbcon()('PATIENTS')
            .select('PATIENTS.uuid as USUBJID', 'PATIENT_PREGNANCY.startDate as MHSTDTC', 'PREGNANCY_OUTCOMES.value as MHENRTPT',
                'PATIENT_PREGNANCY.outcomeDate as MHENDTC', 'ADVERSE_EVENT_MEDDRA.name as MHDECOD')
            .leftOuterJoin('PATIENT_PREGNANCY', 'PATIENT_PREGNANCY.patient', 'PATIENTS.id')
            .leftJoin('PREGNANCY_OUTCOMES', 'PREGNANCY_OUTCOMES.id', 'PATIENT_PREGNANCY.outcome')
packages/optimise-core/src/controllers/exportDataController.js on lines 570..578
packages/optimise-core/src/controllers/exportDataController.js on lines 823..831

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

        dataPromises.push(dbcon()('VISIT_DATA')
            .select('PATIENTS.uuid as USUBJID', 'AVAILABLE_FIELDS_VISITS.idname as OETEST',
                'VISIT_DATA.value as OEORRES', 'AVAILABLE_FIELDS_VISITS.laterality as OELAT', 'VISITS.visitDate as OEDTC')
            .leftOuterJoin('VISITS', 'VISITS.id', 'VISIT_DATA.visit')
            .leftOuterJoin('AVAILABLE_FIELDS_VISITS', 'AVAILABLE_FIELDS_VISITS.id', 'VISIT_DATA.field')
packages/optimise-core/src/controllers/exportDataController.js on lines 554..567
packages/optimise-core/src/controllers/exportDataController.js on lines 570..578

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

    static deleteComorbidity(user, whereObj) {
        return new Promise((resolve, reject) => deleteEntry('COMORBIDITY', user, whereObj).then((result) => resolve(result)).catch((error) => reject(ErrorHelper(messages.errorMessages.GETFAIL, error))));
    }
Severity: Major
Found in packages/optimise-core/src/core/comorbidity.js and 8 other locations - About 1 hr to fix
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/patientDiagnosis.js on lines 22..24
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 9 locations. Consider refactoring.
Open

    static deletePatientPii(user, whereObj) {
        return new Promise((resolve, reject) => deleteEntry('PATIENT_PII', user, whereObj).then((result) => resolve(result)).catch((error) => reject(ErrorHelper(messages.errorMessages.GETFAIL, error))));
    }
Severity: Major
Found in packages/optimise-core/src/core/patientPii.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/patientDiagnosis.js on lines 22..24
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 3 locations. Consider refactoring.
Open

        dataPromises.push(dbcon()('VISIT_DATA')
            .select('PATIENTS.uuid as USUBJID', 'AVAILABLE_FIELDS_VISITS.idname as VSTEST', 'VISIT_DATA.value as VSORRES',
                'AVAILABLE_FIELDS_VISITS.unit as VSORRESU', 'VISITS.visitDate as VSDTC')
            .leftOuterJoin('VISITS', 'VISITS.id', 'VISIT_DATA.visit')
            .leftOuterJoin('AVAILABLE_FIELDS_VISITS', 'AVAILABLE_FIELDS_VISITS.id', 'VISIT_DATA.field')
packages/optimise-core/src/controllers/exportDataController.js on lines 554..567
packages/optimise-core/src/controllers/exportDataController.js on lines 823..831

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

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

            for (let i = 0; i < resu.length; i++) {
                ids[i] = resu[i].id;
                dates[resu[i].id] = resu[i].visitDate;
            }
Severity: Major
Found in packages/optimise-core/src/utils/selector-utils.js and 1 other location - About 1 hr to fix
packages/optimise-core/src/utils/selector-utils.js on lines 483..486

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

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

            for (let i = 0; i < resu.length; i++) {
                ids[i] = resu[i].id;
                dates[resu[i].id] = resu[i].visitDate;
            }
Severity: Major
Found in packages/optimise-core/src/utils/selector-utils.js and 1 other location - About 1 hr to fix
packages/optimise-core/src/utils/selector-utils.js on lines 197..200

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

Function editConcomitantMed has 47 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    static editConcomitantMed({ body, user }, res) {
        if (body.concomitantMedEntryId && typeof body.concomitantMedEntryId === 'number') {
            const entryObj = { id: body.concomitantMedEntryId };
            const { concomitantMedId, indication, startDate, endDate } = body;
            if (concomitantMedId) {
Severity: Minor
Found in packages/optimise-core/src/controllers/concomitantMedController.js - About 1 hr to fix

    Function render has 47 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        render() {
            const { participation, optimiseConsent, pregnancySubStudyConsent } = this.props.data;
            const femalePatient = this.props.data.demographicData && this.props.data.demographicData.gender !== 1;
    
            return <>

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

          static editPregnancyEntry(user, entryObj) {
              return new Promise((resolve, reject) => updateEntry('PREGNANCY_ENTRY', user, '*', { id: entryObj.id }, entryObj).then((result) => resolve(result)).catch((error) => reject(error)));
          }
      Severity: Major
      Found in packages/optimise-core/src/core/demographic.js and 3 other locations - About 1 hr to fix
      packages/optimise-core/src/core/demographic.js on lines 141..143
      packages/optimise-core/src/core/demographic.js on lines 154..156
      packages/optimise-core/src/core/demographic.js on lines 171..173

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

      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