Showing 4,177 of 14,709 total issues
Function generateResultsMedicationListContent
has a Cognitive Complexity of 45 (exceeds 5 allowed). Consider refactoring. Open
Open
const generateResultsMedicationListContent = async (
medication,
doc,
results,
hasHorizontalRule,
- 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 SecondFAQSection
has 172 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export const SecondFAQSection = () => {
return (
<>
<h3 className="dhp-faq-section-header">
Connecting Your Device & Data Sharing
Function render
has 171 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
render() {
const {
activeEditView,
fieldName,
isEmpty,
Function IntroductionPage
has 171 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
const IntroductionPage = props => {
useEffect(() => {
focusElement('h1');
scrollTo('topContentElement');
}, []);
Function render
has 171 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
render() {
const {
activeEditView,
fieldName,
isEmpty,
Function render
has 171 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
render() {
const {
activeEditView,
fieldName,
isEmpty,
Function VaMedicalCenter
has 171 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
const VaMedicalCenter = props => {
const {
errorSchema,
formContext,
formData,
Function render
has 171 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
render() {
const {
activeEditView,
fieldName,
isEmpty,
Function render
has 171 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
render() {
const { supplies, order, eligibility } = this.props;
const currentDate = moment();
const batterySupplies = supplies.filter(
batterySupply => batterySupply.productGroup === BATTERY,
Function Navigation
has 171 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
const Navigation = () => {
const [isMobile, setIsMobile] = useState(true);
const [isNavigationOpen, setIsNavigationOpen] = useState(false);
const location = useLocation();
const activeFolder = useSelector(folder);
Function submitFiles
has 171 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export function submitFiles(claimId, trackedItem, files) {
let filesComplete = 0;
let bytesComplete = 0;
let hasError = false;
const totalSize = files.reduce((sum, file) => sum + file.file.size, 0);
Function uiSchema
has 170 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export function uiSchema(
label = 'Address',
useStreet3 = false,
isRequired = null,
ignoreRequired = false,
Function AlertBackgroundBox
has 170 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
const AlertBackgroundBox = props => {
const dispatch = useDispatch();
const alertList = useSelector(state => state.sm.alerts?.alertList);
const folder = useSelector(state => state.sm.folders?.folder);
const [alertContent, setAlertContent] = useState('');
File pdfConfigs.js
has 450 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
import {
createNoDescriptionText,
createOriginalFillRecord,
dateFormat,
processList,
File YourHealthInformation.jsx
has 449 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
import React from 'react';
import PropTypes from 'prop-types';
import { useSelector } from 'react-redux';
import { parse } from 'date-fns';
Function MicroDetails
has 169 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
const MicroDetails = props => {
const { record, fullState, runningUnitTest } = props;
const user = useSelector(state => state.user.profile);
const allowTxtDownloads = useSelector(
state =>
Function useStorage
has 168 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
const useStorage = (app, local = false) => {
const STORAGE_KEYS = useMemo(
() => {
return createStorageKeys({ app });
},
Function ReplyForm
has 168 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
const ReplyForm = props => {
const {
cannotReply,
drafts,
replyMessage,
Function transformVAOSAppointment
has 168 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export function transformVAOSAppointment(appt) {
const appointmentType = getAppointmentType(appt);
const isCC = appt.kind === 'cc';
const isVideo = appt.kind === 'telehealth';
const isAtlas = !!appt.telehealth?.atlas;
File ReviewPage.jsx
has 446 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
import React, { useLayoutEffect } from 'react';
import { useFormikContext } from 'formik';
import { Link, useLocation } from 'react-router-dom';
import { VaOnThisPage } from '@department-of-veterans-affairs/component-library/dist/react-bindings';
import {