department-of-veterans-affairs/vets-website

View on GitHub

Showing 3,724 of 12,675 total issues

Function ConfirmationPage has 118 lines of code (exceeds 25 allowed). Consider refactoring.
Open

export default function ConfirmationPage() {
  const {
    submission: { response },
    data: { fullName },
  } = useSelector(state => state.form);
Severity: Major
Found in src/applications/vre/25-8832/containers/ConfirmationPage.jsx - About 4 hrs to fix

    Function specializedMissionAttributes has 118 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      const specializedMissionAttributes = () => {
        const options = [
          {
            name: 'specialMissionHbcu',
            dataTestId: 'special-mission-hbcu',
    Severity: Major
    Found in src/applications/gi/containers/search/FilterBeforeResults.jsx - About 4 hrs to fix

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

      /* eslint-disable camelcase */
      /* eslint-disable no-restricted-syntax */
      
      export const PAGE_TITLE = 'GI Bill® CT Redesign Sandbox';
      
      
      Severity: Minor
      Found in src/applications/gi/constants.js - About 4 hrs to fix

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

        const IntroductionPage = props => {
          // focus on element
          useEffect(() => {
            focusElement('h1');
          }, []);
        Severity: Major
        Found in src/applications/vre/25-8832/containers/IntroductionPage.jsx - About 4 hrs to fix

          File questions.jsx has 361 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          import React from 'react';
          
          export const questions = [
            {
              id: 'isStaff',
          Severity: Minor
          Found in src/applications/coronavirus-screener/config/questions.jsx - About 4 hrs to fix

            Function validateAddress has 116 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            ) => async dispatch => {
              const userEnteredAddress = { ...inputAddress };
              dispatch({
                type: ADDRESS_VALIDATION_INITIALIZE,
                fieldName,
            Severity: Major
            Found in src/platform/user/profile/vap-svc/actions/transactions.js - About 4 hrs to fix

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

              const IntroductionPage = props => {
                // Toggle from hearing aid supplies to hearing aid + CPAP supplies.
                const {
                  TOGGLE_NAMES,
                  useToggleValue,

                Function prefillTransformerV2 has 116 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                export function prefillTransformerV2(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 4 hrs to fix

                  Function prefillTransformerV2 has 116 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  export function prefillTransformerV2(pages, formData, metadata, state) {
                    const bankInformation = state.data?.bankInformation || {};
                    const claimant = state.data?.formData?.data?.attributes?.claimant || {};
                    const contactInfo = claimant?.contactInfo || {};
                    const sponsors = state.data?.formData?.attributes?.sponsors;
                  Severity: Major
                  Found in src/applications/toe/helpers.jsx - About 4 hrs to fix

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

                    const IntroductionPage = props => {
                      // Toggle from hearing aid supplies to hearing aid + CPAP supplies.
                      const {
                        TOGGLE_NAMES,
                        useToggleValue,

                      Function PayrollDeductionChecklist has 116 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                      const PayrollDeductionChecklist = props => {
                        const { goToPath, goBack, setFormData } = props;
                      
                        const editIndex = getJobIndex();
                      
                      

                        Function PrintDownload has 116 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                        const PrintDownload = props => {
                          const { downloadPdf, downloadTxt, list, allowTxtDownloads } = props;
                          const menu = useRef(null);
                        
                          const [menuOpen, setMenuOpen] = useState(false);

                          File mockData.js has 359 lines of code (exceeds 250 allowed). Consider refactoring.
                          Open

                          export const UPDATED_USER_MOCK_DATA = {
                            'vye::UserInfo': {
                              remEnt: '2854321', // 28(first 2 numbers) for months .54321 * 30 = res needs to be rounded
                              certIssueDate: '2019-06-28T00:00:00.000Z',
                              delDate: '2026-09-03T00:00:00.000Z',
                          Severity: Minor
                          Found in src/applications/verify-your-enrollment/constants/mockData.js - About 4 hrs to fix

                            Function determineVenueAddress has 115 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                            export const determineVenueAddress = (formResponses, noDRB) => {
                              if (!formResponses) return null;
                            
                              const boardData = determineBoardObj(formResponses);
                            
                            
                            Severity: Major
                            Found in src/applications/discharge-wizard/helpers/index.jsx - About 4 hrs to fix

                              Function venueAddress has 115 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                              export const venueAddress = (formValues, noDRB) => {
                                if (!formValues) return null;
                              
                                const boardData = board(formValues);
                              
                              
                              Severity: Major
                              Found in src/applications/discharge-wizard/helpers/index.jsx - About 4 hrs to fix

                                Function DocumentUploader has 115 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                const DocumentUploader = () => {
                                  const [state, setState] = useState({
                                    documentType: '',
                                    documentDescription: '',
                                    errorMessage: null,

                                  Function transformForSubmit has 115 lines of code (exceeds 25 allowed). Consider refactoring.
                                  Open

                                  export default function transformForSubmit(formConfig, form) {
                                    const hasReceivedMedicalTreatment =
                                      form?.data?.['view:hasReceivedMedicalTreatment'];
                                  
                                    const transformedData = JSON.parse(
                                  Severity: Major
                                  Found in src/applications/simple-forms/20-10207/config/submit-transformer.js - About 4 hrs to fix

                                    Function SpousePayrollDeductionChecklist has 115 lines of code (exceeds 25 allowed). Consider refactoring.
                                    Open

                                    const SpousePayrollDeductionChecklist = props => {
                                      const { goToPath, goBack, setFormData } = props;
                                    
                                      const editIndex = getJobIndex();
                                    
                                    

                                      Function RadioWidget has 115 lines of code (exceeds 25 allowed). Consider refactoring.
                                      Open

                                      export default function RadioWidget(props) {
                                        const { options, formContext = {}, value, disabled, onChange, id } = props;
                                        const { enumOptions, labels = {} } = options;
                                      
                                        const dispatch = useDispatch();

                                        Function ArrayBuilderSummaryPage has a Cognitive Complexity of 31 (exceeds 5 allowed). Consider refactoring.
                                        Open

                                        export default function ArrayBuilderSummaryPage({
                                          arrayPath,
                                          firstItemPagePath,
                                          getText,
                                          hasItemsKey,

                                        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