department-of-veterans-affairs/vets-website

View on GitHub

Showing 4,177 of 14,709 total issues

File NoFormPage.jsx has 437 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import React, { useEffect, useState } from 'react';
import { useSelector } from 'react-redux';
import { apiRequest } from 'platform/utilities/api';
import { formatSSN } from 'platform/utilities/ui';
import { isLoggedIn } from '@department-of-veterans-affairs/platform-user/selectors';
Severity: Minor
Found in src/applications/burials-ez/components/NoFormPage.jsx - About 6 hrs to fix

    Function AddressValidationRadio has 162 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    const AddressValidationRadio = props => {
      const { formData, setFormData } = props;
      const [apiData, setApiData] = useState([]);
      const [loading, isLoading] = useState(false);
    
    

      Function submitAppointmentOrRequest has 162 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      export function submitAppointmentOrRequest(history) {
        return async (dispatch, getState) => {
          const state = getState();
          const featureVAOSServiceVAAppointments = selectFeatureVAOSServiceVAAppointments(
            state,
      Severity: Major
      Found in src/applications/vaos/new-appointment/redux/actions.js - About 6 hrs to fix

        Function ChemHemDetails has 162 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        const ChemHemDetails = props => {
          const { record, fullState, runningUnitTest } = props;
          const user = useSelector(state => state.user.profile);
          const allowTxtDownloads = useSelector(
            state =>

          File constants.js has 436 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          export const FETCH_STATUS = {
            loading: 'loading',
            notStarted: 'notStarted',
            succeeded: 'succeeded',
            failed: 'failed',
          Severity: Minor
          Found in src/applications/vaos/utils/constants.js - About 6 hrs to fix

            Function Error has 161 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            const Error = () => {
              const { t } = useTranslation();
              const selectError = useMemo(makeSelectError, []);
              const { error } = useSelector(selectError);
            
            
            Severity: Major
            Found in src/applications/check-in/travel-claim/pages/error/index.jsx - About 6 hrs to fix

              Function SearchForm has a Cognitive Complexity of 42 (exceeds 5 allowed). Consider refactoring.
              Open

              const SearchForm = props => {
                const { folder, keyword, resultsCount, query, threadCount } = props;
                const mhvSecureMessagingFilterAccordion = useSelector(
                  state =>
                    state.featureToggles[

              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 form.js has 434 lines of code (exceeds 250 allowed). Consider refactoring.
              Open

              // platform imports
              import environment from 'platform/utilities/environment';
              import { VA_FORM_IDS } from 'platform/forms/constants';
              import { externalServices } from 'platform/monitoring/DowntimeNotification';
              import ezrSchema from 'vets-json-schema/dist/10-10EZR-schema.json';
              Severity: Minor
              Found in src/applications/ezr/config/form.js - About 6 hrs to fix

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

                import React from 'react';
                import userEvent from '@testing-library/user-event';
                import moment from 'moment';
                import MockDate from 'mockdate';
                import { mockFetch } from '@department-of-veterans-affairs/platform-testing/helpers';

                  Function NoFormPage has 160 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  export const NoFormPage = () => {
                    const [data, setData] = useState({});
                    const [loading, setLoading] = useState(true);
                    const loggedIn = useSelector(isLoggedIn);
                  
                  
                  Severity: Major
                  Found in src/applications/burials-ez/components/NoFormPage.jsx - About 6 hrs to fix

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

                      render() {
                        const { supplies, order, eligibility } = this.props;
                        const currentDate = moment();
                        const apneaSupplies = supplies.filter(
                          supply => supply.productGroup === APNEA,

                      Function ThreadDetails has 160 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                      const ThreadDetails = props => {
                        const { threadId } = useParams();
                        const { testing } = props;
                        const dispatch = useDispatch();
                        const location = useLocation();
                      Severity: Major
                      Found in src/applications/mhv-secure-messaging/containers/ThreadDetails.jsx - About 6 hrs to fix

                        File form.js has 433 lines of code (exceeds 250 allowed). Consider refactoring.
                        Open

                        import fullSchema from 'vets-json-schema/dist/686C-674-schema.json';
                        import environment from 'platform/utilities/environment';
                        import FormFooter from 'platform/forms/components/FormFooter';
                        import { externalServices } from 'platform/monitoring/DowntimeNotification';
                        import { VA_FORM_IDS } from 'platform/forms/constants';
                        Severity: Minor
                        Found in src/applications/disability-benefits/686c-674/config/form.js - About 6 hrs to fix

                          File BackendAppointmentServiceAlert.unit.spec.js has 433 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 { waitFor } from '@testing-library/dom';

                            Function DebtDetails has 159 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                            const DebtDetails = () => {
                              const { selectedDebt, debts } = useSelector(
                                ({ combinedPortal }) => combinedPortal.debtLetters,
                              );
                              const approvedLetterCodes = ['100', '101', '102', '109', '117', '123', '130'];

                              File addressPattern.jsx has 431 lines of code (exceeds 250 allowed). Consider refactoring.
                              Open

                              /**
                               * Web component version of address
                               */
                              import React from 'react';
                              import constants from 'vets-json-schema/dist/constants.json';

                                Function SearchResultsHeader has 158 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                export const SearchResultsHeader = props => {
                                  const { searchResults, pagination, query } = props;
                                  const {
                                    inProgress,
                                    context,

                                  Function NearbyLocations has 158 lines of code (exceeds 25 allowed). Consider refactoring.
                                  Open

                                  const NearbyLocations = props => {
                                    const [originalCoordinates, setOriginalCoordinates] = useState([]);
                                    const [nearbyVADistances, setNearbyVADistances] = useState(false);
                                    const dispatch = useDispatch();
                                  
                                  

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

                                      render() {
                                        const { supplies, order, eligibility } = this.props;
                                        const currentDate = moment();
                                        const accessorySupplies = supplies.filter(
                                          supply => supply.productGroup === ACCESSORY,
                                    Severity: Major
                                    Found in src/applications/disability-benefits/2346/components/Accessories.jsx - About 6 hrs to fix

                                      Function generateMedicationsContent has 158 lines of code (exceeds 25 allowed). Consider refactoring.
                                      Open

                                      export const generateMedicationsContent = record => {
                                        let content;
                                      
                                        if (record.type === medicationTypes.VA) {
                                          content = {
                                      Severity: Major
                                      Found in src/applications/mhv-medical-records/util/pdfHelpers/medications.js - About 6 hrs to fix
                                        Severity
                                        Category
                                        Status
                                        Source
                                        Language