department-of-veterans-affairs/vets-website

View on GitHub

Showing 4,177 of 14,709 total issues

Function ConditionDetails has 179 lines of code (exceeds 25 allowed). Consider refactoring.
Open

const ConditionDetails = props => {
  const { runningUnitTest } = props;
  const record = useSelector(state => state.mr.conditions.conditionDetails);
  const conditionList = useSelector(
    state => state.mr.conditions.conditionsList,
Severity: Major
Found in src/applications/mhv-medical-records/containers/ConditionDetails.jsx - About 7 hrs to fix

    File ArrayField.jsx has 463 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    import PropTypes from 'prop-types';
    import React from 'react';
    import set from 'platform/utilities/data/set';
    import classNames from 'classnames';
    
    

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

      /** time to wait (in ms) after the user stops typing before initiating draft auto-save */
      export const draftAutoSaveTimeout = 10000;
      
      export const Paths = {
        MYHEALTH: '/my-health',
      Severity: Minor
      Found in src/applications/mhv-secure-messaging/util/constants.js - About 7 hrs to fix

        Function CompareLayout has a Cognitive Complexity of 46 (exceeds 5 allowed). Consider refactoring.
        Open

        const CompareLayout = ({
          calculated,
          estimated,
          institutions,
          showDifferences,
        Severity: Minor
        Found in src/applications/gi/containers/CompareLayout.jsx - About 7 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

        Function PrescriptionDetails has a Cognitive Complexity of 46 (exceeds 5 allowed). Consider refactoring.
        Open

        const PrescriptionDetails = () => {
          const prescription = useSelector(
            state => state.rx.prescriptions?.prescriptionDetails,
          );
          const prescriptionsApiError = useSelector(
        Severity: Minor
        Found in src/applications/mhv-medications/containers/PrescriptionDetails.jsx - About 7 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

        Function getEventContent has 177 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        export function getEventContent(event) {
          switch (event.type) {
            case EVENT_TYPES.claimDecision:
              return {
                title: 'VA sent you a claim decision',
        Severity: Major
        Found in src/applications/claims-status/utils/appeals-v2-helpers.jsx - About 7 hrs to fix

          File ArrayBuilderSummaryPage.jsx has 461 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          /* eslint-disable react-hooks/exhaustive-deps */
          /* eslint-disable react/sort-prop-types */
          import React, { useEffect, useRef, useState } from 'react';
          import { connect } from 'react-redux';
          import { focusElement, scrollAndFocus } from 'platform/utilities/ui';

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

            import {
              selectVAPResidentialAddress,
              selectVAPEmailAddress,
              selectVAPHomePhoneString,
              selectVAPMobilePhoneString,
            Severity: Minor
            Found in src/applications/vaos/covid-19-vaccine/redux/actions.js - About 7 hrs to fix

              Function AppointmentListItem has 176 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              const AppointmentListItem = props => {
                const { appointment, goToDetails, router, app, page, count } = props;
                const { t } = useTranslation();
                const selectFeatureToggles = useMemo(makeSelectFeatureToggles, []);
                const { isMedicationReviewContentEnabled } = useSelector(

                File labsAndTests.js has 460 lines of code (exceeds 250 allowed). Consider refactoring.
                Open

                import { parseISO } from 'date-fns';
                import { Actions } from '../util/actionTypes';
                import {
                  concatObservationInterpretations,
                  dateFormatWithoutTimezone,
                Severity: Minor
                Found in src/applications/mhv-medical-records/reducers/labsAndTests.js - About 7 hrs to fix

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

                  import React from 'react';
                  import MockDate from 'mockdate';
                  import { expect } from 'chai';
                  import moment from 'moment';
                  import { waitFor, within } from '@testing-library/dom';

                    Function PreSubmitSection has 175 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                    export function PreSubmitSection(props) {
                      const {
                        form,
                        preSubmit = {},
                        setPreSubmit,
                    Severity: Major
                    Found in src/platform/forms/components/review/PreSubmitSection.jsx - About 7 hrs to fix

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

                        render() {
                          const { schema, uiSchema, path, pageTitle, formContext } = this.props;
                      
                          const uiOptions = uiSchema['ui:options'] || {};
                          const fieldName = path[path.length - 1];
                      Severity: Major
                      Found in src/platform/forms-system/src/js/review/ArrayField.jsx - About 7 hrs to fix

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

                          render() {
                            const { schema, uiSchema, path, pageTitle, formContext } = this.props;
                        
                            const uiOptions = uiSchema['ui:options'] || {};
                            const fieldName = path[path.length - 1];
                        Severity: Major
                        Found in src/applications/ask-va/components/ArrayField.jsx - About 7 hrs to fix

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

                            const content = () => {
                              if (!showRefillContent) {
                                return <PageNotFound />;
                              }
                              if (isLoading) {
                          Severity: Major
                          Found in src/applications/mhv-medications/containers/RefillPrescriptions.jsx - About 7 hrs to fix

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

                            import { recordEvent } from '@department-of-veterans-affairs/platform-monitoring/exports';
                            import {
                              selectFeatureBreadcrumbUrlUpdate,
                              selectFeatureOHDirectSchedule,
                              selectFeatureOHRequest,
                            Severity: Minor
                            Found in src/applications/vaos/new-appointment/newAppointmentFlow.js - About 7 hrs to fix

                              File helpers.jsx has 457 lines of code (exceeds 250 allowed). Consider refactoring.
                              Open

                              import React from 'react';
                              
                              import {
                                CategoryEducation,
                                CategoryGuardianshipCustodianshipFiduciaryIssues,
                              Severity: Minor
                              Found in src/applications/ask-va/config/helpers.jsx - About 7 hrs to fix

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

                                import React from 'react';
                                import { expect } from 'chai';
                                import userEvent from '@testing-library/user-event';
                                import { within } from '@testing-library/react';
                                import { mockFetch } from '@department-of-veterans-affairs/platform-testing/helpers';

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

                                    render() {
                                      const { route, user } = this.props;
                                  
                                      return (
                                        <div className="schemaform-intro">
                                  Severity: Major
                                  Found in src/applications/fry-dea/containers/IntroductionPage.jsx - About 6 hrs to fix

                                    Function Error has 173 lines of code (exceeds 25 allowed). Consider refactoring.
                                    Open

                                    const Error = () => {
                                      const selectError = useMemo(makeSelectError, []);
                                      const { error } = useSelector(selectError);
                                      const { useToggleValue, TOGGLE_NAMES } = useFeatureToggle();
                                      // appt link will be /my-health/appointments if toggle is on
                                    Severity: Major
                                    Found in src/applications/check-in/pre-check-in/pages/Error/index.jsx - About 6 hrs to fix
                                      Severity
                                      Category
                                      Status
                                      Source
                                      Language