Showing 4,231 of 14,884 total issues
Function transform
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
Open
export function transform(formConfig, form) {
// Copy over sponsor data if the claimant is the veteran.
const populateSponsorData = application =>
isVeteran({ application })
? merge({}, application, {
- 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 updateRequiredFields
has 56 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export function updateRequiredFields(schema, uiSchema, formData, index = null) {
if (!uiSchema) {
return schema;
}
File results-set-1-page-2-dynamic-content.jsx
has 260 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
import React, { Fragment } from 'react';
import { BATCHES } from './question-batches';
export const accordions = {
[BATCHES.BURN_PITS]: [
Function getBoardExplanation
has 56 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export const getBoardExplanation = formResponses => {
const reason = formResponses[SHORT_NAME_MAP.REASON];
const noPrevApp =
formResponses[SHORT_NAME_MAP.PREV_APPLICATION] === RESPONSES.NO;
const prevAppType = formResponses[SHORT_NAME_MAP.PREV_APPLICATION_TYPE];
Function IntroductionPage
has 56 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
const IntroductionPage = props => {
const { route } = props;
const { formConfig, pageList } = route;
useEffect(
Function App
has 56 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
const App = props => {
const {
children,
features,
fetchEnrollmentStatus,
Function getCards
has 56 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
const getCards = () => {
const combinedEnrollmentsObj = combineEnrollmentsWithStartMonthDGIB(
sortedEnrollmentsDGIB(enrollmentVerifications),
);
const combinedEnrollmentsValues =
File ChangeOfAddressForm.jsx
has 260 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
import React, { useEffect, useState } from 'react';
import PropTypes from 'prop-types';
import ADDRESS_DATA from 'platform/forms/address/data';
import { validateAsciiCharacters } from 'platform/user/profile/vap-svc/util';
import SchemaForm from '@department-of-veterans-affairs/platform-forms-system/SchemaForm';
Function ApplicantRelationshipReviewPage
has 56 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export function ApplicantRelationshipReviewPage(props) {
const { data, keyname = KEYNAME, primary = PRIMARY, secondary = SECONDARY } =
props || {};
const genOps = props.genOp || generateOptions;
const {
Function IdentityVerificationAlert
has 56 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export const IdentityVerificationAlert = () => {
const onVerifyEvent = recordEvent({ event: AUTH_EVENTS.VERIFY });
return (
<div className="vads-u-margin-top--6 vads-u-margin-bottom--8 vads-l-grid-container desktop-lg:vads-u-padding-x--0">
<va-alert
Function WarningExplanation
has 56 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
const WarningExplanation = () => {
const { statusCode } = useSelector(selectEnrollmentStatus);
// Declare content blocks for use
const {
Function getListOfThreads
has 56 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
) => async (dispatch, getState) => {
if (!update) {
dispatch({ type: Actions.Thread.IS_LOADING, payload: true });
}
try {
Function selectRequestedAppointmentData
has 56 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export function selectRequestedAppointmentData(state, appointment) {
const featureVAOSServiceCCAppointments = selectFeatureVAOSServiceCCAppointments(
state,
);
const { facilityData } = state?.appointments || [];
Function ReferralsAndRequests
has 56 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export default function ReferralsAndRequests() {
const dispatch = useDispatch();
const location = useLocation();
useEffect(
Function fetchConfirmedFutureAppointments
has 56 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export function fetchConfirmedFutureAppointments() {
return async dispatch => {
dispatch({
type: FETCH_CONFIRMED_FUTURE_APPOINTMENTS,
});
Function downloadsReducer
has 56 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export const downloadsReducer = (state = initialState, action) => {
switch (action.type) {
case Actions.Downloads.GENERATE_CCD: {
return {
...state,
Function vitalReducer
has 56 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export const vitalReducer = (state = initialState, action) => {
switch (action.type) {
case Actions.Vitals.GET: {
return {
...state,
Function initUserMock
has 55 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function initUserMock(token, level) {
mock(token, {
path: '/v0/user',
verb: 'get',
value: {
Function checkValidSchema
has 55 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export function checkValidSchema(schema, errors = [], path = ['root']) {
if (typeof schema.type !== 'string') {
errors.push(`Missing type in ${path.join('.')} schema.`);
}
Function ReviewFieldTemplate
has 55 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export default function ReviewFieldTemplate(props) {
const { children, uiSchema, schema, formContext } = props;
const label = uiSchema['ui:title'] || props.label;
const description = uiSchema['ui:description'];
const textDescription = typeof description === 'string' ? description : null;