dsi-icl/optimise

View on GitHub

Showing 1,390 of 1,390 total issues

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

    render() {
        const { reference, choices, origVal } = this.props;
        if (choices.includes('LEFT'))
            return (
                <>
Severity: Major
Found in packages/optimise-ui/src/components/medicalData/utils.jsx - About 3 hrs to fix

    Function start has 75 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        start() {
            const _this = this;
            return new Promise((resolve, reject) => {
    
                // Operate database migration if necessary
    Severity: Major
    Found in packages/optimise-core/src/optimiseServer.js - About 3 hrs to fix

      Consider simplifying this complex logical expression.
      Open

              if (body.hasOwnProperty('patient') && body.hasOwnProperty('startDate') && body.hasOwnProperty('outcome') && body.hasOwnProperty('relation') && body.hasOwnProperty('conditionName') &&
                  ((body.hasOwnProperty('resolvedYear') && typeof body.resolvedYear === 'number') || !body.hasOwnProperty('resolvedYear')) &&
                  typeof body.patient === 'number' && typeof body.startDate === 'string' && typeof body.outcome === 'string' && typeof body.relation === 'number' && typeof body.conditionName === 'number') {
                  const momentStart = moment(body.startDate, moment.ISO_8601);
                  if (!momentStart.isValid() && body.startDate !== null) {
      Severity: Critical
      Found in packages/optimise-core/src/controllers/demographicDataController.js - About 3 hrs to fix

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

            render() {
                if (this.props.visits) {
                    const params = this.props.match.params;
        
                    let _style = style;

          Function unwindEntries has 74 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

                  const unwindEntries = tree => {
                      const line = {
                          lineNum: globalLineCount++,
                          subjid: tree.subjid,
                          alias: tree.aliasId,
          Severity: Major
          Found in packages/optimise-core/src/controllers/exportDataController.js - About 2 hrs to fix

            Similar blocks of code found in 3 locations. Consider refactoring.
            Open

                output: {
                    path: path.join(__dirname, 'build'),
                    filename: 'server.js',
                    library: process.env.NODE_ENV === 'development' ? undefined : 'optimise-core',
                    libraryTarget: process.env.NODE_ENV === 'development' ? undefined : 'umd',
            Severity: Major
            Found in packages/optimise-core/webpack.config.server.js and 2 other locations - About 2 hrs to fix
            packages/optimise-remote-control/webpack.config.server.js on lines 55..61
            packages/optimise-sync/webpack.config.server.js on lines 53..59

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 94.

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

            Similar blocks of code found in 2 locations. Consider refactoring.
            Open

                                            <thead>
                                                <tr><th></th><th>Type</th><th>Start date</th><th>End date</th><th>MedDRA</th><th></th></tr>
                                            </thead>
            packages/optimise-ui/src/components/createVisitFrontPage/componentWrappers/ce/common.jsx on lines 25..27

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 94.

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

            Similar blocks of code found in 3 locations. Consider refactoring.
            Open

                output: {
                    path: path.join(__dirname, 'build'),
                    filename: 'server.js',
                    library: process.env.NODE_ENV === 'development' ? undefined : 'optimise-remote-control',
                    libraryTarget: process.env.NODE_ENV === 'development' ? undefined : 'umd',
            Severity: Major
            Found in packages/optimise-remote-control/webpack.config.server.js and 2 other locations - About 2 hrs to fix
            packages/optimise-core/webpack.config.server.js on lines 60..66
            packages/optimise-sync/webpack.config.server.js on lines 53..59

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 94.

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

            Similar blocks of code found in 3 locations. Consider refactoring.
            Open

                output: {
                    path: path.join(__dirname, 'build'),
                    filename: 'server.js',
                    library: process.env.NODE_ENV === 'development' ? undefined : 'optimise-sync',
                    libraryTarget: process.env.NODE_ENV === 'development' ? undefined : 'umd',
            Severity: Major
            Found in packages/optimise-sync/webpack.config.server.js and 2 other locations - About 2 hrs to fix
            packages/optimise-core/webpack.config.server.js on lines 60..66
            packages/optimise-remote-control/webpack.config.server.js on lines 55..61

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 94.

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

            Similar blocks of code found in 2 locations. Consider refactoring.
            Open

                            <thead>
                                <tr><th></th><th>Type</th><th>Start date</th><th>End date</th><th>MedDRA</th><th></th></tr>
                            </thead>
            packages/optimise-ui/src/components/patientProfile/patientChart.jsx on lines 384..386

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 94.

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

            Function transformData has 73 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                transformData() {
                    const names = {};
                    const parents = {};
                    const leafs = [];
            
            Severity: Major
            Found in packages/optimise-core/src/core/MeddraHierarchyProcessor.js - About 2 hrs to fix

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

                  render() {
                      const { params: { currentPage, visitId, patientId } } = this.props.match;
                      const { onClickNext, formSaved } = this.props;
                      const { pregnancySubStudyConsent } = this.props.data;
                      const searchString = this.props.location.search;

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

                  render() {
                      let scaffold_style = _scaffold_style;
                      if (this.props.override_style) {
                          scaffold_style = { ..._scaffold_style, ...this.props.override_style };
                      }
              Severity: Minor
              Found in packages/optimise-ui/src/components/medicalData/visitDataPage.jsx - About 2 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

              Similar blocks of code found in 3 locations. Consider refactoring.
              Open

                                          {wannaUpdate ? <><button onClick={this._handleWannaUpdateClick}>Cancel</button><br /><br /></> :
                                              <><button onClick={this._handleWannaUpdateClick}>Change test date</button><br /><br /></>
                                          }
              packages/optimise-ui/src/components/editMedicalElements/editClinicalEvent.jsx on lines 78..80
              packages/optimise-ui/src/components/editMedicalElements/editVisit.jsx on lines 185..187

              Duplicated Code

              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

              Tuning

              This issue has a mass of 93.

              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

              Refactorings

              Further Reading

              Similar blocks of code found in 3 locations. Consider refactoring.
              Open

                                          {wannaUpdate ? <><button onClick={this._handleWannaUpdateClick}>Cancel</button><br /><br /></> :
                                              <><button onClick={this._handleWannaUpdateClick}>Change start date / MedDRA</button><br /><br /></>
                                          }
              packages/optimise-ui/src/components/editMedicalElements/editTest.jsx on lines 77..79
              packages/optimise-ui/src/components/editMedicalElements/editVisit.jsx on lines 185..187

              Duplicated Code

              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

              Tuning

              This issue has a mass of 93.

              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

              Refactorings

              Further Reading

              Similar blocks of code found in 3 locations. Consider refactoring.
              Open

                                  {wannaUpdate ? <><button onClick={this._handleWannaUpdateClick}>Cancel</button><br /><br /></> :
                                      <><button onClick={this._handleWannaUpdateClick}>Change visit properties</button><br /><br /></>
                                  }
              packages/optimise-ui/src/components/editMedicalElements/editClinicalEvent.jsx on lines 78..80
              packages/optimise-ui/src/components/editMedicalElements/editTest.jsx on lines 77..79

              Duplicated Code

              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

              Tuning

              This issue has a mass of 93.

              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

              Refactorings

              Further Reading

              Identical blocks of code found in 2 locations. Consider refactoring.
              Open

                          if (body.hasOwnProperty('terminatedDate') && body.terminatedDate !== null && !momentTerminated.isValid()) {
                              res.status(400).json(ErrorHelper(message.dateError[momentTerminated.invalidAt()], new Error(message.userError.INVALIDDATE)));
                              return;
                          }
              packages/optimise-core/src/controllers/treatmentController.js on lines 47..50

              Duplicated Code

              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

              Tuning

              This issue has a mass of 92.

              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

              Refactorings

              Further Reading

              Identical blocks of code found in 2 locations. Consider refactoring.
              Open

                  if (process.platform !== 'darwin' && updatingBlock === false)
                      optimise_server.stop().then(() => app.quit())
                          .catch((err) => {
                              console.error(err);
                              if (devMode || process.argv.indexOf('--devTools') !== -1) {
              Severity: Major
              Found in packages/optimise-electron/index.js and 1 other location - About 2 hrs to fix
              packages/optimise-electron/index.js on lines 427..435

              Duplicated Code

              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

              Tuning

              This issue has a mass of 92.

              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

              Refactorings

              Further Reading

              Identical blocks of code found in 2 locations. Consider refactoring.
              Open

                  if (process.platform !== 'darwin')
                      optimise_server.stop().then(() => app.quit())
                          .catch((err) => {
                              console.error(err);
                              if (devMode || process.argv.indexOf('--devTools') !== -1) {
              Severity: Major
              Found in packages/optimise-electron/index.js and 1 other location - About 2 hrs to fix
              packages/optimise-electron/index.js on lines 465..473

              Duplicated Code

              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

              Tuning

              This issue has a mass of 92.

              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

              Refactorings

              Further Reading

              Identical blocks of code found in 2 locations. Consider refactoring.
              Open

                      if (body.hasOwnProperty('terminatedDate') && body.terminatedDate !== null && !momentTerminated.isValid()) {
                          res.status(400).json(ErrorHelper(message.dateError[momentTerminated.invalidAt()], new Error(message.userError.INVALIDDATE)));
                          return;
                      }
              packages/optimise-core/src/controllers/treatmentController.js on lines 107..110

              Duplicated Code

              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

              Tuning

              This issue has a mass of 92.

              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

              Refactorings

              Further Reading

              Severity
              Category
              Status
              Source
              Language