department-of-veterans-affairs/vets-website

View on GitHub

Showing 4,177 of 14,709 total issues

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

import React from 'react';
import { expect } from 'chai';
import moment from 'moment';
import { waitFor, waitForElementToBeRemoved } from '@testing-library/dom';
import { cleanup } from '@testing-library/react';

    Function TravelMileage has 133 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    const TravelMileage = props => {
      const { router } = props;
      const { t } = useTranslation();
      const dispatch = useDispatch();
    
    
    Severity: Major
    Found in src/applications/check-in/travel-claim/pages/travel-mileage/index.jsx - About 5 hrs to fix

      Function AppointmentsPage has 133 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      export default function AppointmentsPage() {
        const history = useHistory();
        const location = useLocation();
        const dispatch = useDispatch();
        const [hasTypeChanged, setHasTypeChanged] = useState(false);

        File EvidenceSummaryLists.jsx has 388 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        import React from 'react';
        import { Link } from 'react-router';
        import PropTypes from 'prop-types';
        
        import readableList from 'platform/forms-system/src/js/utilities/data/readableList';
        Severity: Minor
        Found in src/applications/appeals/995/components/EvidenceSummaryLists.jsx - About 5 hrs to fix

          File topic.js has 388 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          import { flatten, orderBy } from 'lodash';
          import clone from 'platform/utilities/data/clone';
          import get from 'platform/utilities/data/get';
          import set from 'platform/utilities/data/set';
          import { createSelector } from 'reselect';
          Severity: Minor
          Found in src/applications/ask-a-question/form/inquiry/topic/topic.js - About 5 hrs to fix

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

            import { mockFetch } from '@department-of-veterans-affairs/platform-testing/helpers';
            import { fireEvent, waitFor } from '@testing-library/react';
            import userEvent from '@testing-library/user-event';
            
            import { expect } from 'chai';

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

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

                Function SipsDevModal has 132 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                const SipsDevModal = props => {
                  const { pageList, form, locationPathname } = props || {};
                  const { formId, version, data, submission } = form || {};
                
                  const [isModalVisible, toggleModal] = useState(false);
                Severity: Major
                Found in src/platform/forms/save-in-progress/SaveInProgressDevModal.jsx - About 5 hrs to fix

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

                    render() {
                      const {
                        benefitSummaryOptions,
                        requestOptions,
                        isVeteran,
                  Severity: Major
                  Found in src/applications/letters/containers/VeteranBenefitSummaryLetter.jsx - About 5 hrs to fix

                    Function AllergyListItem has 132 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                    const AllergyListItem = props => {
                      const { record } = props;
                      return (
                        <va-card
                          background

                      File ComboBox.jsx has 386 lines of code (exceeds 250 allowed). Consider refactoring.
                      Open

                      // Description: ComboBox component for the disability benefits form.
                      import React from 'react';
                      import PropTypes from 'prop-types';
                      import { VaTextInput } from '@department-of-veterans-affairs/component-library/dist/react-bindings';
                      import { fullStringSimilaritySearch } from 'platform/forms-system/src/js/utilities/addDisabilitiesStringSearch';

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

                        import moment from 'moment-timezone';
                        import cheerio from 'cheerio';
                        import { generatePdf } from '@department-of-veterans-affairs/platform-pdf/exports';
                        import * as Sentry from '@sentry/browser';
                        import {
                        Severity: Minor
                        Found in src/applications/mhv-medications/util/helpers.js - About 5 hrs to fix

                          Function App has a Cognitive Complexity of 35 (exceeds 5 allowed). Consider refactoring.
                          Open

                          export default function App({ children }) {
                            const dispatch = useDispatch();
                            const profileLoading = useSelector(state => isProfileLoading(state));
                            const userLoggedIn = useSelector(state => isLoggedIn(state));
                          
                          
                          Severity: Minor
                          Found in src/applications/travel-pay/containers/TravelPayStatusApp.jsx - About 5 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 transform has a Cognitive Complexity of 35 (exceeds 5 allowed). Consider refactoring.
                          Open

                          export function transform(formConfig, form) {
                            // Grab isBDD before things are changed/deleted
                            const isBDDForm = isBDD(form.data);
                            // Grab ratedDisabilities before they're deleted in case the page is inactive
                            // We need to send all of these to vets-api even if the veteran doesn't apply
                          Severity: Minor
                          Found in src/applications/disability-benefits/all-claims/submit-transformer.js - About 5 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 ResultCard has a Cognitive Complexity of 35 (exceeds 5 allowed). Consider refactoring.
                          Open

                          export function ResultCard({
                            compare,
                            estimated,
                            dispatchAddCompareInstitution,
                            dispatchRemoveCompareInstitution,
                          Severity: Minor
                          Found in src/applications/gi/containers/search/ResultCard.jsx - About 5 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 generateBlueButtonData has a Cognitive Complexity of 35 (exceeds 5 allowed). Consider refactoring.
                          Open

                          export const generateBlueButtonData = (
                            {
                              labsAndTests,
                              notes,
                              vaccines,
                          Severity: Minor
                          Found in src/applications/mhv-medical-records/util/pdfHelpers/blueButton.js - About 5 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 Description has 131 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                          function Description(props) {
                            const isClaimingBurialAllowance =
                              props.formData['view:claimedBenefits'].burialAllowance;
                            const serviceRequested =
                              props.formData?.burialAllowanceRequested?.service === true;

                            Function POARequestDetailsPage has 131 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                            const POARequestDetailsPage = () => {
                              const { poaRequests } = usePOARequests();
                              const { id } = useParams();
                            
                              const poaRequest = poaRequests.find(r => r.id === Number(id))?.attributes;

                              File AttachmentsList.jsx has 385 lines of code (exceeds 250 allowed). Consider refactoring.
                              Open

                              import React, { useEffect, useRef, useState } from 'react';
                              import { useDispatch } from 'react-redux';
                              import PropTypes from 'prop-types';
                              import recordEvent from 'platform/monitoring/record-event';
                              import { datadogRum } from '@datadog/browser-rum';
                              Severity: Minor
                              Found in src/applications/mhv-secure-messaging/components/AttachmentsList.jsx - About 5 hrs to fix

                                Function DownloadDateRange has 131 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                const DownloadDateRange = () => {
                                  const history = useHistory();
                                  const [selectedDate, setSelectedDate] = useState('');
                                  const [selectionError, setSelectionError] = useState(null);
                                  const [customFromDate, setCustomFromDate] = useState('');
                                  Severity
                                  Category
                                  Status
                                  Source
                                  Language