dsi-icl/optimise

View on GitHub

Showing 380 of 1,390 total issues

Avoid too many return statements within this function.
Open

                return 5;
Severity: Major
Found in packages/optimise-ui/src/components/EDSScalculator/calculator.jsx - About 30 mins to fix

    Avoid too many return statements within this function.
    Open

                            return 3.5;
    Severity: Major
    Found in packages/optimise-ui/src/components/EDSScalculator/calculator.jsx - About 30 mins to fix

      Avoid too many return statements within this function.
      Open

                      return 6;
      Severity: Major
      Found in packages/optimise-ui/src/components/EDSScalculator/calculator.jsx - About 30 mins to fix

        Avoid too many return statements within this function.
        Open

                        return 5;
        Severity: Major
        Found in packages/optimise-ui/src/components/EDSScalculator/calculator.jsx - About 30 mins to fix

          Avoid too many return statements within this function.
          Open

                                      return 3;
          Severity: Major
          Found in packages/optimise-ui/src/components/EDSScalculator/calculator.jsx - About 30 mins to fix

            Avoid too many return statements within this function.
            Open

                            return 4.5;
            Severity: Major
            Found in packages/optimise-ui/src/components/EDSScalculator/calculator.jsx - About 30 mins to fix

              Avoid too many return statements within this function.
              Open

                          return 4;
              Severity: Major
              Found in packages/optimise-ui/src/components/EDSScalculator/calculator.jsx - About 30 mins to fix

                Avoid too many return statements within this function.
                Open

                                return maxScore - 1;
                Severity: Major
                Found in packages/optimise-ui/src/components/EDSScalculator/calculator.jsx - About 30 mins to fix

                  Avoid too many return statements within this function.
                  Open

                                          return 1;
                  Severity: Major
                  Found in packages/optimise-ui/src/components/EDSScalculator/calculator.jsx - About 30 mins to fix

                    Avoid too many return statements within this function.
                    Open

                                            return 1.5;
                    Severity: Major
                    Found in packages/optimise-ui/src/components/EDSScalculator/calculator.jsx - About 30 mins to fix

                      Function editMedicalCondition has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                      Open

                          static editMedicalCondition({ body, user }, res) {
                              if (body.hasOwnProperty('id') && typeof body.id === 'number' &&
                                  ((body.hasOwnProperty('outcome') && typeof body.outcome === 'string') || !body.hasOwnProperty('outcome')) &&
                                  ((body.hasOwnProperty('resolvedYear') && typeof body.resolvedYear === 'number') || !body.hasOwnProperty('resolvedYear'))) {
                                  MedicalHistoryCore.editMedicalHistory(user, body).then((result) => {
                      Severity: Minor
                      Found in packages/optimise-core/src/controllers/demographicDataController.js - About 25 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 createConcomitantMed has a Cognitive Complexity of 6 (exceeds 5 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 25 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 handleMeddraUploadByAdmin has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                      Open

                          static async handleMeddraUploadByAdmin({ user, files }, res) {
                              if (user.adminPriv !== 1) {
                                  res.status(401).json({ error: 'Not authorized.' });
                                  return;
                              }
                      Severity: Minor
                      Found in packages/optimise-core/src/controllers/meddraController.js - About 25 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 _formatEntries has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                      Open

                          static _formatEntries({ dataTableForeignKey, entryIdString }, { body, user }) {
                              const returned = {};
                              const numOfUpdates = (body.hasOwnProperty('update')) ? Object.keys(body.update).length : 0;
                              const numOfAdds = (body.hasOwnProperty('add')) ? Object.keys(body.add).length : 0;
                              const updates = [];
                      Severity: Minor
                      Found in packages/optimise-core/src/controllers/dataController.js - About 25 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 editComorbidity has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                      Open

                          static editComorbidity({ body, user }, res) {
                      
                              if (body.hasOwnProperty('id') && typeof body.id === 'number') {
                                  const entryObj = Object.assign({}, body);
                                  if (typeof body.comorbidity !== 'number') {
                      Severity: Minor
                      Found in packages/optimise-core/src/controllers/comorbidityController.js - About 25 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 filterNodes has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                      Open

                      const filterNodes = (filter, nodes) =>
                          nodes.reduce((filtered, n) => {
                              const { nodes: filteredChildren } = n.children ? filterNodes(filter, n.children) : { nodes: [] };
                              return !(filter(n) || filteredChildren.length) ? filtered : {
                                  nodes: [
                      Severity: Minor
                      Found in packages/optimise-ui/src/components/treePicker/treePicker.jsx - About 25 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 6 (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/medicalData/ceDataPage.jsx - About 25 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 _composeSubmitBody has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                      Open

                          _composeSubmitBody() {
                              if (this.state.lastSubmit && (new Date()).getTime() - this.state.lastSubmit < 500 ? true : false)
                                  return;
                      
                              const { references, originalValues } = this;
                      Severity: Minor
                      Found in packages/optimise-ui/src/components/pregnancyForms/pregnancyEntry.jsx - About 25 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 6 (exceeds 5 allowed). Consider refactoring.
                      Open

                          render() {
                              const { match, location } = this.props;
                              const { pregnancySubStudyConsent } = this.props.data;
                      
                      
                      

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

                          render() {
                              const { match, location } = this.props;
                              const { pregnancySubStudyConsent } = this.props.data;
                              const pageNumberToElementMap = {
                                  0: <VisitFrontPageIntroduction match={match} location={location} />,

                      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