department-of-veterans-affairs/vets-website

View on GitHub

Showing 4,177 of 14,709 total issues

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

const ContestableIssuesWidget = props => {
  const {
    value = [],
    id,
    options,

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

export const App = ({ loggedIn, toggleLoginModal, displayToggle }) => {
  const [lastUpdated, updateLastUpdated] = useState('');
  const [year, updateYear] = useState(0);
  const [formError, updateFormError] = useState({ error: false, type: '' }); // types: "not found", "download error"
  const [formType, updateFormType] = useState('pdf');
Severity: Minor
Found in src/applications/static-pages/download-1095b/components/App/index.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 EmploymentRecord has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
Open

const EmploymentRecord = ({
  idSchema,
  uiSchema,
  formData,
  setFormData,

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

const AttachmentsList = props => {
  const {
    attachments,
    compose,
    draftSequence,
Severity: Minor
Found in src/applications/mhv-secure-messaging/components/AttachmentsList.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

File SearchResult.jsx has 309 lines of code (exceeds 250 allowed). Consider refactoring.
Open

/* eslint-disable @department-of-veterans-affairs/prefer-button-component */

import React, { useState, useEffect } from 'react';
import PropTypes from 'prop-types';
import {

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

    import React from 'react';
    import PropTypes from 'prop-types';
    import { connect } from 'react-redux';
    import { toggleLoginModal as toggleLoginModalAction } from '@department-of-veterans-affairs/platform-site-wide/actions';
    import { useFeatureToggle } from 'platform/utilities/feature-toggles';

      Function CustomPage has 85 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        function CustomPage(props) {
          const searchParams = getArrayUrlSearchParams();
          const isEdit = !!searchParams.get('edit');
          const isAdd = !!searchParams.get('add');
      
      

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

          render() {
            const {
              uiSchema,
              errorSchema,
              idSchema,
        Severity: Major
        Found in src/platform/forms-system/src/js/fields/BasicArrayField.jsx - About 3 hrs to fix

          Function moveToFolderModal has 85 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            const moveToFolderModal = () => {
              return (
                <div
                  className="message-actions-buttons-modal"
                  data-testid="message-actions-buttons-modal"

            Function transformFormToVAOSCCRequest has 85 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            export function transformFormToVAOSCCRequest(state) {
              const data = getFormData(state);
              const provider = data.communityCareProvider;
              const residentialAddress = selectVAPResidentialAddress(state);
              const parentFacility = getChosenCCSystemById(state);

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

                render() {
                  const { claim, lastPage } = this.props;
              
                  let content;
              
              

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

                  const content = () => {
                    if (refreshedOnThisPage) {
                      if (refreshPhase === refreshPhases.CALL_FAILED) {
                        return (
                          <va-alert

                  File incomeReceiptWaiverPages.js has 308 lines of code (exceeds 250 allowed). Consider refactoring.
                  Open

                  import React from 'react';
                  import merge from 'lodash/merge';
                  import {
                    arrayBuilderItemFirstPageTitleUI,
                    arrayBuilderItemSubsequentPageTitleUI,

                    File address.js has 308 lines of code (exceeds 250 allowed). Consider refactoring.
                    Open

                    import get from 'platform/utilities/data/get';
                    import set from 'platform/utilities/data/set';
                    import unset from 'platform/utilities/data/unset';
                    import { createSelector } from 'reselect';
                    
                    
                    Severity: Minor
                    Found in src/applications/pre-need/definitions/address.js - About 3 hrs to fix

                      File ResponseInboxPage.jsx has 308 lines of code (exceeds 250 allowed). Consider refactoring.
                      Open

                      import {
                        VaAlert,
                        VaButton,
                        VaFileInputMultiple,
                        VaIcon,
                      Severity: Minor
                      Found in src/applications/ask-va/containers/ResponseInboxPage.jsx - About 3 hrs to fix

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

                        /* eslint-disable import/no-cycle */
                        import { VA_FORM_IDS } from 'platform/forms/constants';
                        import environment from 'platform/utilities/environment';
                        import FormFooter from 'platform/forms/components/FormFooter';
                        import { externalServices } from 'platform/monitoring/DowntimeNotification';
                        Severity: Minor
                        Found in src/applications/caregivers/config/form.js - About 3 hrs to fix

                          File AutosugggestField.jsx has 308 lines of code (exceeds 250 allowed). Consider refactoring.
                          Open

                          import React from 'react';
                          import PropTypes from 'prop-types';
                          import Downshift from 'downshift';
                          import classNames from 'classnames';
                          
                          

                            File ChangeOfAddressWrapper.jsx has 308 lines of code (exceeds 250 allowed). Consider refactoring.
                            Open

                            import React, { useState, useEffect, useCallback } from 'react';
                            import PropTypes from 'prop-types';
                            import { useDispatch, useSelector } from 'react-redux';
                            import { useLocation } from 'react-router-dom';
                            import LoadingButton from '~/platform/site-wide/loading-button/LoadingButton';

                              File EvidenceVaRecords.jsx has 307 lines of code (exceeds 250 allowed). Consider refactoring.
                              Open

                              import React, { useState, useEffect } from 'react';
                              import { VaTextInput } from '@department-of-veterans-affairs/component-library/dist/react-bindings';
                              
                              import { EVIDENCE_VA_PATH } from '../constants';
                              import { content, contentOld } from '../content/evidenceVaRecords';
                              Severity: Minor
                              Found in src/applications/appeals/995/components/EvidenceVaRecords.jsx - About 3 hrs to fix

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

                                /**
                                 * Functions related to patient specific information
                                 * @module services/Patient
                                 */
                                import environment from '@department-of-veterans-affairs/platform-utilities/environment';
                                Severity: Minor
                                Found in src/applications/vaos/services/patient/index.js - About 3 hrs to fix
                                  Severity
                                  Category
                                  Status
                                  Source
                                  Language