department-of-veterans-affairs/vets-website

View on GitHub

Showing 4,177 of 14,709 total issues

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

export const generateDemographicsContent = record => {
  return [
    {
      details: [
        {

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

    import { VA_FORM_IDS } from 'platform/forms/constants';
    
    import preSubmitInfo from 'platform/forms/preSubmitInfo';
    import FormFooter from 'platform/forms/components/FormFooter';
    import { externalServices as services } from 'platform/monitoring/DowntimeNotification';
    Severity: Minor
    Found in src/applications/appeals/995/config/form.js - About 4 hrs to fix

      Function prefillTransformerV2 has 117 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 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

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

          const FolderHeader = props => {
            const { folder, searchProps, threadCount } = props;
            const location = useLocation();
            const userFacilities = useSelector(state => state?.user?.profile?.facilities);
            const showInnerNav =

            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 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();
                      
                      

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

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

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

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

                                  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();

                                      File ctaWidgets.js has 358 lines of code (exceeds 250 allowed). Consider refactoring.
                                      Open

                                      // Relative imports.
                                      import backendServices from '~/platform/user/profile/constants/backendServices';
                                      import featureFlagNames from '~/platform/utilities/feature-toggles/featureFlagNames';
                                      import { mhvUrl } from '~/platform/site-wide/mhv/utilities';
                                      import { getAppUrl } from '~/platform/utilities/registry-helpers';
                                      Severity: Minor
                                      Found in src/applications/static-pages/cta-widget/ctaWidgets.js - About 4 hrs to fix

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

                                        export const reduceErrors = (errors, pageList, reviewErrors = {}) =>
                                          errors.reduce((processedErrors, error) => {
                                            let errorIndex = null; // save key (index) of array items with __error
                                            const findErrors = (name, err) => {
                                              if (err && typeof err === 'object') {
                                        Severity: Minor
                                        Found in src/platform/forms-system/src/js/utilities/data/reduceErrors.js - About 4 hrs 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

                                        Severity
                                        Category
                                        Status
                                        Source
                                        Language