Showing 380 of 1,390 total issues
Function getPatientData
has a Cognitive Complexity of 196 (exceeds 5 allowed). Consider refactoring. Open
static async getPatientData(patientList) {
const data = [];
let globalLineCount = 1;
let globalMaxComorbidities = 1;
let globalMaxLabs = 1;
- Read upRead up
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 190 (exceeds 5 allowed). Consider refactoring. Open
render() {
const { baselineVisit, isMinor } = this.props;
const visitHasTests = this.props.data.tests.filter(el => el['orderedDuringVisit'] === this.props.visitId).length !== 0;
const visitHasMedications = this.props.data.treatments.filter(el => el['orderedDuringVisit'] === this.props.visitId).length !== 0;
const visitHasClinicalEvents = this.props.data.clinicalEvents.filter(el => el['recordedDuringVisit'] === this.props.visitId).length !== 0;
- Read upRead up
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 467 lines of code (exceeds 25 allowed). Consider refactoring. Open
render() {
const { baselineVisit, isMinor } = this.props;
const visitHasTests = this.props.data.tests.filter(el => el['orderedDuringVisit'] === this.props.visitId).length !== 0;
const visitHasMedications = this.props.data.treatments.filter(el => el['orderedDuringVisit'] === this.props.visitId).length !== 0;
const visitHasClinicalEvents = this.props.data.clinicalEvents.filter(el => el['recordedDuringVisit'] === this.props.visitId).length !== 0;
File patientChart.jsx
has 843 lines of code (exceeds 250 allowed). Consider refactoring. Open
import React, { Component, PureComponent, Fragment } from 'react';
import { connect } from 'react-redux';
import { NavLink, withRouter, Link } from 'react-router-dom';
import { Timeline, TimelineEvent } from 'react-event-timeline';
import { Editor, EditorState, convertFromRaw } from 'draft-js';
File exportDataController.js
has 758 lines of code (exceeds 250 allowed). Consider refactoring. Open
/* Export data for all patients */
import dbcon from '../utils/db-connection';
import message from '../utils/message-utils';
Function getPatientData
has 340 lines of code (exceeds 25 allowed). Consider refactoring. Open
static async getPatientData(patientList) {
const data = [];
let globalLineCount = 1;
let globalMaxComorbidities = 1;
let globalMaxLabs = 1;
File pregnancyEntry.jsx
has 708 lines of code (exceeds 250 allowed). Consider refactoring. Open
import React, { Component, useState, useEffect } from 'react';
import { connect } from 'react-redux';
import { withRouter } from 'react-router-dom';
import { createLevelObj, mappingFields, BackButton, checkIfObjIsEmpty } from '../medicalData/utils';
import Icon from '../icon';
Function getPatientDataCDISC
has 324 lines of code (exceeds 25 allowed). Consider refactoring. Open
static getPatientDataCDISC(patientList) {
const dataPromises = [];
const STUDYID = 'optimise';
File demographicDataController.js
has 627 lines of code (exceeds 250 allowed). Consider refactoring. Open
import ErrorHelper from '../utils/error_helper';
import message from '../utils/message-utils';
import formatToJSON from '../utils/format-response';
import moment from 'moment';
import { DemographicCore, MedicalHistoryCore, ImmunisationCore, PregnancyCore } from '../core/demographic';
File patientProfile.jsx
has 590 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 Icon from '../icon';
Function startSync
has 232 lines of code (exceeds 25 allowed). Consider refactoring. Open
static async startSync(config) {
if (isSyncing && !config.adminPass)
return Promise.resolve();
Function mappingFields
has a Cognitive Complexity of 56 (exceeds 5 allowed). Consider refactoring. Open
export const mappingFields = (typeHash, references, originalValues, transformer) => {
const curry = el => {
const title = el[0];
let content = el[1];
if (content.hasOwnProperty('id')) {
- Read upRead up
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
File selector-utils.js
has 467 lines of code (exceeds 250 allowed). Consider refactoring. Open
import dbcon from '../utils/db-connection';
class SelectorUtils {
getConcomitantMeds(patientId, deleted) {
Consider simplifying this complex logical expression. Open
if ((body.hasOwnProperty('dose') && typeof body.dose !== 'number') ||
(body.hasOwnProperty('unit') && body.unit !== 'µg' && body.unit !== 'mg' && body.unit !== 'cc' && body.unit !== 'na') ||
(body.hasOwnProperty('form') && body.form !== 'OR' && body.form !== 'IV' && body.form !== 'IM' && body.form !== 'IT' && body.form !== 'SC' && body.form !== 'SL') ||
(body.hasOwnProperty('times') && typeof body.times !== 'number') ||
(body.hasOwnProperty('intervalUnit') && body.intervalUnit !== 'hour' && body.intervalUnit !== 'day' &&
File fullTimeline.jsx
has 438 lines of code (exceeds 250 allowed). Consider refactoring. Open
import React, { Component, Fragment } from 'react';
import { connect } from 'react-redux';
import { Link } from 'react-router-dom';
import moment from 'moment';
Function edssAlgorithm
has a Cognitive Complexity of 40 (exceeds 5 allowed). Consider refactoring. Open
function edssAlgorithm(FSArrayWithoutAmbulation, ambulationScore) {
if (FSArrayWithoutAmbulation.length === 0)
return '';
- Read upRead up
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 142 lines of code (exceeds 25 allowed). Consider refactoring. Open
render() {
const allVisitDates = this.props.data.visits.filter(el => el.type === 1).map(el => el.visitDate);
const allTestDates = this.props.data.tests.map(el => el.actualOccurredDate || el.expectedOccurDate);
const allTreatmentDates = this.props.data.treatments.map(el => el.startDate);
const allCEDates = [];
Function render
has 136 lines of code (exceeds 25 allowed). Consider refactoring. Open
render() {
const { patientProfile, match } = this.props;
const { params } = match;
const { pregnancyOutcomes } = this.props.fields;
Function render
has a Cognitive Complexity of 36 (exceeds 5 allowed). Consider refactoring. Open
render() {
const { patientProfile, match } = this.props;
const { params } = match;
const { pregnancyOutcomes } = this.props.fields;
- Read upRead up
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 getDerivedStateFromProps
has 135 lines of code (exceeds 25 allowed). Consider refactoring. Open
static getDerivedStateFromProps(props, state) {
let items = [];
let edssPoints = {};
let maxTimeStart = state.defaultTimeStart;