Showing 4,177 of 14,709 total issues
Function UpcomingAppointmentsListItem
has 124 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
const UpcomingAppointmentsListItem = props => {
const { app, appointment, goToDetails, router, border, count } = props;
const { t } = useTranslation();
const { getCurrentPageFromRouter } = useFormRouting(router);
const page = getCurrentPageFromRouter();
File index.unit.spec.js
has 372 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
import React from 'react';
import MockDate from 'mockdate';
import { expect } from 'chai';
import moment from 'moment';
import { within } from '@testing-library/dom';
Function ContactInfoPage
has 123 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export default function ContactInfoPage() {
const pageTitle = useSelector(state => getPageTitle(state, pageKey));
const history = useHistory();
const dispatch = useDispatch();
Function fetchFlowEligibilityAndClinics
has a Cognitive Complexity of 33 (exceeds 5 allowed). Consider refactoring. Open
Open
export async function fetchFlowEligibilityAndClinics({
typeOfCare,
location,
directSchedulingEnabled,
useV2 = false,
- 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 VerifyEnrollmentsPage.jsx
has 371 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
import React, { useCallback, useEffect, useMemo, useState } from 'react';
import PropTypes from 'prop-types';
import { connect, useDispatch } from 'react-redux';
import { useHistory } from 'react-router-dom';
File form-submit-transform.js
has 371 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
// this constant maps the values on address.js in vets.json schema from VA.gov values to LTS values
// the lts values were found on the LTS database and LTS validates them, so we need to send correct value from here
const countries = [
{ schemaValue: 'USA', ltsValue: 'US', label: 'United States' },
{ schemaValue: 'AFG', ltsValue: 'AF', label: 'Afghanistan' },
File MOCK_VA_APPOINTMENTS.js
has 371 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
import { addDays, formatISO } from 'date-fns';
export default {
data: [
{
File index.js
has 370 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
import * as VAP_SERVICE from 'platform/user/profile/vap-svc/constants';
import { isEmpty, isEqual, pickBy } from 'lodash';
import { COPY_ADDRESS_MODAL_STATUS } from 'platform/user/profile/vap-svc/constants';
Function render
has 122 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
render() {
const {
value: items,
id,
options,
Function Compose
has 122 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
const Compose = () => {
const dispatch = useDispatch();
const recipients = useSelector(state => state.sm.recipients);
const { drafts, saveError } = useSelector(state => state.sm.threadDetails);
const signature = useSelector(state => state.sm.preferences.signature);
File VARequestLayout.unit.spec.js
has 370 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
import React from 'react';
import { expect } from 'chai';
import {
createTestStore,
renderWithStoreAndRouter,
Function DirectDeposit
has 122 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export const DirectDeposit = () => {
const directDepositHookResult = useDirectDeposit();
const {
ui,
Function RadiologyImagesList
has 122 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
const RadiologyImagesList = () => {
const apiImagingPath = `${
environment.API_URL
}/my_health/v1/medical_records/imaging`;
File helpers.js
has 370 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
import moment from 'moment-timezone';
import * as Sentry from '@sentry/browser';
import { datadogRum } from '@datadog/browser-rum';
import { snakeCase } from 'lodash';
import { generatePdf } from '@department-of-veterans-affairs/platform-pdf/exports';
Function getSelfEnteredData
has 122 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export const getSelfEnteredData = () => async dispatch => {
const fetchMap = {
activityJournal: getSeiActivityJournal,
allergies: getSeiAllergies,
demographics: getPatient,
Function MedicationsListFilter
has 122 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
const MedicationsListFilter = props => {
const { updateFilter, filterOption, setFilterOption, filterCount } = props;
const ref = useRef(null);
const mapFilterCountToFilterLabels = label => {
Function FormStartControls
has 121 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
const FormStartControls = props => {
const {
formId,
migrations,
startPage,
Function DebtLettersSummary
has 121 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
const DebtLettersSummary = () => {
const { debtLetters, mcp } = useSelector(
({ combinedPortal }) => combinedPortal,
);
const showDebtLetterDownload = useSelector(state =>
Function WhatToDoNext
has 121 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
const WhatToDoNext = props => {
const { router, appointments, action, goToDetails } = props;
const selectApp = useMemo(makeSelectApp, []);
const { app } = useSelector(selectApp);
const { t } = useTranslation();
Function Folders
has 121 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
const Folders = () => {
const dispatch = useDispatch();
const location = useLocation();
const alertList = useSelector(state => state.sm.alerts?.alertList);
const folders = useSelector(state => state.sm.folders.folderList);