dsi-icl/optimise

View on GitHub

Showing 1,390 of 1,390 total issues

Function createTest has 36 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    static createTest({ body, user }, res) {
        if (!body.hasOwnProperty('visitId') || !body.hasOwnProperty('expectedOccurDate') || !body.hasOwnProperty('type')) {
            res.status(400).json(ErrorHelper(message.userError.MISSINGARGUMENT));
            return;
        }
Severity: Minor
Found in packages/optimise-core/src/controllers/testController.js - About 1 hr to fix

    Function createConcomitantMed has 36 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        static createConcomitantMed({ body, user }, res) {
            if (!body.visitId
                || !body.concomitantMedId
                || !body.indication
                || !body.startDate
    Severity: Minor
    Found in packages/optimise-core/src/controllers/concomitantMedController.js - About 1 hr to fix

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

          render() {
              const el = this.props.data;
      
              if (this.state.editing) {
                  return (

        Function _formatBody has 36 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            _formatBody(update, add) {
                const { params } = this.props.match;
                const { outcomeApplicable, pregnancyEntry } = this.state;
        
                const entryType = pregnancyEntry.type === 1 ? 1 : (outcomeApplicable === 'yes' ? 3 : 2);

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

              render() {
                  const { fetching, data, match, location } = this.props;
                  if (fetching) {
                      return null;
                  }

            Function _handleClick has 36 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                _handleClick(ev) {
                    ev.target.nextSibling.checked = true;
                    const value = ev.target.nextSibling.value;
                    const radioGroup = ev.target.parentElement.parentElement.children;
                    for (let i = 0; i < radioGroup.length; i++) {
            Severity: Minor
            Found in packages/optimise-ui/src/components/EDSScalculator/calculator.jsx - About 1 hr to fix

              Function _RouterAddOrUpdate has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
              Open

                  static _RouterAddOrUpdate(req, res) {
                      if (optionsContainer.hasOwnProperty(`${req.params.dataType}`)) {
                          const options = optionsContainer[req.params.dataType];
                          if (!(req.body.hasOwnProperty(`${options.entryIdString}`) &&
                              (req.body.hasOwnProperty('add') || req.body.hasOwnProperty('update')))) {
              Severity: Minor
              Found in packages/optimise-core/src/controllers/dataController.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 updateCe has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
              Open

                  static updateCe({ 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/ceController.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 editDemographic has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
              Open

                  static editDemographic({ body, user }, res) {
                      if (body.hasOwnProperty('id') && typeof body.id === 'number') {
                          if (body.DOB) {
                              const momentDOB = moment(body.DOB, moment.ISO_8601);
                              if (!momentDOB.isValid()) {
              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 editImmunisation has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
              Open

                  static editImmunisation({ body, user }, res) {
                      if (body.hasOwnProperty('id') && typeof body.id === 'number' &&
                          ((body.hasOwnProperty('immunisationDate') && typeof body.immunisationDate === 'string') || !body.hasOwnProperty('immunisationDate'))) {
                          const momentImmun = moment(body.immunisationDate, moment.ISO_8601);
                          if (body.hasOwnProperty('immunisationDate') && body.immunisationDate !== null && !momentImmun.isValid()) {
              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 createPatientDiagnosis has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
              Open

                  static createPatientDiagnosis({ body, user }, res) {
                      const entryObj = {};
                      if (body.hasOwnProperty('patient') && body.hasOwnProperty('diagnosis') && body.hasOwnProperty('diagnosisDate') &&
                          typeof body.patient === 'number' && typeof body.diagnosis === 'number' && typeof body.diagnosisDate === 'string') {
                          const momentDiagnos = moment(body.diagnosisDate, moment.ISO_8601);

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

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

              const OffspringDataFields = ({
                  originalValues,
                  atDeliveryOutcome,
                  onOffspringChange
              }) => {

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

                  render() {
                      if (!this.state.dispatched) {
                          const { genders, dominant_hands, ethnicities, countries } = this.props.demofields;
                          let genders_sorted = [];
                          genders.forEach((el) => {
              Severity: Minor
              Found in packages/optimise-ui/src/components/createPatient/createPatient.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 _handleClick has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
              Open

                  _handleClick(ev) {
                      ev.target.nextSibling.checked = true;
                      const value = ev.target.nextSibling.value;
                      const radioGroup = ev.target.parentElement.parentElement.children;
                      for (let i = 0; i < radioGroup.length; i++) {
              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 render has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
              Open

                  render() {
                      const { editing, startDate, endDate, noEndDate, reason, meddra, startDate_original, endDate_original, reason_original, meddra_original } = this.state;
                      const { data, interruptionReasons, meddra_Hash } = this.props;
                      return (
                          <div className={style.interruption} 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 _handleSubmit has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
              Open

                  _handleSubmit(ev) {
                      ev.preventDefault();
                      if (this.state.lastSubmit && (new Date()).getTime() - this.state.lastSubmit < 500 ? true : false)
                          return;
                      const { patientId } = 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 render has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
              Open

                  render() {
                      const { editing, startDate, outcomeDate, noEndDate, outcome, meddra, startDate_original, outcomeDate_original, outcome_original, meddra_original } = this.state;
                      const { data, pregnancyOutcomes, meddra_Hash } = this.props;
                      return (
                          <div className={style.interruption} 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 exportDatabase has 35 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  static exportDatabase({ query }, res) {
              
                      const isPatientMappings = query.patientMappings !== undefined;
                      const isCDISC = query.cdisc !== undefined;
                      let queryfield = '';
              Severity: Minor
              Found in packages/optimise-core/src/controllers/exportDataController.js - About 1 hr to fix
                Severity
                Category
                Status
                Source
                Language