department-of-veterans-affairs/vets-website

View on GitHub

Showing 3,724 of 12,675 total issues

Function prefillTransformerV4 has 125 lines of code (exceeds 25 allowed). Consider refactoring.
Open

export function prefillTransformerV4(pages, formData, metadata, state) {
  const bankInformation = state.data?.bankInformation || {};
  const claimant = state.data?.formData?.data?.attributes?.claimant || {};
  const serviceData = state.data?.formData?.data?.attributes?.serviceData || [];
  const contactInfo = claimant?.contactInfo || {};
Severity: Major
Found in src/applications/my-education-benefits/helpers.js - About 5 hrs to fix

    Function addressUISchema has 125 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    export const addressUISchema = (
      addressPath,
      title,
      reviewCard,
      fieldsAreRequired = true,
    Severity: Major
    Found in src/applications/disability-benefits/all-claims/utils/schemas.js - About 5 hrs to fix

      File ctaWidgets.js has 374 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      // Relative imports.
      import backendServices from '~/platform/user/profile/constants/backendServices';
      import featureFlagNames from '~/platform/utilities/feature-toggles/featureFlagNames';
      import { mhvUrl } from '~/platform/site-wide/mhv/utilities';
      import { getAppUrl } from '~/platform/utilities/registry-helpers';
      Severity: Minor
      Found in src/applications/static-pages/cta-widget/ctaWidgets.js - About 5 hrs to fix

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

        const fns = require('date-fns');
        
        const MOCK_VA_APPOINTMENTS = {
          data: [
            {

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

          export function uploadFile(
            file,
            uiOptions,
            onProgress,
            onChange,
          Severity: Major
          Found in src/platform/forms-system/src/js/actions.js - About 4 hrs to fix

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

              render() {
                const { item, scopes } = this.props;
                const { setShow } = this;
                const { learnIcon, show } = this.state;
            
            

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

              const Confirmation = props => {
                const dispatch = useDispatch();
                const refreshAppointments = useCallback(
                  () => {
                    dispatch(triggerRefresh());
              Severity: Major
              Found in src/applications/check-in/day-of/pages/Confirmation/index.jsx - About 4 hrs to fix

                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

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

                  const generateData = (type, formData) => {
                    switch (type) {
                      case 'claimant-information':
                        return {
                          'Claimant’s first name': formData?.claimantFullName?.first
                  Severity: Major
                  Found in src/applications/burials-ez/components/NoFormPage.jsx - About 4 hrs to fix

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

                    export const renderAdditionalInfo = deductionCode => {
                      switch (deductionCode) {
                        case '30':
                          return (
                            <section className="vads-u-font-family--sans">

                      Function Folders has 123 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

                        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 MicroDetails has 123 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

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

                            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

                            Function ResultCard has a Cognitive Complexity of 33 (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 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.js has 371 lines of code (exceeds 250 allowed). Consider refactoring.
                              Open

                              import environment from 'platform/utilities/environment';
                              import footerContent from 'platform/forms/components/FormFooter';
                              import { scrollAndFocus } from 'platform/utilities/ui';
                              
                              import manifest from '../manifest.json';
                              Severity: Minor
                              Found in src/applications/simple-forms/21-10210/config/form.js - About 4 hrs to fix

                                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: [
                                    {

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

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

                                    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
                                      Severity
                                      Category
                                      Status
                                      Source
                                      Language