dsi-icl/optimise

View on GitHub

Showing 380 of 1,390 total issues

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

    render() {
        const { startDate, reasonForVisit, error } = this.state;
        const { params } = this.props.match;
        return (
            <>

    Function searchPatients has 26 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        static searchPatients({ query }, res) {  //get all list of patient if no query string; get similar if querystring is provided
            let queryfield = '';
            let queryvalue = '';
            if (Object.keys(query).length > 2) {
                res.status(400).json(ErrorHelper(message.userError.INVALIDQUERY));
    Severity: Minor
    Found in packages/optimise-core/src/controllers/patientController.js - About 1 hr to fix

      Function _getPregnancyStatus has 26 lines of code (exceeds 25 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);

        Function initializeComponent has 26 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            initializeComponent() {
                const { fields, patientProfile } = this.props;
        
                if (!patientProfile.fetching) {
                    const newPregnancyState = PregnancyEntry._getNewStateFromProps(this.props);

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

              render() {
                  return (
                      <>
                          If you have a subscription for MedDRA coding, you can load it so that it can be chosen in adverse events.<br /><br />
                          The coding is provided in multiple files. "mdhier.asc" contains the hierarchy for SOC, HLGT, HLT, and PT codings. "llt.asc" contains the coding for LLT. <br /><br /><br />
          Severity: Minor
          Found in packages/optimise-ui/src/components/admin/meddra.jsx - About 1 hr to fix

            Consider simplifying this complex logical expression.
            Open

                    if ((body.hasOwnProperty('visitId') || body.hasOwnProperty('patient')) && body.hasOwnProperty('dateStartDate') && body.hasOwnProperty('type') &&
                        typeof body.visitId === 'number' && typeof body.dateStartDate === 'string' && typeof body.type === 'number') {
                        const momentStart = moment(body.dateStartDate, moment.ISO_8601);
                        if (!momentStart.isValid()) {
                            const msg = (momentStart.invalidAt() === undefined || momentStart.invalidAt() < 0) ? message.userError.INVALIDDATE : message.dateError[momentStart.invalidAt()];
            Severity: Major
            Found in packages/optimise-core/src/controllers/ceController.js - About 1 hr to fix

              Function updatePatientDiagnosis has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
              Open

                  static updatePatientDiagnosis({ body, user }, res) {
                      if (body.hasOwnProperty('id') && typeof body.id === 'number') {
                          const entryObj = body;
                          const momentDiagnos = moment(body.diagnosisDate, moment.ISO_8601);
                          if (body.hasOwnProperty('diagnosisDate') && body.diagnosisDate !== null && !momentDiagnos.isValid()) {
              Severity: Minor
              Found in packages/optimise-core/src/controllers/patientDiagnosisController.js - About 55 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 updateTest has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
              Open

                  static updateTest({ body, user }, res) {
                      if (!body.hasOwnProperty('id')) {
                          res.status(400).json(ErrorHelper(message.userError.MISSINGARGUMENT));
                          return;
                      }
              Severity: Minor
              Found in packages/optimise-core/src/controllers/testController.js - About 55 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 createDemographic has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
              Open

                  static createDemographic({ body, user }, res) {
                      if ((!body.hasOwnProperty('patient') || !body.hasOwnProperty('DOB') || !body.hasOwnProperty('gender') || !body.hasOwnProperty('dominant_hand')
                          || !body.hasOwnProperty('ethnicity') || !body.hasOwnProperty('country_of_origin'))) {
                          res.status(400).json(ErrorHelper(message.userError.MISSINGARGUMENT));
                          return;
              Severity: Minor
              Found in packages/optimise-core/src/controllers/demographicDataController.js - About 55 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 updateUser has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
              Open

                  static updateUser({ user, body }, res) {
                      if (user.adminPriv !== 1 && user.username !== body.username) {
                          res.status(401).json(ErrorHelper(message.userError.NORIGHTS));
                          return;
                      }
              Severity: Minor
              Found in packages/optimise-core/src/controllers/userController.js - About 55 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 editTreatment has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
              Open

                  static editTreatment({ body, user }, res) {
                      if (body.hasOwnProperty('id') && typeof body.id === 'number') {
              
                          const momentStart = moment(body.startDate, moment.ISO_8601);
                          const momentTerminated = moment(body.terminatedDate, moment.ISO_8601);
              Severity: Minor
              Found in packages/optimise-core/src/controllers/treatmentController.js - About 55 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 Options has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
              Open

              const Options = function (configuration = {}) {
                  //Get all the attributes
                  const config = {};
              
                  for (const attr in configuration)
              Severity: Minor
              Found in packages/optimise-core/src/core/options.js - About 55 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 _handleSubmitClick has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
              Open

                  _handleSubmitClick(e) {
                      e.preventDefault();
                      if (this.state.lastSubmit && (new Date()).getTime() - this.state.lastSubmit < 500 ? true : false)
                          return;
              
              Severity: Minor
              Found in packages/optimise-ui/src/components/createMedicalElements/createTest.jsx - About 55 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 9 (exceeds 5 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;
              Severity: Minor
              Found in packages/optimise-ui/src/components/patientProfile/patientProfile.jsx - About 55 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 9 (exceeds 5 allowed). Consider refactoring.
              Open

                  render() {
                      return (
                          <>
                              If you have a subscription for MedDRA coding, you can load it so that it can be chosen in adverse events.<br /><br />
                              The coding is provided in multiple files. "mdhier.asc" contains the hierarchy for SOC, HLGT, HLT, and PT codings. "llt.asc" contains the coding for LLT. <br /><br /><br />
              Severity: Minor
              Found in packages/optimise-ui/src/components/admin/meddra.jsx - About 55 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 _handleSubmit has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
              Open

                  _handleSubmit(ev) {
                      ev.preventDefault();
                      if (this.state.lastSubmit && (new Date()).getTime() - this.state.lastSubmit < 500 ? true : false)
                          return;
              
              Severity: Minor
              Found in packages/optimise-ui/src/components/editMedicalElements/editTest.jsx - About 55 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 _handleSubmit has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
              Open

                  _handleSubmit(ev) {
                      ev.preventDefault();
                      if (this.state.lastSubmit && (new Date()).getTime() - this.state.lastSubmit < 500 ? true : false)
                          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

              Function _handleSubmitClick has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
              Open

                  _handleSubmitClick(ev) {
                      ev.preventDefault();
                      if (this.state.lastSubmit && (new Date()).getTime() - this.state.lastSubmit < 500 ? true : false)
                          return;
                      if (!this.state.startDate

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

                  static createVisit({ body, user }, res) {
                      if (!body.hasOwnProperty('patientId') || !body.hasOwnProperty('visitDate')) {
                          res.status(400).json(ErrorHelper(message.userError.MISSINGARGUMENT));
                          return;
                      }
              Severity: Minor
              Found in packages/optimise-core/src/controllers/visitController.js - About 45 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 getDemographicFields has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
              Open

                  static getDemographicFields({ query }, res) {
                      const action = {
                          gender: DemographicCore.getGenderFields,
                          dominant_hand: DemographicCore.getDominantHandsFields,
                          ethnicity: DemographicCore.getEthnicityFields,
              Severity: Minor
              Found in packages/optimise-core/src/controllers/demographicDataController.js - About 45 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

              Severity
              Category
              Status
              Source
              Language