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
- 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 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
- 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 11 (exceeds 5 allowed). Consider refactoring. Open
render() {
if (this.props.data.demographicData) {
if (this.props.data.demographicData.gender === 1)
return 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 _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;
- 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 11 (exceeds 5 allowed). Consider refactoring. Open
render() {
const { editing } = this.state;
const { data, typedict } = this.props;
return (
<div className={style.interruption} style={{
- 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 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')}`;
- 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 registerValidSW
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
function registerValidSW(swUrl, config) {
navigator.serviceWorker
.register(swUrl)
.then(registration => {
registration.onupdatefound = () => {
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 : '',
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 = [];
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,
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);
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) {
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);
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;