department-of-veterans-affairs/vets-website

View on GitHub

Showing 3,724 of 12,675 total issues

Function createDebtsSuccess has 244 lines of code (exceeds 25 allowed). Consider refactoring.
Open

const createDebtsSuccess = () => {
  return {
    hasDependentDebts: false,
    debts: [
      {
Severity: Major
Found in src/applications/personalization/dashboard/mocks/debts/index.js - About 1 day to fix

    Function FileField has a Cognitive Complexity of 62 (exceeds 5 allowed). Consider refactoring.
    Open

    const FileField = props => {
      const {
        enableShortWorkflow,
        errorSchema,
        formContext,
    Severity: Minor
    Found in src/applications/pre-need/components/FileField.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

    Function Prescriptions has a Cognitive Complexity of 62 (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

    Function PrescriptionPrintOnly has 243 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    const PrescriptionPrintOnly = props => {
      const { rx, hideLineBreak, refillHistory, isDetailsRx } = props;
      const pharmacyPhone = pharmacyPhoneNumber(rx);
    
      const activeNonVaContent = pres => (

      Function appointmentsReducer has 241 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      export default function appointmentsReducer(state = initialState, action) {
        switch (action.type) {
          case FETCH_FUTURE_APPOINTMENTS:
            return {
              ...state,
      Severity: Major
      Found in src/applications/vaos/appointment-list/redux/reducer.js - About 1 day to fix

        Function DashboardCards has 240 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        const DashboardCards = () => {
          const [error, hasError] = useState(false);
          const [inquiries, setInquiries] = useState([]);
          const [lastUpdatedFilter, setLastUpdatedFilter] = useState('newestToOldest');
          const [statusFilter, setStatusFilter] = useState('All');
        Severity: Major
        Found in src/applications/ask-va/containers/DashboardCards.jsx - About 1 day to fix

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

            render() {
              const {
                activeIndex,
                isOpen,
                inputValue,

            Function ReviewPage has 237 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            const ReviewPage = props => {
              const [showAlert, setShowAlert] = useState(true);
              const dispatch = useDispatch();
            
              const scrollToChapter = chapterKey => {
            Severity: Major
            Found in src/applications/ask-va/containers/ReviewPage.jsx - About 1 day to fix

              File RenderErrorContainer.jsx has 560 lines of code (exceeds 250 allowed). Consider refactoring.
              Open

              import React from 'react';
              import PropTypes from 'prop-types';
              import { AUTH_ERRORS, AUTH_LEVEL } from 'platform/user/authentication/errors';
              import ContactCenterInformation from 'platform/user/authentication/components/ContactCenterInformation';
              
              
              Severity: Major
              Found in src/applications/auth/components/RenderErrorContainer.jsx - About 1 day to fix

                File ReviewCardField.jsx has 557 lines of code (exceeds 250 allowed). Consider refactoring.
                Open

                import {
                  getDefaultFormState,
                  getDefaultRegistry,
                } from '@department-of-veterans-affairs/react-jsonschema-form/lib/utils';
                import * as Sentry from '@sentry/browser';

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

                  // we're not using JSON schema for this form
                  import environment from '@department-of-veterans-affairs/platform-utilities/environment';
                  import footerContent from 'platform/forms/components/FormFooter';
                  import getHelp from '../../shared/components/GetFormHelp';
                  
                  
                  Severity: Major
                  Found in src/applications/simple-forms/20-10207/config/form.js - About 1 day to fix

                    File ReviewCardField.jsx has 552 lines of code (exceeds 250 allowed). Consider refactoring.
                    Open

                    import {
                      getDefaultFormState,
                      getDefaultRegistry,
                    } from '@department-of-veterans-affairs/react-jsonschema-form/lib/utils';
                    import * as Sentry from '@sentry/browser';

                      File FileField.jsx has 552 lines of code (exceeds 250 allowed). Consider refactoring.
                      Open

                      import PropTypes from 'prop-types';
                      import React, { useEffect, useState, useRef } from 'react';
                      import classNames from 'classnames';
                      import { VaModal } from '@department-of-veterans-affairs/component-library/dist/react-bindings';
                      
                      
                      Severity: Major
                      Found in src/applications/appeals/shared/components/FileField.jsx - About 1 day to fix

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

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

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

                          /**
                           * The intent for this module is to provide a flexible, reusable address schema and widget that can be used in any form throughout VA.gov.
                           * The address uiSchema should be flexible enough to handle these cases:
                           * 1. Top level address property (schema.properties.address)
                           * 2. Nested address property (schema.properties.someProperty.properties.address)
                          Severity: Major
                          Found in src/applications/disability-benefits/2346/schemas/address-schema.js - About 1 day to fix

                            Function ResponseInboxPage has 230 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                            const ResponseInboxPage = () => {
                              const [error, hasError] = useState(false);
                              const [sendReply, setSendReply] = useState({ reply: '', attachments: [] });
                              const [loading, isLoading] = useState(true);
                              const [inquiryData, setInquiryData] = useState([]);
                            Severity: Major
                            Found in src/applications/ask-va/containers/ResponseInboxPage.jsx - About 1 day to fix

                              File CompareLayout.jsx has 550 lines of code (exceeds 250 allowed). Consider refactoring.
                              Open

                              import React from 'react';
                              import { connect } from 'react-redux';
                              import classNames from 'classnames';
                              import _ from 'lodash';
                              import environment from 'platform/utilities/environment';
                              Severity: Major
                              Found in src/applications/gi/containers/CompareLayout.jsx - About 1 day to fix

                                Function VAFacilityPageV2 has 228 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                export default function VAFacilityPageV2() {
                                  const pageTitle = useSelector(state => getPageTitle(state, pageKey));
                                
                                  const history = useHistory();
                                  const dispatch = useDispatch();

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

                                  import _ from 'lodash';
                                  import {
                                    CategoryEducation,
                                    CHAPTER_2,
                                    CHAPTER_3,
                                  Severity: Major
                                  Found in src/applications/ask-va/config/schema-helpers/formFlowHelper.js - About 1 day to fix

                                    File actions.js has 544 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
                                      Severity
                                      Category
                                      Status
                                      Source
                                      Language