Showing 3,723 of 12,672 total issues
Function ReplyDraftItem
has 481 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
const ReplyDraftItem = props => {
const {
draft,
drafts,
cannotReply,
File actions.js
has 938 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
/* eslint-disable camelcase */
import moment from 'moment';
import * as Sentry from '@sentry/browser';
import { recordEvent } from '@department-of-veterans-affairs/platform-monitoring/exports';
import { selectVAPResidentialAddress } from '@department-of-veterans-affairs/platform-user/selectors';
Function CalculateYourBenefitsForm
has a Cognitive Complexity of 110 (exceeds 5 allowed). Consider refactoring. Open
Open
function CalculateYourBenefitsForm({
calculatorInputChange,
displayedInputs,
eligibility,
eligibilityChange,
- 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 V3BasePage
has 442 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export default function V3BasePage() {
/** @param {import('react').FormEvent | import('@department-of-veterans-affairs/web-components/dist/types/components').VaSelectCustomEvent } evt */
function updateValue(evt) {
const { value, name } = /** @type {HTMLInputElement} */ (evt.target);
const display = document.getElementById(`${name}Value`);
File V1V3Page.jsx
has 886 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
/**
* This page is for testing the compatibility of running v1 and v3 components on the same page.
*/
import React, { useState } from 'react';
Function getNextEvents
has 426 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export function getNextEvents(appeal) {
const { type: currentStatus, details } = appeal.attributes.status;
const appealType = appeal.type;
switch (currentStatus) {
Function covid19VaccineReducer
has 425 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export default function covid19VaccineReducer(state = initialState, action) {
switch (action.type) {
case FORM_PAGE_OPENED: {
const { newBooking } = state;
const { data, schema } = setupFormData(
File ComposeForm.jsx
has 865 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
import React, { useState, useEffect, useMemo, useCallback } from 'react';
import PropTypes from 'prop-types';
import { validateNameSymbols } from 'platform/forms-system/src/js/web-component-patterns/fullNamePattern';
import { useDispatch, useSelector } from 'react-redux';
import { useHistory } from 'react-router-dom';
Function AppointmentDetails
has 407 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
const AppointmentDetails = props => {
const { router } = props;
const { t } = useTranslation();
const dispatch = useDispatch();
const {
Function ComposeForm
has a Cognitive Complexity of 101 (exceeds 5 allowed). Consider refactoring. Open
Open
const ComposeForm = props => {
const { pageTitle, headerRef, draft, recipients, signature } = props;
const {
noAssociations,
allTriageGroupsBlocked,
- 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 SearchPage
has 405 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
const SearchPage = props => {
const searchResultTitleRef = useRef(null);
const previousLocationInputString = useRef(
props.currentQuery.locationInputString,
);
Function LandingPage
has 386 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
const LandingPage = () => {
const dispatch = useDispatch();
const fullState = useSelector(state => state);
const displayNotes = useSelector(selectNotesFlag);
const displayVaccines = useSelector(selectVaccinesFlag);
File FilterBeforeResults.jsx
has 808 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
/* eslint-disable no-unused-vars */
import React, { useState, useEffect } from 'react';
import { useHistory } from 'react-router-dom';
import { connect } from 'react-redux';
import _ from 'lodash';
File index.js
has 803 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
/* istanbul ignore file */
/* eslint-disable camelcase */
const delay = require('mocker-api/lib/delay');
const moment = require('moment');
File reducer.js
has 796 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
/* eslint-disable sonarjs/max-switch-cases */
import { getDefaultFormState } from '@department-of-veterans-affairs/react-jsonschema-form/lib/utils';
import set from 'platform/utilities/data/set';
import unset from 'platform/utilities/data/unset';
File form.js
has 784 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
import React from 'react';
import currentOrPastDateUI from 'platform/forms-system/src/js/definitions/currentOrPastDate';
// In a real app this would not be imported directly; instead the schema you
File msw-mocks.js
has 782 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
import { rest } from 'msw';
import mockDisabilityCompensation from '@@profile/mocks/endpoints/disability-compensations';
import environment from '~/platform/utilities/environment';
import mockDD4CNPSuccess from './tests/fixtures/dd4cnp/dd4cnp-is-set-up.json';
File form.js
has 780 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
import fullSchema from 'vets-json-schema/dist/686C-674-schema.json';
import environment from 'platform/utilities/environment';
import FormFooter from 'platform/forms/components/FormFooter';
import { externalServices } from 'platform/monitoring/DowntimeNotification';
import { VA_FORM_IDS } from 'platform/forms/constants';
File helpers.jsx
has 768 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
/* eslint-disable no-nested-ternary */
/* eslint-disable react/jsx-key */ // keys are defined, error being thrown in eslint even when key is defined
import React from 'react';
import ADDRESS_DATA from 'platform/forms/address/data';
import { v4 as uuidv4 } from 'uuid';
Function PrescriptionDetails
has 360 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
const PrescriptionDetails = () => {
const prescription = useSelector(
state => state.rx.prescriptions?.prescriptionDetails,
);
const prescriptionsApiError = useSelector(