department-of-veterans-affairs/vets-website

View on GitHub

Showing 4,177 of 14,709 total issues

Function UpcomingAppointmentsListItem has 124 lines of code (exceeds 25 allowed). Consider refactoring.
Open

const UpcomingAppointmentsListItem = props => {
  const { app, appointment, goToDetails, router, border, count } = props;
  const { t } = useTranslation();
  const { getCurrentPageFromRouter } = useFormRouting(router);
  const page = getCurrentPageFromRouter();
Severity: Major
Found in src/applications/check-in/components/UpcomingAppointmentsListItem.jsx - About 4 hrs to fix

    File index.unit.spec.js has 372 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    import React from 'react';
    import MockDate from 'mockdate';
    import { expect } from 'chai';
    import moment from 'moment';
    import { within } from '@testing-library/dom';

      Function ContactInfoPage has 123 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      export default function ContactInfoPage() {
        const pageTitle = useSelector(state => getPageTitle(state, pageKey));
      
        const history = useHistory();
        const dispatch = useDispatch();
      Severity: Major
      Found in src/applications/vaos/new-appointment/components/ContactInfoPage.jsx - About 4 hrs to fix

        Function fetchFlowEligibilityAndClinics has a Cognitive Complexity of 33 (exceeds 5 allowed). Consider refactoring.
        Open

        export async function fetchFlowEligibilityAndClinics({
          typeOfCare,
          location,
          directSchedulingEnabled,
          useV2 = false,
        Severity: Minor
        Found in src/applications/vaos/services/patient/index.js - About 4 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 VerifyEnrollmentsPage.jsx has 371 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        import React, { useCallback, useEffect, useMemo, useState } from 'react';
        import PropTypes from 'prop-types';
        import { connect, useDispatch } from 'react-redux';
        import { useHistory } from 'react-router-dom';
        
        

          File form-submit-transform.js has 371 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          // this constant maps the values on address.js in vets.json schema from VA.gov values to LTS values
          // the lts values were found on the LTS database and LTS validates them, so we need to send correct value from here
          const countries = [
            { schemaValue: 'USA', ltsValue: 'US', label: 'United States' },
            { schemaValue: 'AFG', ltsValue: 'AF', label: 'Afghanistan' },

            File MOCK_VA_APPOINTMENTS.js has 371 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

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

              File index.js has 370 lines of code (exceeds 250 allowed). Consider refactoring.
              Open

              import * as VAP_SERVICE from 'platform/user/profile/vap-svc/constants';
              
              import { isEmpty, isEqual, pickBy } from 'lodash';
              
              import { COPY_ADDRESS_MODAL_STATUS } from 'platform/user/profile/vap-svc/constants';
              Severity: Minor
              Found in src/platform/user/profile/vap-svc/reducers/index.js - About 4 hrs to fix

                Function render has 122 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                  render() {
                    const {
                      value: items,
                      id,
                      options,

                  Function Compose has 122 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  const Compose = () => {
                    const dispatch = useDispatch();
                    const recipients = useSelector(state => state.sm.recipients);
                    const { drafts, saveError } = useSelector(state => state.sm.threadDetails);
                    const signature = useSelector(state => state.sm.preferences.signature);
                  Severity: Major
                  Found in src/applications/mhv-secure-messaging/containers/Compose.jsx - About 4 hrs to fix

                    File VARequestLayout.unit.spec.js has 370 lines of code (exceeds 250 allowed). Consider refactoring.
                    Open

                    import React from 'react';
                    import { expect } from 'chai';
                    import {
                      createTestStore,
                      renderWithStoreAndRouter,
                    Severity: Minor
                    Found in src/applications/vaos/components/layout/VARequestLayout.unit.spec.js - About 4 hrs to fix

                      Function DirectDeposit has 122 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                      export const DirectDeposit = () => {
                        const directDepositHookResult = useDirectDeposit();
                      
                        const {
                          ui,

                        Function RadiologyImagesList has 122 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                        const RadiologyImagesList = () => {
                          const apiImagingPath = `${
                            environment.API_URL
                          }/my_health/v1/medical_records/imaging`;
                        
                        

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

                          import moment from 'moment-timezone';
                          import * as Sentry from '@sentry/browser';
                          import { datadogRum } from '@datadog/browser-rum';
                          import { snakeCase } from 'lodash';
                          import { generatePdf } from '@department-of-veterans-affairs/platform-pdf/exports';
                          Severity: Minor
                          Found in src/applications/mhv-medical-records/util/helpers.js - About 4 hrs to fix

                            Function getSelfEnteredData has 122 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                            export const getSelfEnteredData = () => async dispatch => {
                              const fetchMap = {
                                activityJournal: getSeiActivityJournal,
                                allergies: getSeiAllergies,
                                demographics: getPatient,
                            Severity: Major
                            Found in src/applications/mhv-medical-records/actions/selfEnteredData.js - About 4 hrs to fix

                              Function MedicationsListFilter has 122 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                              const MedicationsListFilter = props => {
                                const { updateFilter, filterOption, setFilterOption, filterCount } = props;
                                const ref = useRef(null);
                              
                                const mapFilterCountToFilterLabels = label => {

                                Function FormStartControls has 121 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                const FormStartControls = props => {
                                  const {
                                    formId,
                                    migrations,
                                    startPage,
                                Severity: Major
                                Found in src/platform/forms/save-in-progress/FormStartControls.jsx - About 4 hrs to fix

                                  Function DebtLettersSummary has 121 lines of code (exceeds 25 allowed). Consider refactoring.
                                  Open

                                  const DebtLettersSummary = () => {
                                    const { debtLetters, mcp } = useSelector(
                                      ({ combinedPortal }) => combinedPortal,
                                    );
                                    const showDebtLetterDownload = useSelector(state =>

                                    Function WhatToDoNext has 121 lines of code (exceeds 25 allowed). Consider refactoring.
                                    Open

                                    const WhatToDoNext = props => {
                                      const { router, appointments, action, goToDetails } = props;
                                      const selectApp = useMemo(makeSelectApp, []);
                                      const { app } = useSelector(selectApp);
                                      const { t } = useTranslation();
                                    Severity: Major
                                    Found in src/applications/check-in/components/WhatToDoNext.jsx - About 4 hrs to fix

                                      Function Folders has 121 lines of code (exceeds 25 allowed). Consider refactoring.
                                      Open

                                      const Folders = () => {
                                        const dispatch = useDispatch();
                                        const location = useLocation();
                                        const alertList = useSelector(state => state.sm.alerts?.alertList);
                                        const folders = useSelector(state => state.sm.folders.folderList);
                                      Severity: Major
                                      Found in src/applications/mhv-secure-messaging/containers/Folders.jsx - About 4 hrs to fix
                                        Severity
                                        Category
                                        Status
                                        Source
                                        Language