Showing 380 of 1,390 total issues
File index.js
has 388 lines of code (exceeds 250 allowed). Consider refactoring. Open
const fs = require('fs');
const path = require('path');
const { Readable } = require('stream');
const express = require('express');
const { app, session, BrowserWindow, ipcMain, dialog, Menu } = require('electron');
Function itemRenderer
has 126 lines of code (exceeds 25 allowed). Consider refactoring. Open
itemRenderer({ item, getItemProps, timelineContext }) {
let itemProps = getItemProps(item.itemProps);
const itemPropsStyle = {
...itemProps.style,
Function render
has a Cognitive Complexity of 33 (exceeds 5 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 = [];
- 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 availableFields
has 121 lines of code (exceeds 25 allowed). Consider refactoring. Open
function availableFields(state = initialState.availableFields, action) {
let newState;
let hash;
switch (action.type) {
case actionTypes.availableFields.GET_CE_TYPES_SUCCESS:
File calculator.jsx
has 366 lines of code (exceeds 250 allowed). Consider refactoring. Open
import React, { Component, Fragment } from 'react';
import { Redirect } from 'react-router-dom';
import { connect } from 'react-redux';
import { BackButton } from '../medicalData/utils';
import Helmet from '../scaffold/helmet';
Function searchEntry
has 119 lines of code (exceeds 25 allowed). Consider refactoring. Open
export const searchEntry = function (queryfield, queryvalue) {
switch (queryfield) {
case 'OPTIMISEID':
return new Promise((resolve, reject) => dbcon()('PATIENTS')
.select({ patientId: 'id' }, 'aliasId', 'uuid', 'optimiseConsent', 'participation')
File reducers.js
has 358 lines of code (exceeds 250 allowed). Consider refactoring. Open
import initialState from './initialState';
import { combineReducers } from 'redux';
import actionTypes from './actions/listOfActions';
import { dispatch as workerDispatch } from '../webWorker';
Function createCe
has a Cognitive Complexity of 31 (exceeds 5 allowed). Consider refactoring. Open
static createCe({ body, user }, res) {
if ((body.hasOwnProperty('visitId') || body.hasOwnProperty('patient')) && body.hasOwnProperty('dateStartDate') && body.hasOwnProperty('type') &&
typeof body.visitId === 'number' && typeof body.dateStartDate === 'string' && typeof body.type === 'number') {
const momentStart = moment(body.dateStartDate, moment.ISO_8601);
if (!momentStart.isValid()) {
- 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 utils.jsx
has 357 lines of code (exceeds 250 allowed). Consider refactoring. Open
import React, { Component, Fragment } from 'react';
import { Link } from 'react-router-dom';
import merge from 'deepmerge';
import moment from 'moment';
import { PickDate } from '../createMedicalElements/datepicker';
Function createTreatment
has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring. Open
static createTreatment({ body, user }, res) {
if (!(body.hasOwnProperty('visitId') && body.hasOwnProperty('drugId') && body.hasOwnProperty('startDate'))) {
res.status(400).json(ErrorHelper(message.userError.MISSINGARGUMENT));
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
File createConmitantMeds.jsx
has 350 lines of code (exceeds 250 allowed). Consider refactoring. Open
import React, { Component } from 'react';
import { connect } from 'react-redux';
import { BackButton } from '../medicalData/utils';
import store from '../../redux/store';
import { DeleteButton } from '../patientProfile/sharedComponents';
File treatmentInterruptions.jsx
has 345 lines of code (exceeds 250 allowed). Consider refactoring. Open
import React, { Component } from 'react';
import { connect } from 'react-redux';
import moment from 'moment';
import { BackButton } from './utils';
import { PickDate } from '../createMedicalElements/datepicker';
File editPregnancy.jsx
has 333 lines of code (exceeds 250 allowed). Consider refactoring. Open
import React, { Component } from 'react';
import { connect } from 'react-redux';
import moment from 'moment';
import { BackButton } from '../medicalData/utils';
import { PickDate } from '../createMedicalElements/datepicker';
Function editInterruption
has a Cognitive Complexity of 27 (exceeds 5 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;
- 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 95 lines of code (exceeds 25 allowed). Consider refactoring. Open
render() {
if (!this.originalValues || !this.EDSSFields_Hash_reverse || !this.EDSSFields) return null;
const { match: { params }, patientProfile: { visits } } = this.props;
Function _RouterAddOrUpdate
has 94 lines of code (exceeds 25 allowed). Consider refactoring. Open
static _RouterAddOrUpdate(req, res) {
if (optionsContainer.hasOwnProperty(`${req.params.dataType}`)) {
const options = optionsContainer[req.params.dataType];
if (!(req.body.hasOwnProperty(`${options.entryIdString}`) &&
(req.body.hasOwnProperty('add') || req.body.hasOwnProperty('update')))) {
Function render
has 90 lines of code (exceeds 25 allowed). Consider refactoring. Open
render() {
if (!this.state.dispatched) {
const { genders, dominant_hands, ethnicities, countries } = this.props.demofields;
let genders_sorted = [];
genders.forEach((el) => {
Function editConcomitantMed
has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring. Open
static editConcomitantMed({ body, user }, res) {
if (body.concomitantMedEntryId && typeof body.concomitantMedEntryId === 'number') {
const entryObj = { id: body.concomitantMedEntryId };
const { concomitantMedId, indication, startDate, endDate } = body;
if (concomitantMedId) {
- 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 erasePatient
has 88 lines of code (exceeds 25 allowed). Consider refactoring. Open
static erasePatient({ user, body }, res) {
let patientId = undefined;
if (user.adminPriv !== 1) {
res.status(401).json(ErrorHelper(message.userError.NORIGHTS));
return false;
File sync.js
has 313 lines of code (exceeds 250 allowed). Consider refactoring. Open
import os from 'os';
import request from 'request';
import { getEntry } from '../utils/controller-utils';
import dbcon from '../utils/db-connection';
import PatientCore from './patient';