department-of-veterans-affairs/vets-website

View on GitHub

Showing 3,723 of 12,672 total issues

Function ReplyDraftItem has 481 lines of code (exceeds 25 allowed). Consider refactoring.
Open

const ReplyDraftItem = props => {
  const {
    draft,
    drafts,
    cannotReply,

    File actions.js has 938 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    /* eslint-disable camelcase */
    import moment from 'moment';
    import * as Sentry from '@sentry/browser';
    import { recordEvent } from '@department-of-veterans-affairs/platform-monitoring/exports';
    import { selectVAPResidentialAddress } from '@department-of-veterans-affairs/platform-user/selectors';
    Severity: Major
    Found in src/applications/vaos/new-appointment/redux/actions.js - About 2 days to fix

      Function CalculateYourBenefitsForm has a Cognitive Complexity of 110 (exceeds 5 allowed). Consider refactoring.
      Open

      function CalculateYourBenefitsForm({
        calculatorInputChange,
        displayedInputs,
        eligibility,
        eligibilityChange,
      Severity: Minor
      Found in src/applications/gi/components/profile/CalculateYourBenefitsForm.jsx - About 2 days 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 V3BasePage has 442 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      export default function V3BasePage() {
        /** @param {import('react').FormEvent | import('@department-of-veterans-affairs/web-components/dist/types/components').VaSelectCustomEvent } evt */
        function updateValue(evt) {
          const { value, name } = /** @type {HTMLInputElement} */ (evt.target);
          const display = document.getElementById(`${name}Value`);
      Severity: Major
      Found in src/applications/ds-v3-playground/pages/V3BasePage.jsx - About 2 days to fix

        File V1V3Page.jsx has 886 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        /**
         * This page is for testing the compatibility of running v1 and v3 components on the same page.
         */
        
        import React, { useState } from 'react';
        Severity: Major
        Found in src/applications/ds-playground/pages/V1V3Page.jsx - About 2 days to fix

          Function getNextEvents has 426 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          export function getNextEvents(appeal) {
            const { type: currentStatus, details } = appeal.attributes.status;
            const appealType = appeal.type;
          
            switch (currentStatus) {
          Severity: Major
          Found in src/applications/claims-status/utils/appeals-v2-helpers.jsx - About 2 days to fix

            Function covid19VaccineReducer has 425 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            export default function covid19VaccineReducer(state = initialState, action) {
              switch (action.type) {
                case FORM_PAGE_OPENED: {
                  const { newBooking } = state;
                  const { data, schema } = setupFormData(
            Severity: Major
            Found in src/applications/vaos/covid-19-vaccine/redux/reducer.js - About 2 days to fix

              File ComposeForm.jsx has 865 lines of code (exceeds 250 allowed). Consider refactoring.
              Open

              import React, { useState, useEffect, useMemo, useCallback } from 'react';
              import PropTypes from 'prop-types';
              import { validateNameSymbols } from 'platform/forms-system/src/js/web-component-patterns/fullNamePattern';
              import { useDispatch, useSelector } from 'react-redux';
              import { useHistory } from 'react-router-dom';

                Function AppointmentDetails has 407 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                const AppointmentDetails = props => {
                  const { router } = props;
                  const { t } = useTranslation();
                  const dispatch = useDispatch();
                  const {

                  Function ComposeForm has a Cognitive Complexity of 101 (exceeds 5 allowed). Consider refactoring.
                  Open

                  const ComposeForm = props => {
                    const { pageTitle, headerRef, draft, recipients, signature } = props;
                    const {
                      noAssociations,
                      allTriageGroupsBlocked,

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

                  const SearchPage = props => {
                    const searchResultTitleRef = useRef(null);
                    const previousLocationInputString = useRef(
                      props.currentQuery.locationInputString,
                    );
                  Severity: Major
                  Found in src/applications/representative-search/containers/SearchPage.jsx - About 2 days to fix

                    Function LandingPage has 386 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                    const LandingPage = () => {
                      const dispatch = useDispatch();
                      const fullState = useSelector(state => state);
                      const displayNotes = useSelector(selectNotesFlag);
                      const displayVaccines = useSelector(selectVaccinesFlag);
                    Severity: Major
                    Found in src/applications/mhv-medical-records/containers/LandingPage.jsx - About 1 day to fix

                      File FilterBeforeResults.jsx has 808 lines of code (exceeds 250 allowed). Consider refactoring.
                      Open

                      /* eslint-disable no-unused-vars */
                      import React, { useState, useEffect } from 'react';
                      import { useHistory } from 'react-router-dom';
                      import { connect } from 'react-redux';
                      import _ from 'lodash';
                      Severity: Major
                      Found in src/applications/gi/containers/search/FilterBeforeResults.jsx - About 1 day to fix

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

                        /* istanbul ignore file */
                        /* eslint-disable camelcase */
                        const delay = require('mocker-api/lib/delay');
                        const moment = require('moment');
                        
                        
                        Severity: Major
                        Found in src/applications/vaos/services/mocks/index.js - About 1 day to fix

                          File reducer.js has 796 lines of code (exceeds 250 allowed). Consider refactoring.
                          Open

                          /* eslint-disable sonarjs/max-switch-cases */
                          import { getDefaultFormState } from '@department-of-veterans-affairs/react-jsonschema-form/lib/utils';
                          
                          import set from 'platform/utilities/data/set';
                          import unset from 'platform/utilities/data/unset';
                          Severity: Major
                          Found in src/applications/vaos/new-appointment/redux/reducer.js - About 1 day to fix

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

                            import React from 'react';
                            
                            import currentOrPastDateUI from 'platform/forms-system/src/js/definitions/currentOrPastDate';
                            
                            // In a real app this would not be imported directly; instead the schema you

                              File msw-mocks.js has 782 lines of code (exceeds 250 allowed). Consider refactoring.
                              Open

                              import { rest } from 'msw';
                              import mockDisabilityCompensation from '@@profile/mocks/endpoints/disability-compensations';
                              import environment from '~/platform/utilities/environment';
                              
                              import mockDD4CNPSuccess from './tests/fixtures/dd4cnp/dd4cnp-is-set-up.json';
                              Severity: Major
                              Found in src/applications/personalization/profile/msw-mocks.js - About 1 day to fix

                                File form.js has 780 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: Major
                                Found in src/applications/disability-benefits/686c-674-v2/config/form.js - About 1 day to fix

                                  File helpers.jsx has 768 lines of code (exceeds 250 allowed). Consider refactoring.
                                  Open

                                  /* eslint-disable no-nested-ternary */
                                  /* eslint-disable react/jsx-key */ // keys are defined, error being thrown in eslint even when key is defined
                                  import React from 'react';
                                  import ADDRESS_DATA from 'platform/forms/address/data';
                                  import { v4 as uuidv4 } from 'uuid';
                                  Severity: Major
                                  Found in src/applications/verify-your-enrollment/helpers.jsx - About 1 day to fix

                                    Function PrescriptionDetails has 360 lines of code (exceeds 25 allowed). Consider refactoring.
                                    Open

                                    const PrescriptionDetails = () => {
                                      const prescription = useSelector(
                                        state => state.rx.prescriptions?.prescriptionDetails,
                                      );
                                      const prescriptionsApiError = useSelector(
                                    Severity: Major
                                    Found in src/applications/mhv-medications/containers/PrescriptionDetails.jsx - About 1 day to fix
                                      Severity
                                      Category
                                      Status
                                      Source
                                      Language