department-of-veterans-affairs/vets-website

View on GitHub

Showing 4,177 of 14,709 total issues

Function AddIssue has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring.
Open

const AddIssue = ({
  validations,
  description,
  data,
  goToPath,
Severity: Minor
Found in src/applications/appeals/shared/components/AddIssue.jsx - 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 Autocomplete has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring.
Open

const Autocomplete = ({
  availableResults,
  debounceDelay,
  formData,
  id,

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 _override has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring.
Open

  _override: error => {
    if (typeof error === 'string') {
      if (error?.endsWith('startDate') || error?.endsWith('endDate')) {
        const errorParts = error.split('.');
        if (error.startsWith('toxicExposure.gulfWar1990Details')) {
Severity: Minor
Found in src/applications/disability-benefits/all-claims/reviewErrors.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 getNewAppointmentFlow has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring.
Open

export default function getNewAppointmentFlow(state) {
  const featureBreadcrumbUrlUpdate = selectFeatureBreadcrumbUrlUpdate(state);
  const flowType = getFlowType(state);
  const isSingleVaFacility = selectSingleSupportedVALocation(state);

Severity: Minor
Found in src/applications/vaos/new-appointment/newAppointmentFlow.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

File VaPrescription.jsx has 322 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import React from 'react';
import PropTypes from 'prop-types';
import { useSelector } from 'react-redux';
import { Link } from 'react-router-dom';
import FEATURE_FLAG_NAMES from '@department-of-veterans-affairs/platform-utilities/featureFlagNames';

    Function updateSchema has 93 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

          const updateSchema = () => {
            if (addressFormData) {
              // if livesOnMilitaryBase is checked
              if (addressFormData?.['view:livesOnMilitaryBase']) {
                const filteredRequiredArray = addressFormRequiredData.filter(

      Function parseLabsAndTests has 93 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      export const parseLabsAndTests = records => {
        return `
      ${txtLine}
      1) Lab and test results
      
      
      Severity: Major
      Found in src/applications/mhv-medical-records/util/txtHelpers/labsAndTests.js - About 3 hrs to fix

        Function getBlueButtonReportData has 93 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        export const getBlueButtonReportData = (options = {}) => async dispatch => {
          const fetchMap = {
            labsAndTests: getLabsAndTests,
            notes: getNotes,
            vaccines: getVaccineList,
        Severity: Major
        Found in src/applications/mhv-medical-records/actions/blueButtonReport.js - About 3 hrs to fix

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

            const content = () => {
              const status = prescription?.dispStatus?.toString();
              return (
                <div className="medication-details-div vads-u-border-top--1px vads-u-border-color--gray-lighter vads-u-margin-top--3 medium-screen:vads-u-margin-top--4 vads-u-margin-bottom--3">
                  <h2 className="vads-u-margin-top--3 medium-screen:vads-u-margin-top--4 vads-u-margin-bottom--2 no-print">

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

            const all = {
              resourceType: 'Bundle',
              id: '12121',
              meta: {
                lastUpdated: '2023-09-29T11:04:31.316-04:00',
            Severity: Minor
            Found in src/platform/mhv/api/mocks/medical-records/allergies/index.js - About 3 hrs to fix

              Function MobileLinks has 92 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              export default function MobileLinks(props) {
                const { links, visible, langConfig, minimalFooter } = props;
              
                return (
                  <div
              Severity: Major
              Found in src/platform/site-wide/va-footer/components/MobileLinks.jsx - About 3 hrs to fix

                Function exports has 92 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                module.exports = async (on, config) => {
                  if (process.env.CODE_COVERAGE === 'true') {
                    require('@cypress/code-coverage/task')(on, config);
                    on('file:preprocessor', require('@cypress/code-coverage/use-babelrc'));
                  }
                Severity: Major
                Found in src/platform/testing/e2e/cypress/plugins/index.js - About 3 hrs to fix

                  Function SubTask has 92 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  export const SubTask = props => {
                    const { pages = [], formData, setFormData, router, focusOnAlertRole } = props;
                    const [currentPage, setCurrentPage] = useState(pages[0] || {});
                    const [subTaskData, setSubTaskData] = useState(getStoredSubTask());
                    const [hasError, setHasError] = useState(false);
                  Severity: Major
                  Found in src/platform/forms/sub-task/index.js - About 3 hrs to fix

                    Function FormSaved has 92 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                    const FormSaved = props => {
                      const {
                        router,
                        route,
                        lastSavedDate,
                    Severity: Major
                    Found in src/platform/forms/save-in-progress/FormSaved.jsx - About 3 hrs to fix

                      Function genBBoxFromAddress has 92 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                      export const genBBoxFromAddress = (query, expandedRadius = false) => {
                        // Prevent empty search request to Mapbox, which would result in error, and
                        // clear results list to respond with message of no facilities found.
                        if (!query.searchString) {
                          return {

                        Function transform has 92 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                        export function transform(formConfig, form) {
                          const usFormTransform = () =>
                            JSON.parse(transformForSubmit(formConfig, form));
                        
                          const prefillTransforms = formData => {
                        Severity: Major
                        Found in src/applications/edu-benefits/0994/submit-transformer.js - About 3 hrs to fix

                          File labels.jsx has 320 lines of code (exceeds 250 allowed). Consider refactoring.
                          Open

                          import React from 'react';
                          
                          import { states } from 'platform/forms/address';
                          import { createUSAStateLabels } from 'platform/forms-system/src/js/helpers';
                          
                          
                          Severity: Minor
                          Found in src/applications/edu-benefits/utils/labels.jsx - About 3 hrs to fix

                            File labels.jsx has 320 lines of code (exceeds 250 allowed). Consider refactoring.
                            Open

                            import React from 'react';
                            
                            import { states } from 'platform/forms/address';
                            import { createUSAStateLabels } from 'platform/forms-system/src/js/helpers';
                            
                            

                              Function Avs has 92 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                              const Avs = props => {
                                useDatadogRum();
                              
                                const user = useSelector(selectUser);
                                const { avsEnabled, featureTogglesLoading } = useSelector(
                              Severity: Major
                              Found in src/applications/avs/containers/Avs.jsx - About 3 hrs to fix

                                Function TravelIntro has 92 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                const TravelIntro = props => {
                                  const { router } = props;
                                  const { t } = useTranslation();
                                
                                  const { goToNextPage } = useFormRouting(router);
                                Severity: Major
                                Found in src/applications/check-in/travel-claim/pages/travel-intro/index.jsx - About 3 hrs to fix
                                  Severity
                                  Category
                                  Status
                                  Source
                                  Language