dsi-icl/optimise

View on GitHub

Showing 380 of 1,390 total issues

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

export async function migrate() {

    const db = await dbcon().then(client => client.db());

    // // Verify the OPT_KV configuration table exists
Severity: Minor
Found in packages/optimise-remote-control/src/utils/db-handler.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 migrate has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

export async function migrate() {

    const db = await dbcon().then(client => client.db());

    // // Verify the OPT_KV configuration table exists
Severity: Minor
Found in packages/optimise-sync/src/utils/db-handler.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 11 (exceeds 5 allowed). Consider refactoring.
Open

    render() {

        if (this.props.data.demographicData) {
            if (this.props.data.demographicData.gender === 1)
                return null;

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

    _updateStatus() {

        const now = (new Date()).getTime();
        const { syncInfo: { config, status: { syncing, error, status } }, loggedIn } = this.props;
        const { lastCall, triggered } = this.state;
Severity: Minor
Found in packages/optimise-ui/src/components/scaffold/syncIndicator.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 11 (exceeds 5 allowed). Consider refactoring.
Open

    render() {
        const { editing } = this.state;
        const { data, typedict } = 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 oneSignOrSymptom has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

const oneSignOrSymptom = (data, VSFields_Hash) => {
    const fieldObj = VSFields_Hash[data.field];
    if (fieldObj) {
        if (fieldObj.type === 5) {
            return `- ${fieldObj.idname.replace(/:/g, ' > ')}: ${data.value === '1' ? 'Yes' : (data.value === '0' ? 'No' : 'Unknown')}`;

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 registerValidSW has 31 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function registerValidSW(swUrl, config) {
    navigator.serviceWorker
        .register(swUrl)
        .then(registration => {
            registration.onupdatefound = () => {
Severity: Minor
Found in packages/optimise-ui/src/serviceWorker.js - About 1 hr to fix

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

        constructor(props) {
            super(props);
            this.state = {
                dispatched: false,
                aliasId: props.match ? props.match.params.patientIdCreated : '',
    Severity: Minor
    Found in packages/optimise-ui/src/components/createPatient/createPatient.jsx - About 1 hr to fix

      Function _validateFields has 31 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          _validateFields() {
      
              const { visitId } = this.props.match.params;
              const { outcomeApplicable, pregnancyEntry } = this.state;
              const { data } = this.props;

        Function _handleSubmit has 31 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;
        

          Function _handleSubmit has 31 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 { patientId } = this.props;

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

                render() {
                    const { editing, diagnosisDate, diagnosis, diagnosisDate_original, diagnosis_original } = this.state;
                    const { data, diagnoses } = this.props;
            
                    return (

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

                Function createWindow has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                const createWindow = () => {
                    // Create the browser window.
                    mainWindow = new BrowserWindow({
                        toolbar: false,
                        show: false,
                Severity: Minor
                Found in packages/optimise-electron/index.js - About 1 hr to fix

                  Function editPregnancyImage has 30 lines of code (exceeds 25 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

                    Function getPatientProfile has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        static getPatientProfile(whereObj, deleted, getOnly) {
                            return new Promise((resolve, reject) => Patient.getPatient(whereObj, { patientId: 'id', alias: 'aliasId', optimiseConsent: 'optimiseConsent', pregnancySubStudyConsent: 'pregnancySubStudyConsent', participation: 'participation' }, deleted)
                                .then((Patientresult) => {
                                    let patientId;
                                    if (Patientresult.length === 1) {
                    Severity: Minor
                    Found in packages/optimise-core/src/core/patient.js - About 1 hr to fix

                      Function _handleSubmitClick has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          _handleSubmitClick(e) {
                              e.preventDefault();
                              if (this.state.lastSubmit && (new Date()).getTime() - this.state.lastSubmit < 500 ? true : false)
                                  return;
                      
                      

                        Function _handleSubmitClick has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            _handleSubmitClick(ev) {
                                ev.preventDefault();
                                if (this.state.lastSubmit && (new Date()).getTime() - this.state.lastSubmit < 500 ? true : false)
                                    return;
                        

                          Function mappingVisitFunction has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                                  const mappingVisitFunction = visit => {
                          
                                      // const EDSSFieldID = this.props.visitFields.filter(field => field.idname === 'edss:expanded disability status scale - estimated total')[0].id;
                                      // const EDSSRecord = visit.data.filter(record => record.field === EDSSFieldID);
                          
                          Severity: Minor
                          Found in packages/optimise-ui/src/components/patientProfile/timeline.jsx - About 1 hr to fix

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

                                render() {
                                    const { syncInfo } = this.props;
                            
                                    if (syncInfo.config === undefined || syncInfo.config.host === undefined || syncInfo.config.host === '')
                                        return null;
                            Severity: Minor
                            Found in packages/optimise-ui/src/components/scaffold/syncIndicator.jsx - About 1 hr to fix
                              Severity
                              Category
                              Status
                              Source
                              Language