department-of-veterans-affairs/vets-website

View on GitHub

Showing 4,177 of 14,709 total issues

File FileField.jsx has 613 lines of code (exceeds 250 allowed). Consider refactoring.
Open

/* eslint-disable jsx-a11y/no-noninteractive-element-to-interactive-role */
import PropTypes from 'prop-types';
import React, { useEffect, useState, useRef } from 'react';
import { connect } from 'react-redux';
import classNames from 'classnames';
Severity: Major
Found in src/platform/forms-system/src/js/fields/FileField.jsx - About 1 day to fix

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

      render() {
        const {
          uiSchema,
          errorSchema,
          idSchema,
    Severity: Major
    Found in src/applications/pre-need-integration/components/DeceasedPersons.jsx - About 1 day to fix

      Function DownloadFileType has a Cognitive Complexity of 67 (exceeds 5 allowed). Consider refactoring.
      Open

      const DownloadFileType = props => {
        const { runningUnitTest = false } = props;
        const history = useHistory();
        const [fileType, setFileType] = useState('');
      
      

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

      import merge from 'lodash/merge';
      import fullSchema from 'vets-json-schema/dist/FEEDBACK-TOOL-schema.json';
      import phoneUI from 'platform/forms-system/src/js/definitions/phone';
      import emailUI from 'platform/forms-system/src/js/definitions/email';
      import { validateBooleanGroup } from 'platform/forms-system/src/js/validation';
      Severity: Major
      Found in src/applications/edu-benefits/feedback-tool/config/form.js - About 1 day to fix

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

        import { useEffect, useRef } from 'react';
        import { add, getYear } from 'date-fns';
        import { intersection, matches, merge, uniq } from 'lodash';
        import shouldUpdate from 'recompose/shouldUpdate';
        import { deepEquals } from '@department-of-veterans-affairs/react-jsonschema-form/lib/utils';
        Severity: Major
        Found in src/platform/forms-system/src/js/helpers.js - About 1 day to fix

          File form.jsx has 606 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          import React from 'react';
          
          import fullSchemaPreNeed from 'vets-json-schema/dist/40-10007-INTEGRATION-schema.json';
          
          import environment from 'platform/utilities/environment';
          Severity: Major
          Found in src/applications/pre-need-integration/config/form.jsx - About 1 day to fix

            Function FacilitySearch has 263 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            const FacilitySearch = props => {
              const { data: formData, goBack, goForward, goToPath } = props;
              const [query, setQuery] = useState('');
              const [submittedQuery, setSubmittedQuery] = useState('');
              const [loading, setLoading] = useState(false);
            Severity: Major
            Found in src/applications/caregivers/components/FormFields/FacilitySearch.jsx - About 1 day to fix

              Function IntroductionPage has 262 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              const IntroductionPage = props => {
                const { route } = props;
                // WIP: need to keep unit-tests passing with these new selector-hooks
                const userLoggedIn = useSelector(state => isLoggedIn(state));
                const userIdVerified = useSelector(state => isLOA3(state));

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

                import React from 'react';
                import { useSelector } from 'react-redux';
                import { VA_FORM_IDS } from 'platform/forms/constants';
                
                export const PrimaryActionLink = ({ href = '/', children, onClick = null }) => (
                Severity: Major
                Found in src/applications/simple-forms/21-4138/config/constants.js - About 1 day to fix

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

                  import React from 'react';
                  import { expect } from 'chai';
                  import moment from 'moment';
                  import {
                    createTestStore,
                  Severity: Major
                  Found in src/applications/vaos/components/layout/InPersonLayout.unit.spec.js - About 1 day to fix

                    File FileField.jsx has 602 lines of code (exceeds 250 allowed). Consider refactoring.
                    Open

                    /* eslint-disable jsx-a11y/no-noninteractive-element-to-interactive-role */
                    import PropTypes from 'prop-types';
                    import React, { useEffect, useState, useMemo, useRef } from 'react';
                    import { connect } from 'react-redux';
                    import classNames from 'classnames';
                    Severity: Major
                    Found in src/applications/simple-forms/40-0247/components/FileField.jsx - About 1 day to fix

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

                      import appendQuery from 'append-query';
                      
                      import { fetchAndUpdateSessionExpiration as fetch } from 'platform/utilities/api';
                      import mbxGeo from '@mapbox/mapbox-sdk/services/geocoding';
                      import { api, apiV0 } from '../config';
                      Severity: Major
                      Found in src/applications/gi/actions/index.js - About 1 day to fix

                        Function arrayBuilderPages has a Cognitive Complexity of 66 (exceeds 5 allowed). Consider refactoring.
                        Open

                        export function arrayBuilderPages(options, pageBuilderCallback) {
                          let introPath;
                          let summaryPath;
                          let hasItemsKey;
                          const itemPages = [];

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

                        import { uniqueId } from 'lodash';
                        import * as VAP_SERVICE from '../constants';
                        
                        export function isVAProfileServiceConfigured() {
                          return (
                        Severity: Major
                        Found in src/platform/user/profile/vap-svc/util/local-vapsvc.js - About 1 day to fix

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

                          // platform imports
                          import environment from 'platform/utilities/environment';
                          import FormFooter from 'platform/forms/components/FormFooter';
                          import { VA_FORM_IDS } from 'platform/forms/constants';
                          import { externalServices } from 'platform/monitoring/DowntimeNotification';
                          Severity: Major
                          Found in src/applications/hca/config/form.js - About 1 day to fix

                            Function FileField has a Cognitive Complexity of 65 (exceeds 5 allowed). Consider refactoring.
                            Open

                            const FileField = props => {
                              const {
                                enableShortWorkflow,
                                errorSchema,
                                formContext,
                            Severity: Minor
                            Found in src/applications/simple-forms/40-0247/components/FileField.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 FolderThreadListView has 256 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                            const FolderThreadListView = props => {
                              const { testing } = props;
                              const dispatch = useDispatch();
                              const error = null;
                              const threadsPerPage = THREADS_PER_PAGE_DEFAULT;

                              File index.jsx has 593 lines of code (exceeds 250 allowed). Consider refactoring.
                              Open

                              import React from 'react';
                              import { APP_URLS, LAST_YEAR } from '../../utils/constants';
                              
                              /** CHAPTER 1: Veteran Information */
                              export const BirthInfoDescription = (
                              Severity: Major
                              Found in src/applications/hca/components/FormDescriptions/index.jsx - About 1 day to fix

                                File FileField.jsx has 592 lines of code (exceeds 250 allowed). Consider refactoring.
                                Open

                                /* eslint-disable jsx-a11y/no-noninteractive-element-to-interactive-role */
                                import PropTypes from 'prop-types';
                                import React, { useEffect, useState, useRef } from 'react';
                                import { connect } from 'react-redux';
                                import classNames from 'classnames';
                                Severity: Major
                                Found in src/applications/pre-need/components/FileField.jsx - About 1 day to fix

                                  Function IntroductionPage has 255 lines of code (exceeds 25 allowed). Consider refactoring.
                                  Open

                                  const IntroductionPage = props => {
                                    const { route, toggleLoginModal, loggedIn } = props;
                                    const { formConfig, pageList, pathname, formData } = route;
                                    const [inquiryData, setInquiryData] = useState(false);
                                    const [searchReferenceNumber, setSearchReferenceNumber] = useState('');
                                  Severity: Major
                                  Found in src/applications/ask-va/containers/IntroductionPage.jsx - About 1 day to fix
                                    Severity
                                    Category
                                    Status
                                    Source
                                    Language