dsi-icl/optimise

View on GitHub

Showing 380 of 1,390 total issues

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

    constructor(props) {
        super(props);

        this.timeBoudary = this.timeBoudary.bind(this);
        this.groupRenderer = this.groupRenderer.bind(this);
Severity: Minor
Found in packages/optimise-ui/src/components/patientProfile/fullTimeline.jsx - About 1 hr to fix

    Function render has 40 lines of code (exceeds 25 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={{

      Function createTest has a Cognitive Complexity of 13 (exceeds 5 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

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

          static async createSync({ body: { data, uuid, agent, key }, headers, connection }, res) {
      
              if (data === undefined || uuid === undefined) {
                  res.status(401).json(ErrorHelper(message.userError.MISSINGARGUMENT));
                  return;
      Severity: Minor
      Found in packages/optimise-sync/src/controllers/syncController.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 editPregnancyImage has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
      Open

          static editPregnancyImage({ body, user }, res) {
              //
              if (body.hasOwnProperty('id') && typeof body.id === 'number') {
      
                  const entryObj = Object.assign({}, body);
      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 render has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
      Open

          render() {
              const { data, typedict, patientId, renderedInFrontPage } = this.props;
              const numberOfInterruptions = data.interruptions ? data.interruptions.length : 0;
              if (!typedict[data.drug])
                  return null;
      Severity: Minor
      Found in packages/optimise-ui/src/components/patientProfile/patientChart.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 _handleSubmit has a Cognitive Complexity of 13 (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/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 login has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
      Open

      function login(state = initialState.login, action) {
          switch (action.type) {
              case actionTypes.login.LOGIN_REQUESTED:
                  return { ...state, loggingIn: true, loginFailed: false, loggedIn: false, initialCheckingStatus: false, username: action.payload.username };
              case actionTypes.login.LOGIN_FAILURE:
      Severity: Minor
      Found in packages/optimise-ui/src/redux/reducers.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 _handleSubmitClick has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
      Open

          _handleSubmitClick(e) {
              e.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 getTests has 39 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          getTests(patientId, deleted) {
              const _this = this;
              const whereObj = { patient: patientId };
              const innerWhereObj = {};
              if (deleted !== true) {
      Severity: Minor
      Found in packages/optimise-core/src/utils/selector-utils.js - About 1 hr to fix

        Function getPregnancyEntries has 39 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            getPregnancyEntries(patientId, deleted) {
                const _this = this;
                const whereObj = { patient: patientId };
                const innerWhereObj = {};
                if (deleted !== true) {
        Severity: Minor
        Found in packages/optimise-core/src/utils/selector-utils.js - About 1 hr to fix

          Function getFields has 39 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              static getFields({ params, query }, res) {     //bound to GETclinicalEvents and GETtestTypes too
                  const tableMap = {
                      visitFields: 'AVAILABLE_FIELDS_VISITS',
                      visitSections: 'AVAILABLE_VISIT_SECTIONS',
                      testFields: 'AVAILABLE_FIELDS_TESTS',
          Severity: Minor
          Found in packages/optimise-core/src/controllers/availableFieldController.js - About 1 hr to fix

            Function editInterruption has 39 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                static editInterruption({ body, user }, res) {
                    if (body.hasOwnProperty('treatmentInterId') && typeof body.treatmentInterId === 'number' &&
                        body.hasOwnProperty('start_date') && typeof body.start_date === 'string') {
                        const momentStart = body.hasOwnProperty('start_date') && body.start_date !== null ? moment(body.start_date, moment.ISO_8601) : null;
                        const momentEnd = body.hasOwnProperty('end_date') && body.end_date !== null ? moment(body.end_date, moment.ISO_8601) : null;
            Severity: Minor
            Found in packages/optimise-core/src/controllers/treatmentController.js - About 1 hr to fix

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

                  render() {
                      const { editing, date, result, mode } = this.state;
                      return (
                          <div className={style.interruption} style={{
                              overflow: editing ? 'visible' : 'hidden'
              Severity: Minor
              Found in packages/optimise-ui/src/components/pregnancyForms/pregImage.jsx - About 1 hr to fix

                Function _handleSubmit has 39 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;
                        if (!this.state.newStartDate || !this.state.newStartDate.isValid()) {

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

                      render() {
                          return <>
                              <label>Please enter pregnancy image data, if any:</label>
                              <div className={pregnancy_style.pregnancy_image_div}>
                                  {
                  Severity: Minor
                  Found in packages/optimise-ui/src/components/pregnancyForms/pregImage.jsx - About 1 hr to fix

                    Function getDemographicFields has 37 lines of code (exceeds 25 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 1 hr to fix

                      Function componentDidMount has 37 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          componentDidMount() {
                              const that = this;
                              const socket = new WebSocket(that.props.wsEndpoint);
                              socket.onopen = function() {
                                  that.setState(prev => ({
                      Severity: Minor
                      Found in packages/optimise-ui/src/components/remoteControl/remoteControl.jsx - About 1 hr to fix

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

                            render() {
                                let _style = style;
                                if (this.props.override_style) {
                                    _style = { ...style, ...this.props.override_style };
                                }

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

                              render() {
                                  const { startDate, reasonForVisit, error, wannaUpdate } = this.state;
                                  const { match: { params }, visits } = this.props;
                          
                                  if (!visits)
                            Severity
                            Category
                            Status
                            Source
                            Language