dsi-icl/optimise

View on GitHub

Showing 380 of 1,390 total issues

Function _handleSubmit has 60 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/medicalData/ceDataPage.jsx - About 2 hrs to fix

    SelectorUtils has 22 functions (exceeds 20 allowed). Consider refactoring.
    Open

    class SelectorUtils {
    
        getConcomitantMeds(patientId, deleted) {
            const whereObj = { patient: patientId };
            if (deleted !== true)
    Severity: Minor
    Found in packages/optimise-core/src/utils/selector-utils.js - About 2 hrs to fix

      PregnancyEntry has 22 functions (exceeds 20 allowed). Consider refactoring.
      Open

      @withRouter
      @connect(mapStateToProps)
      class PregnancyEntry extends Component {
          constructor(props) {
              super();
      Severity: Minor
      Found in packages/optimise-ui/src/components/pregnancyForms/pregnancyEntry.jsx - About 2 hrs to fix

        Function _composeSubmitBody has 58 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            _composeSubmitBody() {
                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/pregnancyForms/pregnancyEntry.jsx - About 2 hrs to fix

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

              render() {
                  const {
                      groups,
                      items,
                      defaultTimeStart,
          Severity: Major
          Found in packages/optimise-ui/src/components/patientProfile/fullTimeline.jsx - About 2 hrs to fix

            Function migrate has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
            Open

            export async function migrate() {
            
                // Verify the OPT_KV configuration table exists
                const isIntitialized = await dbcon().schema.hasTable('OPT_KV');
                let stepVersion = 0;
            Severity: Minor
            Found in packages/optimise-core/src/utils/db-handler.js - 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

            Function createApi has 56 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                .then((optimise_router) => {
            
                    console.log('optimise_router', optimise_router);
            
                    // Remove unwanted express headers
            Severity: Major
            Found in packages/optimise-electron/index.js - About 2 hrs to fix

              File editMedication.jsx has 259 lines of code (exceeds 250 allowed). Consider refactoring.
              Open

              import React, { Component } from 'react';
              import { connect } from 'react-redux';
              import moment from 'moment';
              import { NavLink } from 'react-router-dom';
              import { BackButton } from '../medicalData/utils';

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

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

                  Function apiHelper has 55 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  export const apiHelper = (endpoint, options, blockError) => {
                      if (!options) {
                          options = {};
                      }
                  
                  
                  Severity: Major
                  Found in packages/optimise-ui/src/redux/fetchHelper.js - About 2 hrs to fix

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

                        render() {
                            const { patientProfile, match } = this.props;
                            const { params } = match;
                    
                            let _style = scaffold_style;
                    Severity: Major
                    Found in packages/optimise-ui/src/components/medicalData/ceDataPage.jsx - About 2 hrs to fix

                      File createPatient.jsx has 256 lines of code (exceeds 250 allowed). Consider refactoring.
                      Open

                      import React, { Component } from 'react';
                      import { connect } from 'react-redux';
                      import { Redirect } from 'react-router-dom';
                      import moment from 'moment';
                      import { PickDate } from '../createMedicalElements/datepicker';
                      Severity: Minor
                      Found in packages/optimise-ui/src/components/createPatient/createPatient.jsx - About 2 hrs to fix

                        Function constructor has 53 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            constructor(props) {
                                super(props);
                                const state = {
                                    currentTermName: '',
                                    filterText: '',
                        Severity: Major
                        Found in packages/optimise-ui/src/components/treePicker/treePicker.jsx - About 2 hrs to fix

                          Function getICD11Field has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
                          Open

                              static async getICD11Field({ query }, res) {
                                  const result = [];
                                  const maxOccurency = 20;
                                  await ICD11Controller.loadICD11Collection();
                                  if (query.hasOwnProperty('search')) {
                          Severity: Minor
                          Found in packages/optimise-core/src/controllers/icd11Controller.js - 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

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

                              render() {
                                  const { patientProfile, fields } = this.props;
                                  const { pregnancyOutcomes, meddra_Hash } = fields;
                                  if (!patientProfile.fetching) {
                                      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 _handleSubmit has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
                          Open

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

                          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 start has 52 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-remote-control/src/optimiseAssistServer.js - About 2 hrs to fix

                            Function start has 52 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-sync/src/optimiseSyncServer.js - About 2 hrs to fix

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

                                  render() {
                                      const { patientProfile, match } = this.props;
                                      const { params } = match;
                              
                                      let _style = scaffold_style;
                              Severity: Major
                              Found in packages/optimise-ui/src/components/medicalData/testDataPage.jsx - About 2 hrs to fix

                                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 { references, originalValues } = this;
                                Severity: Major
                                Found in packages/optimise-ui/src/components/medicalData/visitDataPage.jsx - About 2 hrs to fix
                                  Severity
                                  Category
                                  Status
                                  Source
                                  Language