department-of-veterans-affairs/vets-website

View on GitHub

Showing 4,177 of 14,709 total issues

Function Allergies has 167 lines of code (exceeds 25 allowed). Consider refactoring.
Open

const Allergies = props => {
  const { runningUnitTest } = props;
  const dispatch = useDispatch();

  const updatedRecordList = useSelector(
Severity: Major
Found in src/applications/mhv-medical-records/containers/Allergies.jsx - About 6 hrs to fix

    responses has 48 functions (exceeds 20 allowed). Consider refactoring.
    Open

    const responses = {
      'GET /vaos/v0/appointments': (req, res) => {
        if (req.query.type === 'cc') {
          return res.json(confirmedCC);
        }
    Severity: Minor
    Found in src/applications/vaos/services/mocks/index.js - About 6 hrs to fix

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

      import merge from 'lodash/merge';
      import get from 'platform/utilities/data/get';
      import unset from 'platform/utilities/data/unset';
      
      import fullSchema1990 from 'vets-json-schema/dist/22-1990-schema.json';
      Severity: Minor
      Found in src/applications/edu-benefits/1990/config/form.js - About 6 hrs to fix

        Function uiSchema has 166 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        export function uiSchema(
          label = 'Address',
          useStreet3 = false,
          isRequired = null,
          ignoreRequired = false,
        Severity: Major
        Found in src/platform/forms-system/src/js/definitions/address.js - About 6 hrs to fix

          File get.js has 443 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          /* istanbul ignore file */
          const dateFns = require('date-fns');
          const { utcToZonedTime, zonedTimeToUtc, format } = require('date-fns-tz');
          const {
            singleAppointment,
          Severity: Minor
          Found in src/applications/check-in/api/local-mock-api/mocks/v2/shared/get.js - About 6 hrs to fix

            File FormPage.jsx has 442 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            import PropTypes from 'prop-types';
            import React from 'react';
            import { connect } from 'react-redux';
            import { withRouter } from 'react-router';
            import classNames from 'classnames';
            Severity: Minor
            Found in src/platform/forms-system/src/js/containers/FormPage.jsx - About 6 hrs to fix

              File ConfirmationPage.jsx has 442 lines of code (exceeds 250 allowed). Consider refactoring.
              Open

              import React from 'react';
              import { connect } from 'react-redux';
              import { focusElement } from '@department-of-veterans-affairs/platform-utilities/ui';
              import scrollToTop from 'platform/utilities/ui/scrollToTop';
              import classNames from 'classnames';

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

                  render() {
                    const { showWizard } = this.props;
                
                    if (showWizard === undefined) return null;
                
                
                Severity: Major
                Found in src/applications/edu-benefits/0994/containers/IntroductionPage.jsx - About 6 hrs to fix

                  Function MessageList has 165 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  const MessageList = props => {
                    const dispatch = useDispatch();
                    const { folder, messages, keyword, isSearch, sortOrder, page } = props;
                  
                    const location = useLocation();

                    File index.jsx has 441 lines of code (exceeds 250 allowed). Consider refactoring.
                    Open

                    import React, { useMemo, useState, useLayoutEffect } from 'react';
                    import { useSelector, useDispatch } from 'react-redux';
                    import { useTranslation, Trans } from 'react-i18next';
                    import isValid from 'date-fns/isValid';
                    import PropTypes from 'prop-types';

                      Function parseRadiologyReport has a Cognitive Complexity of 43 (exceeds 5 allowed). Consider refactoring.
                      Open

                      export const parseRadiologyReport = radiologyReportText => {
                        const radiologyReportMap = {};
                        const lines = radiologyReportText ? radiologyReportText.split(/\r?\n/) : [];
                        let i = 0;
                        let clinicalHistory = '';
                      Severity: Minor
                      Found in src/applications/mhv-medical-records/util/radiologyUtil.js - About 6 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 FileInput has 164 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                      const FileInput = props => {
                        const {
                          attachments,
                          setAttachments,
                          setAttachFileSuccess,

                        Function AdmissionAndDischargeDetails has 164 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                        const AdmissionAndDischargeDetails = props => {
                          const { record, runningUnitTest } = props;
                          const user = useSelector(state => state.user.profile);
                          const allowTxtDownloads = useSelector(
                            state =>

                          File conditionOptions.js has 439 lines of code (exceeds 250 allowed). Consider refactoring.
                          Open

                          export const conditionObjects = [
                            { option: 'ACL tear (anterior cruciate ligament tear)', sideOfBody: true },
                            { option: 'acne' },
                            { option: 'adjustment disorder' },
                            { option: 'agoraphobia' },

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

                            // Node modules.
                            import React, { Component } from 'react';
                            import PropTypes from 'prop-types';
                            import appendQuery from 'append-query';
                            import { connect } from 'react-redux';
                            Severity: Minor
                            Found in src/applications/static-pages/cta-widget/index.js - About 6 hrs to fix

                              File index.unit.spec.js has 439 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 userEvent from '@testing-library/user-event';

                                Function ViewAppeal has 163 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                const ViewAppeal = () => {
                                  useEffect(() => {
                                    focusElement('h2');
                                    scrollTo('topScrollElement');
                                  });
                                Severity: Major
                                Found in src/applications/appeals/testing/download/containers/ViewAppeal.jsx - About 6 hrs to fix

                                  Function getGroupedPreviousEnrollments has 163 lines of code (exceeds 25 allowed). Consider refactoring.
                                  Open

                                  export const getGroupedPreviousEnrollments = month => {
                                    const { transactDate, actBegin, actEnd, id, paymentDate } = month[0];
                                    const myUUID = uuidv4();
                                  
                                    return (
                                  Severity: Major
                                  Found in src/applications/verify-your-enrollment/helpers.jsx - About 6 hrs to fix

                                    Function PastAppointmentsListNew has 163 lines of code (exceeds 25 allowed). Consider refactoring.
                                    Open

                                    export default function PastAppointmentsListNew() {
                                      const history = useHistory();
                                      const dispatch = useDispatch();
                                      const [isInitialMount, setInitialMount] = useState(true);
                                      const dateRangeOptions = getPastAppointmentDateRangeOptions();

                                      Function RequestedAppointmentDetailsPage has 163 lines of code (exceeds 25 allowed). Consider refactoring.
                                      Open

                                      export default function RequestedAppointmentDetailsPage() {
                                        const { id } = useParams();
                                        const dispatch = useDispatch();
                                      
                                        useEffect(
                                        Severity
                                        Category
                                        Status
                                        Source
                                        Language