department-of-veterans-affairs/vets-website

View on GitHub

Showing 4,177 of 14,709 total issues

Function reducer has 98 lines of code (exceeds 25 allowed). Consider refactoring.
Open

export default function reducer(state = initialState, action = {}) {
  switch (action.type) {
    case FETCH_STARTED: {
      return { ...state, loadingStatus: LOADING_STATES.pending };
    }

    Function StepThree has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring.
    Open

    const StepThree = ({ formValues }) => {
      const reasonCode = formValues['4_reason'];
      const noPrevApp = formValues['8_prevApplication'] === '2';
      const prevAppType = formValues['10_prevApplicationType'];
      const prevAppYear = formValues['9_prevApplicationYear'];
    Severity: Minor
    Found in src/applications/discharge-wizard/components/gpSteps/StepThree.jsx - About 3 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 AppointmentListItem has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring.
    Open

    const AppointmentListItem = props => {
      const { appointment, goToDetails, router, app, page, count } = props;
      const { t } = useTranslation();
      const selectFeatureToggles = useMemo(makeSelectFeatureToggles, []);
      const { isMedicationReviewContentEnabled } = useSelector(

    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 ComparePage has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring.
    Open

    export function ComparePage({
      allLoaded,
      compare,
      dispatchFetchCompareDetails,
      dispatchRemoveCompareInstitution,
    Severity: Minor
    Found in src/applications/gi/containers/ComparePage.jsx - About 3 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 validateMilitaryHistory has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring.
    Open

    export const validateMilitaryHistory = (errors, serviceRecords, formData) => {
      // Map the highestRank to the corresponding Rank Description from jsonData
      const rankMap = jsonData.reduce((map, rank) => {
        // eslint-disable-next-line no-param-reassign
        map[rank['Rank Code'].toUpperCase()] = rank[
    Severity: Minor
    Found in src/applications/pre-need-integration/utils/helpers.js - About 3 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

    File ConfirmationResponses.jsx has 329 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    import React from 'react';
    import PropTypes from 'prop-types';
    import { format } from 'date-fns';
    import GetFormHelp from './GetFormHelp';
    
    
    Severity: Minor
    Found in src/applications/fry-dea/components/ConfirmationResponses.jsx - About 3 hrs to fix

      File EvidencePrivateRecords.jsx has 329 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      import React, { useState, useEffect } from 'react';
      import { VaTextInput } from '@department-of-veterans-affairs/component-library/dist/react-bindings';
      
      import { EVIDENCE_PRIVATE_PATH } from '../constants';
      import { content } from '../content/evidencePrivateRecords';
      Severity: Minor
      Found in src/applications/appeals/995/components/EvidencePrivateRecords.jsx - About 3 hrs to fix

        File EvidencePrivateRecords.jsx has 329 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        import React, { useState, useEffect } from 'react';
        import { VaTextInput } from '@department-of-veterans-affairs/component-library/dist/react-bindings';
        
        import { EVIDENCE_PRIVATE_PATH } from '../constants';
        import { content } from '../content/evidencePrivateRecords';

          File migrations.js has 329 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          import get from 'platform/utilities/data/get';
          import set from 'platform/utilities/data/set';
          import { isValidDateRange } from 'platform/forms/validations';
          import { convertToDateField } from 'platform/forms-system/src/js/validation';
          import { isValidCentralMailPostalCode } from 'platform/forms/address/validations';
          Severity: Minor
          Found in src/applications/pensions/migrations.js - About 3 hrs to fix

            File YourClaimsPageV2.jsx has 329 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            import React from 'react';
            import { connect } from 'react-redux';
            import { VaPagination } from '@department-of-veterans-affairs/component-library/dist/react-bindings';
            import PropTypes from 'prop-types';
            
            
            Severity: Minor
            Found in src/applications/claims-status/containers/YourClaimsPageV2.jsx - About 3 hrs to fix

              File SchoolLocations.jsx has 329 lines of code (exceeds 250 allowed). Consider refactoring.
              Open

              import React, { useEffect, useState } from 'react';
              import PropTypes from 'prop-types';
              import { BrowserRouter as Router, Link } from 'react-router-dom';
              import recordEvent from 'platform/monitoring/record-event';
              import { waitForRenderThenFocus } from 'platform/utilities/ui';
              Severity: Minor
              Found in src/applications/gi/components/profile/SchoolLocations.jsx - About 3 hrs to fix

                Function GuardianInformation has 97 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                export default function GuardianInformation(schema, options) {
                  // Use the defaults as necessary, but override with the options given
                  const { fields, required } = {
                    ...defaults(),
                    ...options,
                Severity: Major
                Found in src/applications/edu-benefits/5490/components/GuardianInformation.jsx - About 3 hrs to fix

                  Function getSignlePreviousEnrollmentsDGIB has 97 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  export const getSignlePreviousEnrollmentsDGIB = enrollment => {
                    const myUUID = uuidv4();
                    return (
                      <div className="vye-top-border" key={myUUID}>
                        {!!enrollment?.verificationMethod &&
                  Severity: Major
                  Found in src/applications/verify-your-enrollment/helpers.jsx - About 3 hrs to fix

                    Function IdentityPage has 97 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                    const IdentityPage = props => {
                      const { router } = props;
                      const {
                        statusCode,
                        vesRecordFound,
                    Severity: Major
                    Found in src/applications/hca/containers/IdentityPage.jsx - About 3 hrs to fix

                      Function EkgDetails has 97 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                      const EkgDetails = props => {
                        const { record, runningUnitTest } = props;
                        const allowTxtDownloads = useSelector(
                          state =>
                            state.featureToggles[

                        File profile.js has 327 lines of code (exceeds 250 allowed). Consider refactoring.
                        Open

                        import React from 'react';
                        import PropTypes from 'prop-types';
                        
                        import {
                          isValidEmail,

                          Function UnderReview has 96 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                          export function UnderReview(response, name) {
                            return (
                              <>
                                <div>
                                  <va-alert
                          Severity: Major
                          Found in src/applications/fry-dea/components/ConfirmationResponses.jsx - About 3 hrs to fix

                            Function createAppointments has 96 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                            const createAppointments = (
                              token = defaultUUID,
                              demographicsNeedsUpdate = false,
                              demographicsConfirmedAt = null,
                              nextOfKinNeedsUpdate = false,
                            Severity: Major
                            Found in src/applications/check-in/api/local-mock-api/mocks/v2/shared/get.js - About 3 hrs to fix

                              Function StepComponent has 96 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                              const StepComponent = props => {
                                const { step, clickHandler } = props;
                                const data = orientationSteps[step];
                                let content;
                              
                              
                              Severity: Major
                              Found in src/applications/vre/28-1900/orientation/StepComponent.jsx - About 3 hrs to fix

                                Function adaptPayload has 96 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                const adaptPayload = formData => {
                                  const payload = {};
                                  const {
                                    fullName: { firstName: first, lastName: last },
                                    date,
                                  Severity
                                  Category
                                  Status
                                  Source
                                  Language