dsi-icl/optimise

View on GitHub

Showing 380 of 1,390 total issues

Function getPatientData has a Cognitive Complexity of 196 (exceeds 5 allowed). Consider refactoring.
Open

    static async getPatientData(patientList) {
        const data = [];
        let globalLineCount = 1;
        let globalMaxComorbidities = 1;
        let globalMaxLabs = 1;
Severity: Minor
Found in packages/optimise-core/src/controllers/exportDataController.js - About 4 days 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 190 (exceeds 5 allowed). Consider refactoring.
Open

    render() {
        const { baselineVisit, isMinor } = this.props;
        const visitHasTests = this.props.data.tests.filter(el => el['orderedDuringVisit'] === this.props.visitId).length !== 0;
        const visitHasMedications = this.props.data.treatments.filter(el => el['orderedDuringVisit'] === this.props.visitId).length !== 0;
        const visitHasClinicalEvents = this.props.data.clinicalEvents.filter(el => el['recordedDuringVisit'] === this.props.visitId).length !== 0;
Severity: Minor
Found in packages/optimise-ui/src/components/patientProfile/patientChart.jsx - About 3 days 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 467 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    render() {
        const { baselineVisit, isMinor } = this.props;
        const visitHasTests = this.props.data.tests.filter(el => el['orderedDuringVisit'] === this.props.visitId).length !== 0;
        const visitHasMedications = this.props.data.treatments.filter(el => el['orderedDuringVisit'] === this.props.visitId).length !== 0;
        const visitHasClinicalEvents = this.props.data.clinicalEvents.filter(el => el['recordedDuringVisit'] === this.props.visitId).length !== 0;
Severity: Major
Found in packages/optimise-ui/src/components/patientProfile/patientChart.jsx - About 2 days to fix

    File patientChart.jsx has 843 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    import React, { Component, PureComponent, Fragment } from 'react';
    import { connect } from 'react-redux';
    import { NavLink, withRouter, Link } from 'react-router-dom';
    import { Timeline, TimelineEvent } from 'react-event-timeline';
    import { Editor, EditorState, convertFromRaw } from 'draft-js';
    Severity: Major
    Found in packages/optimise-ui/src/components/patientProfile/patientChart.jsx - About 2 days to fix

      File exportDataController.js has 758 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      /* Export data for all patients */
      
      import dbcon from '../utils/db-connection';
      
      import message from '../utils/message-utils';
      Severity: Major
      Found in packages/optimise-core/src/controllers/exportDataController.js - About 1 day to fix

        Function getPatientData has 340 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            static async getPatientData(patientList) {
                const data = [];
                let globalLineCount = 1;
                let globalMaxComorbidities = 1;
                let globalMaxLabs = 1;
        Severity: Major
        Found in packages/optimise-core/src/controllers/exportDataController.js - About 1 day to fix

          File pregnancyEntry.jsx has 708 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          import React, { Component, useState, useEffect } from 'react';
          import { connect } from 'react-redux';
          import { withRouter } from 'react-router-dom';
          import { createLevelObj, mappingFields, BackButton, checkIfObjIsEmpty } from '../medicalData/utils';
          import Icon from '../icon';
          Severity: Major
          Found in packages/optimise-ui/src/components/pregnancyForms/pregnancyEntry.jsx - About 1 day to fix

            Function getPatientDataCDISC has 324 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                static getPatientDataCDISC(patientList) {
            
                    const dataPromises = [];
                    const STUDYID = 'optimise';
            
            
            Severity: Major
            Found in packages/optimise-core/src/controllers/exportDataController.js - About 1 day to fix

              File demographicDataController.js has 627 lines of code (exceeds 250 allowed). Consider refactoring.
              Open

              import ErrorHelper from '../utils/error_helper';
              import message from '../utils/message-utils';
              import formatToJSON from '../utils/format-response';
              import moment from 'moment';
              import { DemographicCore, MedicalHistoryCore, ImmunisationCore, PregnancyCore } from '../core/demographic';
              Severity: Major
              Found in packages/optimise-core/src/controllers/demographicDataController.js - About 1 day to fix

                File patientProfile.jsx has 590 lines of code (exceeds 250 allowed). Consider refactoring.
                Open

                import React, { Component } from 'react';
                import { connect } from 'react-redux';
                import { Redirect } from 'react-router-dom';
                import moment from 'moment';
                import Icon from '../icon';
                Severity: Major
                Found in packages/optimise-ui/src/components/patientProfile/patientProfile.jsx - About 1 day to fix

                  Function startSync has 232 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      static async startSync(config) {
                  
                          if (isSyncing && !config.adminPass)
                              return Promise.resolve();
                  
                  
                  Severity: Major
                  Found in packages/optimise-core/src/core/sync.js - About 1 day to fix

                    Function mappingFields has a Cognitive Complexity of 56 (exceeds 5 allowed). Consider refactoring.
                    Open

                    export const mappingFields = (typeHash, references, originalValues, transformer) => {
                        const curry = el => {
                            const title = el[0];
                            let content = el[1];
                            if (content.hasOwnProperty('id')) {
                    Severity: Minor
                    Found in packages/optimise-ui/src/components/medicalData/utils.jsx - About 1 day 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

                    File selector-utils.js has 467 lines of code (exceeds 250 allowed). Consider refactoring.
                    Open

                    import dbcon from '../utils/db-connection';
                    
                    class SelectorUtils {
                    
                        getConcomitantMeds(patientId, deleted) {
                    Severity: Minor
                    Found in packages/optimise-core/src/utils/selector-utils.js - About 7 hrs to fix

                      Consider simplifying this complex logical expression.
                      Open

                              if ((body.hasOwnProperty('dose') && typeof body.dose !== 'number') ||
                                  (body.hasOwnProperty('unit') && body.unit !== 'µg' && body.unit !== 'mg' && body.unit !== 'cc' && body.unit !== 'na') ||
                                  (body.hasOwnProperty('form') && body.form !== 'OR' && body.form !== 'IV' && body.form !== 'IM' && body.form !== 'IT' && body.form !== 'SC' && body.form !== 'SL') ||
                                  (body.hasOwnProperty('times') && typeof body.times !== 'number') ||
                                  (body.hasOwnProperty('intervalUnit') && body.intervalUnit !== 'hour' && body.intervalUnit !== 'day' &&
                      Severity: Critical
                      Found in packages/optimise-core/src/controllers/treatmentController.js - About 6 hrs to fix

                        File fullTimeline.jsx has 438 lines of code (exceeds 250 allowed). Consider refactoring.
                        Open

                        import React, { Component, Fragment } from 'react';
                        import { connect } from 'react-redux';
                        import { Link } from 'react-router-dom';
                        import moment from 'moment';
                        
                        Severity: Minor
                        Found in packages/optimise-ui/src/components/patientProfile/fullTimeline.jsx - About 6 hrs to fix

                          Function edssAlgorithm has a Cognitive Complexity of 40 (exceeds 5 allowed). Consider refactoring.
                          Open

                          function edssAlgorithm(FSArrayWithoutAmbulation, ambulationScore) {
                          
                              if (FSArrayWithoutAmbulation.length === 0)
                                  return '';
                          
                          Severity: Minor
                          Found in packages/optimise-ui/src/components/EDSScalculator/calculator.jsx - About 6 hrs to fix

                          Cognitive Complexity

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

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

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

                          Further reading

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

                              render() {
                                  const allVisitDates = this.props.data.visits.filter(el => el.type === 1).map(el => el.visitDate);
                                  const allTestDates = this.props.data.tests.map(el => el.actualOccurredDate || el.expectedOccurDate);
                                  const allTreatmentDates = this.props.data.treatments.map(el => el.startDate);
                                  const allCEDates = [];
                          Severity: Major
                          Found in packages/optimise-ui/src/components/patientProfile/timeline.jsx - About 5 hrs to fix

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

                                render() {
                            
                                    const { patientProfile, match } = this.props;
                                    const { params } = match;
                                    const { pregnancyOutcomes } = this.props.fields;
                            Severity: Major
                            Found in packages/optimise-ui/src/components/pregnancyForms/pregnancyEntry.jsx - About 5 hrs to fix

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

                                  render() {
                              
                                      const { patientProfile, match } = this.props;
                                      const { params } = match;
                                      const { pregnancyOutcomes } = this.props.fields;
                              Severity: Minor
                              Found in packages/optimise-ui/src/components/pregnancyForms/pregnancyEntry.jsx - About 5 hrs to fix

                              Cognitive Complexity

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

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

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

                              Further reading

                              Function getDerivedStateFromProps has 135 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                                  static getDerivedStateFromProps(props, state) {
                              
                                      let items = [];
                                      let edssPoints = {};
                                      let maxTimeStart = state.defaultTimeStart;
                              Severity: Major
                              Found in packages/optimise-ui/src/components/patientProfile/fullTimeline.jsx - About 5 hrs to fix
                                Severity
                                Category
                                Status
                                Source
                                Language