department-of-veterans-affairs/vets-website

View on GitHub

Showing 4,177 of 14,709 total issues

File LocationSearchResults.jsx has 693 lines of code (exceeds 250 allowed). Consider refactoring.
Open

/* eslint-disable react/jsx-no-bind */
/* eslint-disable react-hooks/exhaustive-deps */
/* eslint-disable react/prop-types */
/* eslint-disable jsx-a11y/no-noninteractive-tabindex */

Severity: Major
Found in src/applications/gi/containers/search/LocationSearchResults.jsx - About 1 day to fix

    Function addressUISchema has a Cognitive Complexity of 79 (exceeds 5 allowed). Consider refactoring.
    Open

    export const addressUISchema = (
      isMilitaryBaseAddress = false,
      path,
      callback,
    ) => {

    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 addressUISchema has a Cognitive Complexity of 79 (exceeds 5 allowed). Consider refactoring.
    Open

    export const addressUISchema = (
      isMilitaryBaseAddress = false,
      path,
      callback,
    ) => {

    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 Prescriptions has a Cognitive Complexity of 79 (exceeds 5 allowed). Consider refactoring.
    Open

    const Prescriptions = () => {
      const { search } = useLocation();
      const history = useHistory();
      const dispatch = useDispatch();
      const paginatedPrescriptionsList = useSelector(
    Severity: Minor
    Found in src/applications/mhv-medications/containers/Prescriptions.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

    File LandingPage.jsx has 688 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    import React, { useEffect, useRef, useState } from 'react';
    import { useSelector, useDispatch } from 'react-redux';
    import { Link, useLocation } from 'react-router-dom';
    import { focusElement } from '@department-of-veterans-affairs/platform-utilities/ui';
    import FEATURE_FLAG_NAMES from '@department-of-veterans-affairs/platform-utilities/featureFlagNames';
    Severity: Major
    Found in src/applications/mhv-medications/containers/LandingPage.jsx - About 1 day to fix

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

        render() {
          const {
            newBenefit,
            serviceBenefitBasedOn,
            transferredEduBenefits,
      Severity: Major
      Found in src/applications/edu-benefits/components/EducationWizard.jsx - About 1 day to fix

        Function vapService has 307 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        export default function vapService(state = initialState, action) {
          switch (action.type) {
            case VAP_SERVICE_TRANSACTIONS_FETCH_SUCCESS: {
              const transactions = action.data.map(transactionData =>
                // Wrap in a "data" property to imitate the API response for a single transaction
        Severity: Major
        Found in src/platform/user/profile/vap-svc/reducers/index.js - About 1 day to fix

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

          import { expect } from 'chai';
          import sinon from 'sinon';
          
          import {
            mockFetch,
          Severity: Major
          Found in src/applications/vaos/new-appointment/newAppointmentFlow.unit.spec.js - About 1 day to fix

            Function default has 306 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            export default function(state = INITIAL_STATE, action) {
              switch (action.type) {
                case CALCULATOR_INPUTS_CHANGED: {
                  const { field, value } = action;
                  let convertedValue = value;
            Severity: Major
            Found in src/applications/gi/reducers/calculator.js - About 1 day to fix

              File addStudentsArrayPages.js has 676 lines of code (exceeds 250 allowed). Consider refactoring.
              Open

              import { capitalize } from 'lodash';
              import {
                titleUI,
                textUI,
                textSchema,

                Function arrayBuilderPages has 303 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

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

                  File SearchDropdownComponent.js has 665 lines of code (exceeds 250 allowed). Consider refactoring.
                  Open

                  // March 2024: This file is duplicated from the search application (src/applications/search) because we
                  // converted the search app used on the page in /search/?query={query} to use web components
                  // The header cannot support web components yet due to its integration with TeamSites, so this is the original
                  // non-web-component version of the Search app
                  import React from 'react';

                    File SearchDropdownComponent.js has 665 lines of code (exceeds 250 allowed). Consider refactoring.
                    Open

                    // March 2024: This file is duplicated from the search application (src/applications/search) because we
                    // converted the search app used on the page in /search/?query={query} to use web components
                    // The header cannot support web components yet due to its integration with TeamSites, so this is the original
                    // non-web-component version of the Search app
                    import React from 'react';
                    Severity: Major
                    Found in src/platform/site-wide/user-nav/components/SearchDropdownComponent.js - About 1 day to fix

                      File seiVitals.js has 663 lines of code (exceeds 250 allowed). Consider refactoring.
                      Open

                      const vitals = {
                        userProfileId: 15176497,
                        bloodPreassureReadings: [
                          {
                            dateEntered: '01/07/2022',
                      Severity: Major
                      Found in src/platform/mhv/api/mocks/medical-records/self-entered/seiVitals.js - About 1 day to fix

                        Function VaPrescription has 296 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                        const VaPrescription = prescription => {
                          const showRefillContent = useSelector(selectRefillContentFlag);
                          const isDisplayingDocumentation = useSelector(
                            state =>
                              state.featureToggles[

                          Function addressUI has 294 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                          export function addressUI(options) {
                            let cachedPath;
                            let cityMaxLength = 100;
                          
                            const omit = key => options?.omit?.includes(key);

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

                            import React from 'react';
                            import { merge } from 'lodash';
                            import PropTypes from 'prop-types';
                            import get from 'platform/utilities/data/get';
                            import omit from 'platform/utilities/data/omit';
                            Severity: Major
                            Found in src/applications/pre-need/utils/helpers.js - About 1 day to fix

                              File VAFacilityPageV2.eligibility.unit.spec.js has 652 lines of code (exceeds 250 allowed). Consider refactoring.
                              Open

                              import React from 'react';
                              import { expect } from 'chai';
                              
                              import {
                                mockFetch,

                                Function getCalculatedBenefits has 291 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                  (eligibility, institution, form, derived) => {
                                    const calculatedBenefits = {};
                                
                                    if ([eligibility, institution, form, derived].some(e => !e || isEmpty(e))) {
                                      return calculatedBenefits;
                                Severity: Major
                                Found in src/applications/gi/selectors/calculator.js - About 1 day to fix

                                  File appointment.utils.unit.spec.js has 651 lines of code (exceeds 250 allowed). Consider refactoring.
                                  Open

                                  import { expect } from 'chai';
                                  import { render } from '@testing-library/react';
                                  import MockDate from 'mockdate';
                                  import {
                                    appointmentWasCanceled,
                                    Severity
                                    Category
                                    Status
                                    Source
                                    Language