dsi-icl/optimise

View on GitHub

Showing 380 of 1,390 total issues

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

    render() {
        const { patientProfile, fields } = this.props;
        const { icd11_Hash } = fields;

        let _style = style;

    Function _handleSubmit has 52 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        _handleSubmit(ev) {
            ev.preventDefault();
            if (this.state.lastSubmit && (new Date()).getTime() - this.state.lastSubmit < 500 ? true : false)
                return;
            const criteria = [
    Severity: Major
    Found in packages/optimise-ui/src/components/EDSScalculator/calculator.jsx - About 2 hrs to fix

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

          render() {
              const { countryOfOriginRef, dominantHandRef, ethnicityRef, genderRef } = this.state;
              const { fields, fetching } = this.props;
              if (fetching || !this.props.pii) {
                  return null;

        Function _handleSubmit has 51 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            _handleSubmit(ev) {
                ev.preventDefault();
                if (this.state.lastSubmit && (new Date()).getTime() - this.state.lastSubmit < 500 ? true : false)
                    return;
                const { references, originalValues } = this;
        Severity: Major
        Found in packages/optimise-ui/src/components/medicalData/testDataPage.jsx - About 2 hrs to fix

          Function _handleSubmit has 51 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              _handleSubmit(ev) {
                  ev.preventDefault();
                  if (this.state.lastSubmit && (new Date()).getTime() - this.state.lastSubmit < 500 ? true : false)
                      return;
          
          
          Severity: Major
          Found in packages/optimise-ui/src/components/createPatient/createPatient.jsx - About 2 hrs to fix

            Consider simplifying this complex logical expression.
            Open

                    if (body.hasOwnProperty('patient') && body.hasOwnProperty('firstName') && body.hasOwnProperty('surname') && body.hasOwnProperty('fullAddress') && body.hasOwnProperty('postcode') &&
                        typeof body.patient === 'number' && typeof body.firstName === 'string' && typeof body.surname === 'string' && typeof body.fullAddress === 'string' && typeof body.postcode === 'string') {
                        const entryObj = Object.assign({}, PatientPiiModel, body);
                        entryObj.createdByUser = user.id;
                        PatientPiiCore.createPatientPii(entryObj).then((result) => {
            Severity: Critical
            Found in packages/optimise-core/src/controllers/patientPiiController.js - About 2 hrs to fix

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

                  render() {
                      const { data: { demographicData }, pii, fields } = this.props;
                      const { showEditAliasId, editAliasIdInput } = this.state;
                      if (demographicData) {
                          let { DOB, countryOfOrigin, dominantHand, ethnicity, gender } = demographicData;

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

                    render() {
                        const { params } = this.props.match;
                        const { CEs, renderedInFrontPage } = this.props;
                        const { wannaUpdate } = this.state;
                        if (!CEs) {

                  Function getMeddraField has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
                  Open

                      static async getMeddraField({ query }, res) {
                          const result = [];
                          const maxOccurency = 20;
                          await MeddraController.loadMeddraCollection();
                          if (query.hasOwnProperty('search')) {
                  Severity: Minor
                  Found in packages/optimise-core/src/controllers/meddraController.js - About 1 hr 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 editPregnancy has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
                  Open

                      static editPregnancy({ body, user }, res) {
                          if (body.hasOwnProperty('id') && typeof body.id === 'number') {
                  
                              const entryObj = Object.assign({}, body);
                              const momentStart = moment(body.startDate, moment.ISO_8601);
                  Severity: Minor
                  Found in packages/optimise-core/src/controllers/demographicDataController.js - About 1 hr 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 15 (exceeds 5 allowed). Consider refactoring.
                  Open

                      render() {
                          if (this.props.visits) {
                              const params = this.props.match.params;
                  
                              let _style = 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 15 (exceeds 5 allowed). Consider refactoring.
                  Open

                      render() {
                          const { patientProfile, match } = this.props;
                          const { params } = match;
                  
                          let _style = scaffold_style;
                  Severity: Minor
                  Found in packages/optimise-ui/src/components/medicalData/ceDataPage.jsx - About 1 hr 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 _validateFields has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
                  Open

                      _validateFields() {
                  
                          const { visitId } = this.props.match.params;
                          const { outcomeApplicable, pregnancyEntry } = this.state;
                          const { data } = this.props;

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

                      _findDateRange(date, entryType) {
                  
                          let pregnancies = Array.from(this.props.data.pregnancy);
                  
                          let currentPregnancy;

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

                      static _checkEntryOrder(pregnancyEntry, data) {
                          let pregnancyId = pregnancyEntry.pregnancyId;
                          const currentVisit = data.visits.find(el => parseInt(el.id) === parseInt(pregnancyEntry.recordedDuringVisit));
                  
                          const allPregnancyEntries = data.pregnancyEntries.filter((el) => parseInt(el.pregnancyId) === parseInt(pregnancyId));

                  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 15 (exceeds 5 allowed). Consider refactoring.
                  Open

                      render() {
                  
                          if (!this.originalValues || !this.EDSSFields_Hash_reverse || !this.EDSSFields) return null;
                  
                          const { match: { params }, patientProfile: { visits } } = this.props;
                  Severity: Minor
                  Found in packages/optimise-ui/src/components/EDSScalculator/calculator.jsx - About 1 hr 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 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 <>

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

                          render() {
                              const { params } = this.props.match;
                              const { tests, location, renderedInFrontPage } = this.props;
                              const { wannaUpdate } = this.state;
                      

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

                            render() {
                                const { patientProfile, fields } = this.props;
                                const { diagnoses } = fields;
                                if (!patientProfile.fetching) {
                                    return (
                          Severity
                          Category
                          Status
                          Source
                          Language