department-of-veterans-affairs/vets-website

View on GitHub

Showing 4,177 of 14,709 total issues

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

import { snakeCase } from 'lodash';
import URLSearchParams from 'url-search-params';
import { useLocation } from 'react-router-dom';

import constants from 'vets-json-schema/dist/constants.json';
Severity: Major
Found in src/applications/gi/utils/helpers.js - About 1 day to fix

    Function MoveMessageToFolderBtn has 229 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    const MoveMessageToFolderBtn = props => {
      const {
        threadId,
        allFolders,
        isVisible,

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

      /* eslint-disable no-prototype-builtins */
      import moment from 'moment';
      import * as Sentry from '@sentry/browser';
      import { recordEvent } from '@department-of-veterans-affairs/platform-monitoring/exports';
      import {
      Severity: Major
      Found in src/applications/vaos/appointment-list/redux/actions.js - About 1 day to fix

        Function AllergyDetails has 227 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        const AllergyDetails = props => {
          const { runningUnitTest } = props;
          const dispatch = useDispatch();
          const allergy = useSelector(state => state.mr.allergies.allergyDetails);
          const allergyList = useSelector(state => state.mr.allergies.allergiesList);
        Severity: Major
        Found in src/applications/mhv-medical-records/containers/AllergyDetails.jsx - About 1 day to fix

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

          import environment from '@department-of-veterans-affairs/platform-utilities/environment';
          
          export const envUrl = environment.API_URL;
          
          export const baseURL = '/ask_va_api/v0';
          Severity: Major
          Found in src/applications/ask-va/constants.js - About 1 day to fix

            Function ConfirmationPageV2 has 226 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            export const ConfirmationPageV2 = () => {
              const alertRef = useRef(null);
            
              const form = useSelector(state => state.form || {});
              const profile = useSelector(state => selectProfile(state));
            Severity: Major
            Found in src/applications/appeals/10182/components/ConfirmationPageV2.jsx - About 1 day to fix

              File PhoneLayout.unit.spec.js has 542 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/PhoneLayout.unit.spec.js - About 1 day to fix

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

                  render() {
                    const {
                      currentPageNumber,
                      errorMessages,
                      facilityCodeSelected,

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

                  const defaultUser = {
                    data: {
                      id: '',
                      type: 'user',
                      attributes: {
                  Severity: Major
                  Found in src/platform/mhv/api/mocks/user/index.js - About 1 day to fix

                    Function formReducer has a Cognitive Complexity of 57 (exceeds 5 allowed). Consider refactoring.
                    Open

                    export default function formReducer(state = initialState, action) {
                      switch (action.type) {
                        case FORM_PAGE_OPENED: {
                          const { data, schema } = setupFormData(
                            state.data,
                    Severity: Minor
                    Found in src/applications/vaos/new-appointment/redux/reducer.js - 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

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

                    import { dropRight, merge } from 'lodash';
                    import { getDefaultFormState } from '@department-of-veterans-affairs/react-jsonschema-form/lib/utils';
                    import dataGet from '../../../../utilities/data/get';
                    import set from '../../../../utilities/data/set';
                    import unset from '../../../../utilities/data/unset';
                    Severity: Major
                    Found in src/platform/forms-system/src/js/state/helpers.js - About 1 day to fix

                      File SearchPage.jsx has 538 lines of code (exceeds 250 allowed). Consider refactoring.
                      Open

                      /* eslint-disable react-hooks/exhaustive-deps */
                      
                      import React, { useEffect, useRef, useState } from 'react';
                      import PropTypes from 'prop-types';
                      import { connect, useStore } from 'react-redux';
                      Severity: Major
                      Found in src/applications/representative-search/containers/SearchPage.jsx - About 1 day to fix

                        Function debtSummaryText has 221 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                        export const debtSummaryText = (diaryCode, dateOfLetter, balance) => {
                          const endDateText = endDate(dateOfLetter, diaryCode);
                        
                          switch (diaryCode) {
                            case '71':

                          Function EmploymentRecord has 220 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                          const EmploymentRecord = props => {
                            const { data, goToPath, setFormData } = props;
                          
                            const editIndex = getJobIndex();
                          
                          

                            Function EmploymentRecord has 220 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                            const EmploymentRecord = props => {
                              const { data, goToPath, setFormData } = props;
                            
                              const editIndex = getJobIndex();
                            
                            

                              File form-submit-transform.js has 531 lines of code (exceeds 250 allowed). Consider refactoring.
                              Open

                              // this constant maps the values on address.js in vets.json schema from VA.gov values to LTS values
                              
                              import { formFields } from '../constants';
                              
                              // the lts values were found on the LTS database and LTS validates them, so we need to send correct value from here
                              Severity: Major
                              Found in src/applications/my-education-benefits/utils/form-submit-transform.js - About 1 day to fix

                                File FilterYourResults.jsx has 531 lines of code (exceeds 250 allowed). Consider refactoring.
                                Open

                                import React, { useState, useEffect } from 'react';
                                import { useHistory } from 'react-router-dom';
                                import { connect } from 'react-redux';
                                import _ from 'lodash';
                                import recordEvent from 'platform/monitoring/record-event';
                                Severity: Major
                                Found in src/applications/gi/containers/FilterYourResults.jsx - About 1 day to fix

                                  File applicantFileUpload.js has 530 lines of code (exceeds 250 allowed). Consider refactoring.
                                  Open

                                  import React from 'react';
                                  import { titleUI } from 'platform/forms-system/src/js/web-component-patterns';
                                  import { fileUploadBlurbCustom } from 'applications/ivc-champva/shared/components/fileUploads/attachments';
                                  import { applicantWording } from '../../../shared/utilities';
                                  import ApplicantField from '../../../shared/components/applicantLists/ApplicantField';

                                    Function ManageFolderButtons has 217 lines of code (exceeds 25 allowed). Consider refactoring.
                                    Open

                                    const ManageFolderButtons = props => {
                                      const { ErrorMessages, Alerts } = Constants;
                                      const dispatch = useDispatch();
                                      const history = useHistory();
                                      const { folder } = props;

                                      File ClaimExamLayout.unit.spec.js has 525 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/ClaimExamLayout.unit.spec.js - About 1 day to fix
                                        Severity
                                        Category
                                        Status
                                        Source
                                        Language