department-of-veterans-affairs/vets-website

View on GitHub

Showing 4,177 of 14,709 total issues

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

Function SecondFAQSection has 172 lines of code (exceeds 25 allowed). Consider refactoring.
Open

export const SecondFAQSection = () => {
  return (
    <>
      <h3 className="dhp-faq-section-header">
        Connecting Your Device & Data Sharing
Severity: Major
Found in src/applications/dhp-connected-devices/components/FAQSections.jsx - About 6 hrs to fix

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

      render() {
        const {
          activeEditView,
          fieldName,
          isEmpty,

      Function IntroductionPage has 171 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      const IntroductionPage = props => {
        useEffect(() => {
          focusElement('h1');
          scrollTo('topContentElement');
        }, []);
      Severity: Major
      Found in src/applications/appeals/995/containers/IntroductionPage.jsx - About 6 hrs to fix

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

          render() {
            const {
              activeEditView,
              fieldName,
              isEmpty,

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

            render() {
              const {
                activeEditView,
                fieldName,
                isEmpty,

            Function VaMedicalCenter has 171 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 6 hrs to fix

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

                render() {
                  const {
                    activeEditView,
                    fieldName,
                    isEmpty,

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

                  render() {
                    const { supplies, order, eligibility } = this.props;
                    const currentDate = moment();
                    const batterySupplies = supplies.filter(
                      batterySupply => batterySupply.productGroup === BATTERY,
                Severity: Major
                Found in src/applications/disability-benefits/2346/components/Batteries.jsx - About 6 hrs to fix

                  Function Navigation has 171 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  const Navigation = () => {
                    const [isMobile, setIsMobile] = useState(true);
                    const [isNavigationOpen, setIsNavigationOpen] = useState(false);
                    const location = useLocation();
                    const activeFolder = useSelector(folder);
                  Severity: Major
                  Found in src/applications/mhv-secure-messaging/components/Navigation.jsx - About 6 hrs to fix

                    Function submitFiles has 171 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                    export function submitFiles(claimId, trackedItem, files) {
                      let filesComplete = 0;
                      let bytesComplete = 0;
                      let hasError = false;
                      const totalSize = files.reduce((sum, file) => sum + file.file.size, 0);
                    Severity: Major
                    Found in src/applications/claims-status/actions/index.js - About 6 hrs to fix

                      Function uiSchema has 170 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/definitions/address.js - About 6 hrs to fix

                        Function AlertBackgroundBox has 170 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                        const AlertBackgroundBox = props => {
                          const dispatch = useDispatch();
                          const alertList = useSelector(state => state.sm.alerts?.alertList);
                          const folder = useSelector(state => state.sm.folders?.folder);
                          const [alertContent, setAlertContent] = useState('');

                          File pdfConfigs.js has 450 lines of code (exceeds 250 allowed). Consider refactoring.
                          Open

                          import {
                            createNoDescriptionText,
                            createOriginalFillRecord,
                            dateFormat,
                            processList,
                          Severity: Minor
                          Found in src/applications/mhv-medications/util/pdfConfigs.js - About 6 hrs to fix

                            File YourHealthInformation.jsx has 449 lines of code (exceeds 250 allowed). Consider refactoring.
                            Open

                            import React from 'react';
                            import PropTypes from 'prop-types';
                            import { useSelector } from 'react-redux';
                            import { parse } from 'date-fns';
                            
                            
                            Severity: Minor
                            Found in src/applications/avs/components/YourHealthInformation.jsx - About 6 hrs to fix

                              Function MicroDetails has 169 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

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

                                Function useStorage has 168 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                const useStorage = (app, local = false) => {
                                  const STORAGE_KEYS = useMemo(
                                    () => {
                                      return createStorageKeys({ app });
                                    },
                                Severity: Major
                                Found in src/applications/check-in/hooks/useStorage.jsx - About 6 hrs to fix

                                  Function ReplyForm has 168 lines of code (exceeds 25 allowed). Consider refactoring.
                                  Open

                                  const ReplyForm = props => {
                                    const {
                                      cannotReply,
                                      drafts,
                                      replyMessage,

                                    Function transformVAOSAppointment has 168 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 6 hrs to fix

                                      File ReviewPage.jsx has 446 lines of code (exceeds 250 allowed). Consider refactoring.
                                      Open

                                      import React, { useLayoutEffect } from 'react';
                                      import { useFormikContext } from 'formik';
                                      import { Link, useLocation } from 'react-router-dom';
                                      import { VaOnThisPage } from '@department-of-veterans-affairs/component-library/dist/react-bindings';
                                      import {
                                      Severity: Minor
                                      Found in src/applications/burial-poc-v6/pages/ReviewPage.jsx - About 6 hrs to fix
                                        Severity
                                        Category
                                        Status
                                        Source
                                        Language