department-of-veterans-affairs/vets-website

View on GitHub

Showing 4,177 of 14,709 total issues

Function OtherResources has 213 lines of code (exceeds 25 allowed). Consider refactoring.
Open

const OtherResources = () => {
  return (
    <div>
      <section>
        <div className="va-h-ruled--stars" />
Severity: Major
Found in src/applications/sco/components/MainContent/Update/OtherResources.jsx - About 1 day to fix

    Function CreditCardBill has 213 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    const CreditCardBill = props => {
      const { data, goToPath, setFormData } = props;
    
      const { expenses } = data;
      const { creditCardBills = [] } = expenses;

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

      import React from 'react';
      
      export const TITLE = 'Request priority processing for an existing claim';
      export const SUBTITLE = 'Priority processing request (VA form 20-10207)';
      
      
      Severity: Major
      Found in src/applications/simple-forms/20-10207/config/constants.js - About 1 day to fix

        Function PreSubmitCheckboxGroup has 211 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        const PreSubmitCheckboxGroup = props => {
          const {
            onSectionComplete,
            formData,
            showError,
        Severity: Major
        Found in src/applications/caregivers/components/PreSubmitInfo/index.jsx - About 1 day to fix

          Function ContestableIssuesWidget has 210 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          const ContestableIssuesWidget = props => {
            const {
              value = [],
              id,
              options,

            Function useNotificationSettingsUtils has 210 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            export const useNotificationSettingsUtils = () => {
              const communicationPreferences = useSelector(
                state => state?.communicationPreferences,
              );
            
            

              Function NewAppointment has 209 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              export function NewAppointment() {
                const isCernerOnlyPatient = useSelector(selectIsCernerOnlyPatient);
                const isNewAppointmentStarted = useSelector(selectIsNewAppointmentStarted);
                const featureBreadcrumbUrlUpdate = useSelector(state =>
                  selectFeatureBreadcrumbUrlUpdate(state),
              Severity: Major
              Found in src/applications/vaos/new-appointment/index.jsx - About 1 day to fix

                File ProfileInformationFieldController.jsx has 514 lines of code (exceeds 250 allowed). Consider refactoring.
                Open

                import React from 'react';
                import PropTypes from 'prop-types';
                import { connect } from 'react-redux';
                
                // platform level imports

                  File ProfileInformationFieldController.jsx has 514 lines of code (exceeds 250 allowed). Consider refactoring.
                  Open

                  import React from 'react';
                  import PropTypes from 'prop-types';
                  import { connect } from 'react-redux';
                  
                  // platform level imports

                    File ProfileInformationFieldController.jsx has 514 lines of code (exceeds 250 allowed). Consider refactoring.
                    Open

                    import React from 'react';
                    import PropTypes from 'prop-types';
                    import { connect } from 'react-redux';
                    
                    // platform level imports

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

                      const Confirmation = () => {
                        useEffect(() => {
                          focusElement('#main h2');
                          scrollTo('topScrollElement');
                        });
                      Severity: Major
                      Found in src/applications/appeals/testing/download/containers/Confirmation.jsx - About 1 day to fix

                        File ApiInitializer.js has 512 lines of code (exceeds 250 allowed). Consider refactoring.
                        Open

                        import session from '../mocks/v2/sessions';
                        import preCheckInData from '../mocks/v2/pre-check-in-data';
                        import checkInData from '../mocks/v2/check-in-data';
                        import btsss from '../mocks/v2/btsss';
                        import sharedData from '../mocks/v2/shared';
                        Severity: Major
                        Found in src/applications/check-in/api/local-mock-api/e2e/ApiInitializer.js - About 1 day to fix

                          Function generateData has a Cognitive Complexity of 53 (exceeds 5 allowed). Consider refactoring.
                          Open

                          const generateData = (type, formData) => {
                            switch (type) {
                              case 'claimant-information':
                                return {
                                  'Claimant’s first name': formData?.claimantFullName?.first
                          Severity: Minor
                          Found in src/applications/burials-ez/components/NoFormPage.jsx - About 1 day 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 PrintDownload has 206 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                          const PrintDownload = props => {
                            const { onDownload, isSuccess, list, onPrint, onText, isLoading } = props;
                            const [isError, setIsError] = useState(false);
                          
                            const [menuOpen, setMenuOpen] = useState(false);
                          Severity: Major
                          Found in src/applications/mhv-medications/components/shared/PrintDownload.jsx - About 1 day to fix

                            File DeceasedPersons.jsx has 509 lines of code (exceeds 250 allowed). Consider refactoring.
                            Open

                            import PropTypes from 'prop-types';
                            import React from 'react';
                            import classNames from 'classnames';
                            import {
                              toIdSchema,
                            Severity: Major
                            Found in src/applications/pre-need-integration/components/DeceasedPersons.jsx - About 1 day to fix

                              File ProfileInformationFieldController.jsx has 508 lines of code (exceeds 250 allowed). Consider refactoring.
                              Open

                              import React from 'react';
                              import PropTypes from 'prop-types';
                              import { connect } from 'react-redux';
                              
                              // platform level imports

                                File debtDetailsCardContent.js has 508 lines of code (exceeds 250 allowed). Consider refactoring.
                                Open

                                import React from 'react';
                                import { CONTACTS } from '@department-of-veterans-affairs/component-library/contacts';
                                import { endDate } from '../../utils/helpers';
                                
                                const ContactDMC = () => (

                                  Function MyVAHealth has 204 lines of code (exceeds 25 allowed). Consider refactoring.
                                  Open

                                  export default function MyVAHealth() {
                                    const [{ loadingMessage, isLoading }, setLoadingMessage] = useState(
                                      defaultMessage,
                                    );
                                    const [showDeclineModal, setShowDeclineModal] = useState(false);
                                  Severity: Major
                                  Found in src/applications/terms-of-use/components/MyVAHealth.jsx - About 1 day to fix

                                    Function generate has 203 lines of code (exceeds 25 allowed). Consider refactoring.
                                    Open

                                    const generate = async data => {
                                      validate(data.details);
                                    
                                      const doc = createAccessibleDoc(data, config);
                                    
                                    
                                    Severity: Major
                                    Found in src/platform/pdf/templates/veteran_status_new.js - About 1 day to fix

                                      Function MessageList has a Cognitive Complexity of 52 (exceeds 5 allowed). Consider refactoring.
                                      Open

                                      const MessageList = props => {
                                        const dispatch = useDispatch();
                                        const { folder, messages, keyword, isSearch, sortOrder, page } = props;
                                      
                                        const location = useLocation();

                                      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

                                      Severity
                                      Category
                                      Status
                                      Source
                                      Language