department-of-veterans-affairs/vets-website

View on GitHub

Showing 3,723 of 12,673 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 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

        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

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

          const SearchForm = props => {
            const { folder, keyword, resultsCount, query, threadCount } = props;
            const mhvSecureMessagingFilterAccordion = useSelector(
              state =>
                state.featureToggles[

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

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

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

              import React from 'react';
              import PropTypes from 'prop-types';
              
              import { isSearchTermValid } from '~/platform/utilities/search-utilities';
              
              

                File LandingPage.jsx has 657 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 addressUI has 293 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 654 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

                      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,

                          Function addressUI has a Cognitive Complexity of 73 (exceeds 5 allowed). Consider refactoring.
                          Open

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

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

                          import React from 'react';
                          import moment from 'moment';
                          import { CONTACTS } from '@department-of-veterans-affairs/component-library/contacts';
                          import { VaTelephone } from '@department-of-veterans-affairs/component-library/dist/react-bindings';
                          
                          

                            Function InstallmentContract has 284 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                            const InstallmentContract = props => {
                              const { data, goToPath, setFormData } = props;
                            
                              const { installmentContracts = [] } = data;
                            
                            

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

                              import { merge, omit } from 'lodash';
                              import get from 'platform/utilities/data/get';
                              
                              import fullSchema5490 from 'vets-json-schema/dist/22-5490-schema.json';
                              import currentOrPastDateUI from 'platform/forms-system/src/js/definitions/currentOrPastDate';
                              Severity: Major
                              Found in src/applications/edu-benefits/5490/config/form.js - About 1 day to fix

                                File Prescriptions.jsx has 634 lines of code (exceeds 250 allowed). Consider refactoring.
                                Open

                                import React, {
                                  useCallback,
                                  useEffect,
                                  useMemo,
                                  useRef,
                                Severity: Major
                                Found in src/applications/mhv-medications/containers/Prescriptions.jsx - About 1 day to fix

                                  Function content has 280 lines of code (exceeds 25 allowed). Consider refactoring.
                                  Open

                                    const content = () => {
                                      if (prescription) {
                                        const dispStatus = prescription.dispStatus?.toString();
                                        return (
                                          <>
                                    Severity
                                    Category
                                    Status
                                    Source
                                    Language