department-of-veterans-affairs/vets-website

View on GitHub

Showing 3,724 of 12,675 total issues

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

  render() {
    const {
      currentPageNumber,
      errorMessages,
      facilityCodeSelected,

    Function formReducer has a Cognitive Complexity of 57 (exceeds 5 allowed). Consider refactoring.
    Open

    export default function formReducer(state = initialState, action) {
      switch (action.type) {
        case FORM_PAGE_OPENED: {
          const { data, schema } = setupFormData(
            state.data,
    Severity: Minor
    Found in src/applications/vaos/new-appointment/redux/reducer.js - About 1 day 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 helpers.js has 538 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    import { dropRight, merge } from 'lodash';
    import { getDefaultFormState } from '@department-of-veterans-affairs/react-jsonschema-form/lib/utils';
    import dataGet from '../../../../utilities/data/get';
    import set from '../../../../utilities/data/set';
    import unset from '../../../../utilities/data/unset';
    Severity: Major
    Found in src/platform/forms-system/src/js/state/helpers.js - About 1 day to fix

      File SearchPage.jsx has 538 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      /* eslint-disable react-hooks/exhaustive-deps */
      
      import React, { useEffect, useRef, useState } from 'react';
      import PropTypes from 'prop-types';
      import { connect, useStore } from 'react-redux';
      Severity: Major
      Found in src/applications/representative-search/containers/SearchPage.jsx - About 1 day to fix

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

        /* eslint-disable camelcase */
        /**
         * Functions related to fetching Apppointment data and pulling information from that data
         * @module services/Appointment
         */
        Severity: Major
        Found in src/applications/vaos/services/appointment/index.js - About 1 day to fix

          Function debtSummaryText has 221 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          export const debtSummaryText = (diaryCode, dateOfLetter, balance) => {
            const endDateText = endDate(dateOfLetter, diaryCode);
          
            switch (diaryCode) {
              case '71':

            File applicantFileUpload.js has 535 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            import React from 'react';
            import { titleUI } from 'platform/forms-system/src/js/web-component-patterns';
            import { fileUploadBlurbCustom } from 'applications/ivc-champva/shared/components/fileUploads/attachments';
            import { applicantWording } from '../../../shared/utilities';
            import ApplicantField from '../../../shared/components/applicantLists/ApplicantField';

              File index.jsx has 535 lines of code (exceeds 250 allowed). Consider refactoring.
              Open

              /* eslint-disable react/jsx-key */
              import PropTypes from 'prop-types';
              import React from 'react';
              import moment from 'moment';
              import * as Sentry from '@sentry/browser';
              Severity: Major
              Found in src/applications/disability-benefits/all-claims/utils/index.jsx - About 1 day to fix

                Function OtherResources has 219 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                const OtherResources = () => {
                  return (
                    <div>
                      <section>
                        <div className="va-h-ruled--stars" />
                Severity: Major
                Found in src/applications/sco/components/MainContent/Update/OtherResources.jsx - About 1 day to fix

                  Function RefillPrescriptions has a Cognitive Complexity of 56 (exceeds 5 allowed). Consider refactoring.
                  Open

                  const RefillPrescriptions = ({ isLoadingList = true }) => {
                    // Hooks
                    const location = useLocation();
                    const dispatch = useDispatch();
                  
                  
                  Severity: Minor
                  Found in src/applications/mhv-medications/containers/RefillPrescriptions.jsx - About 1 day 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 ReplyDraftItem.jsx has 531 lines of code (exceeds 250 allowed). Consider refactoring.
                  Open

                  import React, {
                    useEffect,
                    useMemo,
                    useState,
                    useCallback,

                    Function ManageFolderButtons has 214 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                    const ManageFolderButtons = props => {
                      const { ErrorMessages, Alerts } = Constants;
                      const dispatch = useDispatch();
                      const history = useHistory();
                      const { folder } = props;

                      Function CreditCardBill has 213 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                      const CreditCardBill = props => {
                        const { data, goToPath, setFormData } = props;
                      
                        const { expenses } = data;
                        const { creditCardBills = [] } = expenses;

                        Function MoveMessageToFolderBtn has 213 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                        const MoveMessageToFolderBtn = props => {
                          const {
                            threadId,
                            allFolders,
                            isVisible,

                          File inboxThreads.js has 521 lines of code (exceeds 250 allowed). Consider refactoring.
                          Open

                          const { sub, formatISO } = require('date-fns');
                          
                          const inboxThreads = {
                            data: [
                              {
                          Severity: Major
                          Found in src/platform/mhv/api/mocks/secure-messaging/threads/inboxThreads.js - About 1 day to fix

                            File constants.js has 520 lines of code (exceeds 250 allowed). Consider refactoring.
                            Open

                            import React from 'react';
                            
                            export const TITLE = 'Request priority processing for an existing claim';
                            export const SUBTITLE = 'Priority processing request (VA form 20-10207)';
                            
                            
                            Severity: Major
                            Found in src/applications/simple-forms/20-10207/config/constants.js - About 1 day to fix

                              Function PreSubmitCheckboxGroup has 211 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                              const PreSubmitCheckboxGroup = props => {
                                const {
                                  onSectionComplete,
                                  formData,
                                  showError,
                              Severity: Major
                              Found in src/applications/caregivers/components/PreSubmitInfo/index.jsx - About 1 day to fix

                                Function ReplyDraftItem has a Cognitive Complexity of 54 (exceeds 5 allowed). Consider refactoring.
                                Open

                                const ReplyDraftItem = props => {
                                  const {
                                    draft,
                                    drafts,
                                    cannotReply,

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

                                export function FilterBeforeResults({
                                  dispatchFilterChange,
                                  dispatchError,
                                  filters,
                                  modalClose,
                                Severity: Minor
                                Found in src/applications/gi/containers/search/FilterBeforeResults.jsx - About 1 day 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 form-submit-transform.js has 517 lines of code (exceeds 250 allowed). Consider refactoring.
                                Open

                                // this constant maps the values on address.js in vets.json schema from VA.gov values to LTS values
                                
                                import { formFields } from '../constants';
                                
                                // the lts values were found on the LTS database and LTS validates them, so we need to send correct value from here
                                Severity: Major
                                Found in src/applications/my-education-benefits/utils/form-submit-transform.js - About 1 day to fix
                                  Severity
                                  Category
                                  Status
                                  Source
                                  Language