department-of-veterans-affairs/vets-website

View on GitHub

Showing 4,231 of 14,884 total issues

Function transform has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
Open

export function transform(formConfig, form) {
  // Copy over sponsor data if the claimant is the veteran.
  const populateSponsorData = application =>
    isVeteran({ application })
      ? merge({}, application, {
Severity: Minor
Found in src/applications/pre-need-integration/utils/helpers.js - About 2 hrs to fix

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

export function updateRequiredFields(schema, uiSchema, formData, index = null) {
  if (!uiSchema) {
    return schema;
  }

Severity: Major
Found in src/platform/forms-system/src/js/state/helpers.js - About 2 hrs to fix

    File results-set-1-page-2-dynamic-content.jsx has 260 lines of code (exceeds 250 allowed). Consider refactoring.
    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

      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];
      Severity: Major
      Found in src/applications/discharge-wizard/helpers/index.jsx - About 2 hrs to fix

        Function IntroductionPage has 56 lines of code (exceeds 25 allowed). Consider refactoring.
        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

          const App = props => {
            const {
              children,
              features,
              fetchEnrollmentStatus,
          Severity: Major
          Found in src/applications/ezr/containers/App.jsx - About 2 hrs to fix

            Function getCards has 56 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              const getCards = () => {
                const combinedEnrollmentsObj = combineEnrollmentsWithStartMonthDGIB(
                  sortedEnrollmentsDGIB(enrollmentVerifications),
                );
                const combinedEnrollmentsValues =

              File ChangeOfAddressForm.jsx has 260 lines of code (exceeds 250 allowed). Consider refactoring.
              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

                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

                  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

                    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

                      ) => async (dispatch, getState) => {
                        if (!update) {
                          dispatch({ type: Actions.Thread.IS_LOADING, payload: true });
                        }
                        try {
                      Severity: Major
                      Found in src/applications/mhv-secure-messaging/actions/threads.js - About 2 hrs to fix

                        Function selectRequestedAppointmentData has 56 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                        export function selectRequestedAppointmentData(state, appointment) {
                          const featureVAOSServiceCCAppointments = selectFeatureVAOSServiceCCAppointments(
                            state,
                          );
                          const { facilityData } = state?.appointments || [];
                        Severity: Major
                        Found in src/applications/vaos/appointment-list/redux/selectors.js - About 2 hrs to fix

                          Function ReferralsAndRequests has 56 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                          export default function ReferralsAndRequests() {
                            const dispatch = useDispatch();
                          
                            const location = useLocation();
                            useEffect(
                          Severity: Major
                          Found in src/applications/vaos/referral-appointments/ReferralsAndRequests.jsx - About 2 hrs to fix

                            Function fetchConfirmedFutureAppointments has 56 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                            export function fetchConfirmedFutureAppointments() {
                              return async dispatch => {
                                dispatch({
                                  type: FETCH_CONFIRMED_FUTURE_APPOINTMENTS,
                                });
                            Severity: Major
                            Found in src/applications/personalization/appointments/actions/index.js - About 2 hrs to fix

                              Function downloadsReducer has 56 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                              export const downloadsReducer = (state = initialState, action) => {
                                switch (action.type) {
                                  case Actions.Downloads.GENERATE_CCD: {
                                    return {
                                      ...state,
                              Severity: Major
                              Found in src/applications/mhv-medical-records/reducers/downloads.js - About 2 hrs to fix

                                Function vitalReducer has 56 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                export const vitalReducer = (state = initialState, action) => {
                                  switch (action.type) {
                                    case Actions.Vitals.GET: {
                                      return {
                                        ...state,
                                Severity: Major
                                Found in src/applications/mhv-medical-records/reducers/vitals.js - About 2 hrs to fix

                                  Function initUserMock has 55 lines of code (exceeds 25 allowed). Consider refactoring.
                                  Open

                                  function initUserMock(token, level) {
                                    mock(token, {
                                      path: '/v0/user',
                                      verb: 'get',
                                      value: {
                                  Severity: Major
                                  Found in src/platform/testing/e2e-puppeteer/auth.js - About 2 hrs to fix

                                    Function checkValidSchema has 55 lines of code (exceeds 25 allowed). Consider refactoring.
                                    Open

                                    export function checkValidSchema(schema, errors = [], path = ['root']) {
                                      if (typeof schema.type !== 'string') {
                                        errors.push(`Missing type in ${path.join('.')} schema.`);
                                      }
                                    
                                    
                                    Severity: Major
                                    Found in src/platform/forms-system/src/js/helpers.js - About 2 hrs to fix

                                      Function ReviewFieldTemplate has 55 lines of code (exceeds 25 allowed). Consider refactoring.
                                      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;
                                      Severity: Major
                                      Found in src/platform/forms-system/src/js/review/ReviewFieldTemplate.jsx - About 2 hrs to fix
                                        Severity
                                        Category
                                        Status
                                        Source
                                        Language