department-of-veterans-affairs/vets-website

View on GitHub

Showing 3,724 of 12,675 total issues

Function EvidenceSummary has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring.
Open

const EvidenceSummary = ({
  data,
  goBack,
  goForward,
  setFormData,
Severity: Minor
Found in src/applications/appeals/testing/sc/components/EvidenceSummary.jsx - About 4 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 getMissingInfo has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring.
Open

export const getMissingInfo = ({ data, keys, content, requiredKeys = [] }) => {
  const missingInfo = [];
  // If both home & mobile selected, make only one phone required
  const phones = [keys.homePhone, '|', keys.mobilePhone];
  const eitherPhone =

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

export const validateMilitaryHistory = (errors, serviceRecords, formData) => {
  // Map the highestRank to the corresponding Rank Description from jsonData
  const rankMap = jsonData.reduce((map, rank) => {
    // eslint-disable-next-line no-param-reassign
    map[rank['Rank Code'].toUpperCase()] = rank[
Severity: Minor
Found in src/applications/pre-need-integration/utils/helpers.js - About 4 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 PrintDownload has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring.
Open

const PrintDownload = props => {
  const { onDownload, isSuccess, list, onPrint, onText } = props;
  const [isError, setIsError] = useState(false);

  const [menuOpen, setMenuOpen] = useState(false);
Severity: Minor
Found in src/applications/mhv-medications/components/shared/PrintDownload.jsx - About 4 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 FolderHeader has 102 lines of code (exceeds 25 allowed). Consider refactoring.
Open

const FolderHeader = props => {
  const { folder, searchProps, threadCount } = props;
  const location = useLocation();
  const userFacilities = useSelector(state => state?.user?.profile?.facilities);
  const showInnerNav =

    File component-library-analytics-setup.js has 336 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    /* eslint-disable camelcase */
    /**
     * Attaches CustomEvent 'component-library-analytics' listener to document.body
     * to translate component library actions into analytics dataLayer events.
     */
    Severity: Minor
    Found in src/platform/site-wide/component-library-analytics-setup.js - About 4 hrs to fix

      Function prefillTransformer has 101 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      export default function prefillTransformer(pages, formData, metadata) {
        const prefillRatedDisabilities = data => {
          const { disabilities } = data;
      
          if (!disabilities) {

        Function threadDetailsReducer has 101 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        export const threadDetailsReducer = (state = initialState, action) => {
          switch (action.type) {
            case Actions.Thread.GET_THREAD:
              return {
                ...initialState,
        Severity: Major
        Found in src/applications/mhv-secure-messaging/reducers/threadDetails.js - About 4 hrs to fix

          Function GettingStartedWithBenefits has 101 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          const GettingStartedWithBenefits = () => {
            return (
              <div>
                <div className="vads-u-margin-top--neg1p5 vads-u-padding-left--2p5 small-screen-font">
                  <div className="vads-u-margin-y--2p5">
          Severity: Major
          Found in src/applications/gi/components/profile/GettingStartedWithBenefits.jsx - About 4 hrs to fix

            Function renderYellowRibbon has 101 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              const renderYellowRibbon = () => {
                if (!displayedInputs.yellowRibbon) return null;
            
                let {
                  yellowRibbonDegreeLevelOptions,
            Severity: Major
            Found in src/applications/gi/components/profile/CalculateYourBenefitsForm.jsx - About 4 hrs to fix

              File DeselectableObjectField.jsx has 334 lines of code (exceeds 250 allowed). Consider refactoring.
              Open

              import PropTypes from 'prop-types';
              import React from 'react';
              import classNames from 'classnames';
              import groupBy from 'lodash/groupBy';
              import {

                File Modals.jsx has 334 lines of code (exceeds 250 allowed). Consider refactoring.
                Open

                import React, { useState } from 'react';
                import {
                  VaModal,
                  VaButton,
                } from '@department-of-veterans-affairs/web-components/react-bindings';

                  Function arrayBuilderYesNoUI has 100 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  export const arrayBuilderYesNoUI = (
                    arrayBuilderOptions,
                    yesNoOptions,
                    yesNoOptionsMore,
                  ) => {

                    Function EnrollmentStatusFAQ has 100 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                    const EnrollmentStatusFAQ = () => {
                      const { statusCode } = useSelector(selectEnrollmentStatus);
                    
                      // Declare content blocks for use
                      const {

                      Function DependentSummary has 100 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                      const DependentSummary = props => {
                        const {
                          data,
                          goBack,
                          goForward,
                      Severity: Major
                      Found in src/applications/hca/components/FormPages/DependentSummary.jsx - About 4 hrs to fix

                        Function FileUpload has 100 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                        const FileUpload = props => {
                          const {
                            acceptFileTypes = '.pdf,.jpeg,.png',
                            buttonText = 'Upload file',
                            error,
                        Severity: Major
                        Found in src/applications/ask-va/components/FileUpload.jsx - About 4 hrs to fix

                          Function letters has 100 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                          function letters(state = initialState, action) {
                            switch (action.type) {
                              case GET_LETTERS_SUCCESS: {
                                const letterDownloadStatus = {};
                                action.data.letters.forEach(letter => {
                          Severity: Major
                          Found in src/applications/letters/reducers/index.js - About 4 hrs to fix

                            Function ThirdFAQSection has 100 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                            export const ThirdFAQSection = () => {
                              return (
                                <>
                                  <h3 className="dhp-faq-section-header">Troubleshooting</h3>
                                  <va-accordion
                            Severity: Major
                            Found in src/applications/dhp-connected-devices/components/FAQSections.jsx - About 4 hrs to fix

                              File EvidenceRecords.jsx has 333 lines of code (exceeds 250 allowed). Consider refactoring.
                              Open

                              import React from 'react';
                              import PropTypes from 'prop-types';
                              import { Link } from 'react-router';
                              
                              import {
                              Severity: Minor
                              Found in src/applications/appeals/995/components/EvidenceRecords.jsx - About 4 hrs to fix

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

                                import environment from 'platform/utilities/environment';
                                import commonDefinitions from 'vets-json-schema/dist/definitions.json';
                                import { arrayBuilderPages } from 'platform/forms-system/src/js/patterns/array-builder';
                                import manifest from '../manifest.json';
                                import IntroductionPage from '../containers/IntroductionPage';
                                  Severity
                                  Category
                                  Status
                                  Source
                                  Language