department-of-veterans-affairs/vets-website

View on GitHub

Showing 4,177 of 14,709 total issues

File stateList.js has 313 lines of code (exceeds 250 allowed). Consider refactoring.
Open

const stateList = [
  {
    key: 'AL',
    label: 'Alabama',
    value: 'AL',
Severity: Minor
Found in src/applications/check-in/utils/appConstants/stateList.js - About 3 hrs to fix

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

    import React from 'react';
    import moment from 'moment';
    import MockDate from 'mockdate';
    import { mockFetch } from '@department-of-veterans-affairs/platform-testing/helpers';
    import { expect } from 'chai';

      DEFAULT_ARRAY_BUILDER_TEXT has 29 functions (exceeds 20 allowed). Consider refactoring.
      Open

      export const DEFAULT_ARRAY_BUILDER_TEXT = {
        alertItemUpdated: props => {
          const itemName = props.getItemName(props.itemData, props.index);
          return itemName
            ? `${itemName}’s information has been updated`

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

        import environment from '@department-of-veterans-affairs/platform-utilities/environment';
        import { cloneDeep } from 'lodash';
        import { externalServices } from 'platform/monitoring/DowntimeNotification';
        
        import {
        Severity: Minor
        Found in src/applications/ivc-champva/10-7959f-2/config/form.js - About 3 hrs to fix

          Function mockPrescription has 87 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          function mockPrescription(n = 0, attrs = {}) {
            // Generate some refillable, some not
            const isRefillable = n % 3 === 0;
            const refillRemaining = isRefillable ? Math.ceil(Math.log(n + 1)) : 0;
            const {
          Severity: Major
          Found in src/platform/mhv/api/mocks/medications/prescriptions/index.js - About 3 hrs to fix

            Function OverviewPage has 87 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            const OverviewPage = () => {
              const { debtLetters, mcp } = useSelector(
                ({ combinedPortal }) => combinedPortal,
              );
              const {

              Function Index has 87 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              const Index = props => {
                const { router } = props;
                const { t } = useTranslation();
              
                const { jumpToPage } = useFormRouting(router);
              Severity: Major
              Found in src/applications/check-in/pre-check-in/pages/Landing/index.jsx - About 3 hrs to fix

                Function formConfig has 87 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                const formConfig = (pathname = null) => {
                  const { title, subTitle, formNumber } = getFormContent(pathname);
                
                  return {
                    rootUrl: manifest.rootUrl,
                Severity: Major
                Found in src/applications/simple-forms/form-upload/config/form.js - About 3 hrs to fix

                  Function AppealsV2StatusPage has 87 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  export default function AppealsV2StatusPage() {
                    const [appeal, fullName] = useOutletContext();
                    const {
                      events,
                      alerts,
                  Severity: Major
                  Found in src/applications/claims-status/containers/AppealsV2StatusPage.jsx - About 3 hrs to fix

                    Function labsAndTestsReducer has 87 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                    export const labsAndTestsReducer = (state = initialState, action) => {
                      switch (action.type) {
                        case Actions.LabsAndTests.GET: {
                          if ('phrDetails' in action.response) {
                            // Special case to handle radiology.
                    Severity: Major
                    Found in src/applications/mhv-medical-records/reducers/labsAndTests.js - About 3 hrs to fix

                      Function DebtLettersDownload has 86 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                      const DebtLettersDownload = () => {
                        const { debtLinks, isError, isVBMSError, hasDependentDebts } = useSelector(
                          ({ combinedPortal }) => combinedPortal.debtLetters,
                        );
                      
                      

                        Function ConfirmationPage has 86 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                        export function ConfirmationPage(props) {
                          const { form } = props;
                          const { submission, data } = form;
                          const submitDate = new Date(submission?.timestamp);
                        
                        
                        Severity: Major
                        Found in src/applications/ivc-champva/10-10D/containers/ConfirmationPage.jsx - About 3 hrs to fix

                          Function transformForSubmit has 86 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                          export default function transformForSubmit(formConfig, form) {
                            const transformedData = JSON.parse(
                              formsSystemTransformForSubmit(formConfig, form),
                            );
                          
                          
                          Severity: Major
                          Found in src/applications/ivc-champva/10-10D/config/submitTransformer.js - About 3 hrs to fix

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

                            import { apiRequest } from '@department-of-veterans-affairs/platform-utilities/api';
                            import environment from '@department-of-veterans-affairs/platform-utilities/environment';
                            import {
                              isVerificationEndDateValid,
                              removeCommas,
                            Severity: Minor
                            Found in src/applications/verify-your-enrollment/actions/index.js - About 3 hrs to fix

                              Function isPostalCodeRequired has 86 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                              export const isPostalCodeRequired = data => {
                                const {
                                  contactPreference,
                                  relationshipToVeteran,
                                  selectCategory,
                              Severity: Major
                              Found in src/applications/ask-va/config/helpers.jsx - About 3 hrs to fix

                                Function ScheduleReferral has 86 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                export default function ScheduleReferral(props) {
                                  const { currentReferral } = props;
                                  const location = useLocation();
                                  const dispatch = useDispatch();
                                  useEffect(
                                Severity: Major
                                Found in src/applications/vaos/referral-appointments/ScheduleReferral.jsx - About 3 hrs to fix

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

                                  const allFolders = {
                                    data: [
                                      {
                                        attributes: {
                                          count: 3,
                                  Severity: Minor
                                  Found in src/applications/personalization/dashboard/mocks/messaging/index.js - About 3 hrs to fix

                                    File DownloadReportPage.jsx has 310 lines of code (exceeds 250 allowed). Consider refactoring.
                                    Open

                                    import React, { useCallback, useEffect, useState, useMemo } from 'react';
                                    import { useDispatch, useSelector } from 'react-redux';
                                    import PropTypes from 'prop-types';
                                    import {
                                      updatePageTitle,

                                      Function subscribeComponentAnalyticsEvents has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
                                      Open

                                      export function subscribeComponentAnalyticsEvents(
                                        e,
                                        recordEvent = _recordEvent,
                                      ) {
                                        // Is it a component we are tracking?
                                      Severity: Minor
                                      Found in src/platform/site-wide/component-library-analytics-setup.js - About 3 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 checkValidSchema has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
                                      Open

                                      export function checkValidSchema(schema, errors = [], path = ['root']) {
                                        if (typeof schema.type !== 'string') {
                                          errors.push(`Missing type in ${path.join('.')} schema.`);
                                        }
                                      
                                      
                                      Severity: Minor
                                      Found in src/platform/forms-system/src/js/helpers.js - About 3 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