department-of-veterans-affairs/vets-website

View on GitHub

Showing 4,231 of 14,884 total issues

Function medsIntro has 61 lines of code (exceeds 25 allowed). Consider refactoring.
Open

const medsIntro = (avs, fullState) => {
  return (
    <>
      <p>
        The medications listed below were reviewed with you by your provider and
Severity: Major
Found in src/applications/avs/components/YourHealthInformation.jsx - About 2 hrs to fix

    Function VetCenterHours has 61 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    const VetCenterHours = props => {
      const hoursH4Style = props.isSatelliteLocation
        ? 'force-small-header vads-u-margin-top--0 vads-u-line-height--1 vads-u-margin-bottom--1'
        : 'vads-u-font-size--lg vads-u-margin-top--0 vads-u-line-height--1 vads-u-margin-bottom--1';
      if (props.hours.length === 0)
    Severity: Major
    Found in src/applications/static-pages/facilities/vetCentersHours.jsx - About 2 hrs to fix

      Function HomepageSearch has 61 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      const HomepageSearch = () => {
        const [userInput, setUserInput] = useState('');
        const [latestSuggestions, setLatestSuggestions] = useState([]);
        const [typeaheadClicked, setTypeaheadClicked] = useState(false);
      
      
      Severity: Major
      Found in src/applications/static-pages/homepage/HomepageSearch.jsx - About 2 hrs to fix

        Function LanguagePicker has 61 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        function LanguagePicker() {
          const { i18n } = useTranslation();
          const { language } = i18n;
        
          function getUrl(lang) {
        Severity: Major
        Found in src/applications/check-in/components/LanguagePicker.jsx - About 2 hrs to fix

          Function useSendTravelPayClaim has 61 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          const useSendTravelPayClaim = appointment => {
            const [isLoading, setIsLoading] = useState(false);
            const [travelPayClaimError, setTravelPayClaimError] = useState(false);
            const [travelPayClaimRequested, setTravelPayClaimRequested] = useState();
          
          
          Severity: Major
          Found in src/applications/check-in/hooks/useSendTravelPayClaim.jsx - About 2 hrs to fix

            Function EmergencyContact has 61 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            const EmergencyContact = props => {
              const { router } = props;
              const { t } = useTranslation();
              const selectVeteranData = useMemo(makeSelectVeteranData, []);
              const { demographics } = useSelector(selectVeteranData);
            Severity: Major
            Found in src/applications/check-in/day-of/pages/EmergencyContact.jsx - About 2 hrs to fix

              Function NextOfKin has 61 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              const NextOfKin = props => {
                const { router } = props;
                const { t } = useTranslation();
                const selectVeteranData = useMemo(makeSelectVeteranData, []);
                const { demographics } = useSelector(selectVeteranData);
              Severity: Major
              Found in src/applications/check-in/day-of/pages/NextOfKin.jsx - About 2 hrs to fix

                Function IntroductionPage has 61 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                const IntroductionPage = props => {
                  const { route } = props;
                  const userLoggedIn = useSelector(state => isLoggedIn(state));
                  const userIdVerified = useSelector(state => isLOA3(state));
                
                
                Severity: Major
                Found in src/applications/simple-forms/21-4138/containers/IntroductionPage.jsx - About 2 hrs to fix

                  Function DeductionSampleTable has 61 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  const DeductionSampleTable = () => {
                    return (
                      <>
                        <p className="sr-only">
                          A sample two-column table from a pay stub showing common deductions and

                    Function updateFormData has 61 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                      const updateFormData = e => {
                        e.preventDefault();
                        if (isEditing) {
                          // find the one we are editing in the employeeRecords array
                          const updatedRecords = spEmploymentRecords.map((item, arrayIndex) => {

                      Function MessageThreadMeta has 61 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                      const MessageThreadMeta = props => {
                        const {
                          message,
                          fromMe,
                          replyMessage,

                        Function selectRequestedAppointmentDetails has 61 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

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

                          Function useAcceleratedData has 61 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                          const useAcceleratedData = () => {
                            const dispatch = useDispatch();
                          
                            const isAcceleratedDeliveryEnabled = useSelector(
                              state =>
                          Severity: Major
                          Found in src/applications/mhv-medical-records/hooks/useAcceleratedData.js - About 2 hrs to fix

                            File helpers.js has 268 lines of code (exceeds 250 allowed). Consider refactoring.
                            Open

                            import React from 'react';
                            import { CONTACTS } from '@department-of-veterans-affairs/component-library/contacts';
                            import constants from 'vets-json-schema/dist/constants.json';
                            
                            export const isChapterFieldRequired = (formData, option) =>
                            Severity: Minor
                            Found in src/applications/686c-674/config/helpers.js - About 2 hrs to fix

                              File EditContactList.jsx has 268 lines of code (exceeds 250 allowed). Consider refactoring.
                              Open

                              import React, { useCallback, useEffect, useMemo, useState } from 'react';
                              import { useDispatch, useSelector } from 'react-redux';
                              import { getVamcSystemNameFromVhaId } from 'platform/site-wide/drupal-static-data/source-files/vamc-ehr/utils';
                              import { selectEhrDataByVhaId } from 'platform/site-wide/drupal-static-data/source-files/vamc-ehr/selectors';
                              import { focusElement } from '@department-of-veterans-affairs/platform-utilities/ui';
                              Severity: Minor
                              Found in src/applications/mhv-secure-messaging/containers/EditContactList.jsx - About 2 hrs to fix

                                File MOCK_VA_APPOINTMENTS_OVER_30_DAYS.js has 268 lines of code (exceeds 250 allowed). Consider refactoring.
                                Open

                                import { addDays, formatISO } from 'date-fns';
                                
                                export default {
                                  data: [
                                    {

                                  Function getProfileInfoFieldAttributes has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
                                  Open

                                  export const getProfileInfoFieldAttributes = fieldName => {
                                    let apiRoute;
                                    let convertCleanDataToPayload;
                                    let title;
                                    let uiSchema;

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

                                  export const getInitialFormValues = options => {
                                    const { fieldName, data, modalData } = options;
                                  
                                    if (fieldName === FIELD_NAMES.EMAIL) {
                                      return data ? { ...data } : { emailAddress: '' };

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

                                  export default function vapService(state = initialState, action) {
                                    switch (action.type) {
                                      case VAP_SERVICE_TRANSACTIONS_FETCH_SUCCESS: {
                                        const transactions = action.data.map(transactionData =>
                                          // Wrap in a "data" property to imitate the API response for a single transaction
                                  Severity: Minor
                                  Found in src/platform/user/profile/vap-svc/reducers/index.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 formatOperatingHours has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
                                  Open

                                  export const formatOperatingHours = operatingHours => {
                                    if (!operatingHours) return operatingHours;
                                    // Remove all whitespace and sanitize dashes.
                                    const sanitizedOperatingHours = operatingHours
                                      .replace(/ /g, '')
                                  Severity: Minor
                                  Found in src/applications/facility-locator/utils/helpers.jsx - 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

                                  Severity
                                  Category
                                  Status
                                  Source
                                  Language