Showing 380 of 1,390 total issues
Function render
has 70 lines of code (exceeds 25 allowed). Consider refactoring. Open
render() {
const { patientProfile, fields } = this.props;
const { interruptionReasons, meddra_Hash } = fields;
let _style = style;
Function render
has 69 lines of code (exceeds 25 allowed). Consider refactoring. Open
render() {
const { match, location } = this.props;
const { pregnancySubStudyConsent } = this.props.data;
const pageNumberToElementMap = {
0: <VisitFrontPageIntroduction match={match} location={location} />,
Function filterEmptyRenders
has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring. Open
const filterEmptyRenders = (allFields, inputType, typedict) => allFields.map(data => {
const toTitleCase = (str) => str.replace(/\w\S*/g, (txt) => txt.charAt(0).toUpperCase() + txt.substr(1).toLowerCase());
let value;
- 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
Consider simplifying this complex logical expression. Open
if (entryType === 1) {
body.pregnancy.startDate = this.state.pregnancyStartDate ? this.state.pregnancyStartDate.toISOString() : null;
}
else {
body.pregnancy.outcome = (entryType === 3 && this.state.pregnancyOutcome)
File editCommunication.jsx
has 276 lines of code (exceeds 250 allowed). Consider refactoring. Open
import React, { Component } from 'react';
import { connect } from 'react-redux';
import moment from 'moment';
import { Editor, EditorState, RichUtils, convertToRaw, convertFromRaw } from 'draft-js';
import { formatTests, formatEvents, formatTreatments, formatSymptomsAndSigns, formatVS, formatEdss } from './communicationTemplates';
Function mappingFields
has 65 lines of code (exceeds 25 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')) {
Function _getNewStateFromProps
has 65 lines of code (exceeds 25 allowed). Consider refactoring. Open
static _getNewStateFromProps(props) {
const { patientProfile, data, match } = props;
const { params } = match;
Function render
has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring. Open
render() {
let _style = style;
if (this.props.override_style) {
_style = { ...style, ...this.props.override_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 _getNewStateFromProps
has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring. Open
static _getNewStateFromProps(props) {
const { patientProfile, data, match } = props;
const { params } = match;
- 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 64 lines of code (exceeds 25 allowed). Consider refactoring. Open
render() {
return (
<>
You can append these pre-composed paragraphs:<br /><br />
<div className={style.commentButtonsGroup}>
Function _updateStatus
has 63 lines of code (exceeds 25 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;
Function render
has 62 lines of code (exceeds 25 allowed). Consider refactoring. Open
render() {
const { params: { currentPage, visitId, patientId } } = this.props.match;
const { onClickNext, formSaved } = this.props;
const { pregnancySubStudyConsent } = this.props.data;
const searchString = this.props.location.search;
Function curry
has 62 lines of code (exceeds 25 allowed). Consider refactoring. Open
const curry = el => {
const title = el[0];
let content = el[1];
if (content.hasOwnProperty('id')) {
if (transformer !== undefined)
Function render
has 62 lines of code (exceeds 25 allowed). Consider refactoring. Open
render() {
const { drug, dose, unit, form, times } = this.state;
const { drugs } = this.props;
return (
<>
Function render
has 61 lines of code (exceeds 25 allowed). Consider refactoring. Open
render() {
let scaffold_style = _scaffold_style;
if (this.props.override_style) {
scaffold_style = { ..._scaffold_style, ...this.props.override_style };
}
Function render
has 61 lines of code (exceeds 25 allowed). Consider refactoring. Open
render() {
const { patientProfile, fields } = this.props;
const { pregnancyOutcomes, meddra_Hash } = fields;
if (!patientProfile.fetching) {
return (
Function render
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
render() {
const { patientProfile, fields } = this.props;
const { interruptionReasons, meddra_Hash } = fields;
let _style = 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 _formatBody
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
_formatBody(update, add) {
const { params } = this.props.match;
const { outcomeApplicable, pregnancyEntry } = this.state;
const entryType = pregnancyEntry.type === 1 ? 1 : (outcomeApplicable === 'yes' ? 3 : 2);
- 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 _handleSubmit
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
_handleSubmit(ev) {
ev.preventDefault();
if (this.state.lastSubmit && (new Date()).getTime() - this.state.lastSubmit < 500 ? true : false)
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 createTreatment
has 60 lines of code (exceeds 25 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;
}