dsi-icl/optimise

View on GitHub

Showing 380 of 1,390 total issues

Function getMedicalConditionFields has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    static getMedicalConditionFields({ query }, res) {
        const action = {
            relations: MedicalHistoryCore.getRelations,
            conditions: MedicalHistoryCore.getConditions
        };
Severity: Minor
Found in packages/optimise-core/src/controllers/demographicDataController.js - About 35 mins to fix

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

Function addTerminationDate has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    static addTerminationDate({ body }, res) {    //for adding termination date
        if ((body.hasOwnProperty('treatmentId') && body.hasOwnProperty('terminationDate')) && body.hasOwnProperty('terminatedReason') &&
            typeof body.treatmentId === 'number' && typeof body.terminatedDate === 'string' && typeof body.terminatedReason === 'number') {
            const momentTerminated = moment(body.terminatedDate, moment.ISO_8601);
            if (!momentTerminated.isValid() && body.terminatedDate !== null) {
Severity: Minor
Found in packages/optimise-core/src/controllers/treatmentController.js - About 35 mins to fix

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

Function validateKey has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    static async validateKey(agent, key) {
        const db = await dbcon().then(client => client.db());
        const record = await db.collection('VALIDATION_KEYS').findOne({ key });
        let error = undefined;
        if (record === null || record === undefined)
Severity: Minor
Found in packages/optimise-sync/src/core/syncCore.js - About 35 mins to fix

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

Function patientProfile has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

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

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

Function _getPregnancyStatus has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    static _getPregnancyStatus(date, pregnancies) {

        const sortedPregnancies = pregnancies.sort((a, b) => {
            // Sort pregnancies in descending order based on startDate
            return parseFloat(b.startDate) - parseFloat(a.startDate);
Severity: Minor
Found in packages/optimise-ui/src/components/pregnancyForms/pregnancyEntry.jsx - About 35 mins to fix

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

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

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

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

    render() {
        const { patientProfile, match, location, renderedInFrontPage } = this.props;

        let _style = style;
        if (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 render has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    render() {
        const { patientProfile, fields } = this.props;
        const { diagnoses } = fields;
        if (!patientProfile.fetching) {
            return (

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

Avoid too many return statements within this function.
Open

            return;
Severity: Major
Found in packages/optimise-core/src/controllers/demographicDataController.js - About 30 mins to fix

    Avoid too many return statements within this function.
    Open

                                return DataController._createAndUpdate(req, options, entries).then(() => {
                                    res.status(200).json(formatToJSON(`${message.dataMessage.SUCCESS}`));
                                    return true;
                                }).catch((error) => {
                                    res.status(400).json(ErrorHelper(message.dataMessage.ERROR, error));
    Severity: Major
    Found in packages/optimise-core/src/controllers/dataController.js - About 30 mins to fix

      Avoid too many return statements within this function.
      Open

                  return;
      Severity: Major
      Found in packages/optimise-core/src/controllers/userController.js - About 30 mins to fix

        Avoid too many return statements within this function.
        Open

                    return;
        Severity: Major
        Found in packages/optimise-core/src/controllers/concomitantMedController.js - About 30 mins to fix

          Avoid too many return statements within this function.
          Open

                      return;
          Severity: Major
          Found in packages/optimise-core/src/controllers/treatmentController.js - About 30 mins to fix

            Avoid too many return statements within this function.
            Open

                        return;
            Severity: Major
            Found in packages/optimise-core/src/controllers/treatmentController.js - About 30 mins to fix

              Avoid too many return statements within this function.
              Open

                          return;
              Severity: Major
              Found in packages/optimise-core/src/controllers/ceController.js - About 30 mins to fix

                Avoid too many return statements within this function.
                Open

                                                                return false;
                Severity: Major
                Found in packages/optimise-core/src/controllers/dataController.js - About 30 mins to fix

                  Avoid too many return statements within this function.
                  Open

                              return;
                  Severity: Major
                  Found in packages/optimise-core/src/controllers/treatmentController.js - About 30 mins to fix

                    Avoid too many return statements within this function.
                    Open

                                return;
                    Severity: Major
                    Found in packages/optimise-core/src/controllers/concomitantMedController.js - About 30 mins to fix

                      Avoid too many return statements within this function.
                      Open

                                  return;
                      Severity: Major
                      Found in packages/optimise-core/src/controllers/treatmentController.js - About 30 mins to fix

                        Avoid too many return statements within this function.
                        Open

                                    return;
                        Severity: Major
                        Found in packages/optimise-core/src/controllers/demographicDataController.js - About 30 mins to fix
                          Severity
                          Category
                          Status
                          Source
                          Language