department-of-veterans-affairs/vets-website

View on GitHub

Showing 3,724 of 12,675 total issues

Function renderYourMilitaryDetails has 180 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  const renderYourMilitaryDetails = () => {
    const chapter33Check = giBillChapter === '33a' || giBillChapter === '33b';
    /*
      ***toggleCumulativeDropDown***
      Hide Cumulative Post 9/11 active-duty service drop down if applicant selects 'Fry Scholarship'
Severity: Major
Found in src/applications/gi/components/profile/BenefitsForm.jsx - About 7 hrs to fix

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

      render() {
        return (
          <div
            className="schemaform-intro"
            itemScope
    Severity: Major
    Found in src/applications/edu-benefits/10203/containers/IntroductionPage.jsx - About 7 hrs to fix

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

      const VaMedicalCenter = props => {
        const {
          errorSchema,
          formContext,
          formData,
      Severity: Major
      Found in src/applications/hca/components/FormFields/VaMedicalCenter.jsx - About 7 hrs to fix

        File FilterYourResults.jsx has 465 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        import React, { useState } from 'react';
        import { useHistory } from 'react-router-dom';
        import { connect } from 'react-redux';
        import _ from 'lodash';
        import recordEvent from 'platform/monitoring/record-event';
        Severity: Minor
        Found in src/applications/gi/containers/FilterYourResults.jsx - About 7 hrs to fix

          File App.jsx has 464 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          import React, { useEffect, useState } from 'react';
          import { connect } from 'react-redux';
          import moment from 'moment';
          import PropTypes from 'prop-types';
          import { VaBreadcrumbs } from '@department-of-veterans-affairs/web-components/react-bindings';
          Severity: Minor
          Found in src/applications/my-education-benefits/containers/App.jsx - About 7 hrs to fix

            File ArrayField.jsx has 464 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';
            import Scroll from 'react-scroll';

              Function transformVAOSAppointment has 178 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              export function transformVAOSAppointment(appt) {
                const appointmentType = getAppointmentType(appt);
                const isCC = appt.kind === 'cc';
                const isVideo = appt.kind === 'telehealth';
                const isAtlas = !!appt.telehealth?.atlas;
              Severity: Major
              Found in src/applications/vaos/services/appointment/transformers.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 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 form.js has 460 lines of code (exceeds 250 allowed). Consider refactoring.
                  Open

                  import React from 'react';
                  import environment from '@department-of-veterans-affairs/platform-utilities/environment';
                  import { externalServices } from 'platform/monitoring/DowntimeNotification';
                  import get from 'platform/utilities/data/get';
                  import manifest from '../manifest.json';
                  Severity: Minor
                  Found in src/applications/ivc-champva/10-7959C/config/form.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(

                      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

                            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,
                              selectRegisteredCernerFacilityIds,
                            } from '../redux/selectors';
                            Severity: Minor
                            Found in src/applications/vaos/new-appointment/newAppointmentFlow.js - About 7 hrs to fix

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

                              // disabled for unit testing to work
                              /* eslint-disable no-restricted-syntax */
                              /* eslint-disable guard-for-in */
                              
                              import React from 'react';
                              Severity: Minor
                              Found in src/applications/edu-benefits/components/EducationWizard.jsx - About 7 hrs to fix

                                Function SmBreadcrumbs has 174 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                const SmBreadcrumbs = () => {
                                  const dispatch = useDispatch();
                                  const location = useLocation();
                                  const history = useHistory();
                                  const activeFolder = useSelector(state => state.sm.folders.folder);

                                  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

                                      Function generateResultsMedicationListContent has a Cognitive Complexity of 45 (exceeds 5 allowed). Consider refactoring.
                                      Open

                                      const generateResultsMedicationListContent = async (
                                        medication,
                                        doc,
                                        results,
                                        hasHorizontalRule,
                                      Severity: Minor
                                      Found in src/platform/pdf/templates/medications.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

                                      Severity
                                      Category
                                      Status
                                      Source
                                      Language