department-of-veterans-affairs/vets-website

View on GitHub

Showing 3,724 of 12,675 total issues

Function InstallmentContract has a Cognitive Complexity of 40 (exceeds 5 allowed). Consider refactoring.
Open

const InstallmentContract = props => {
  const { data, goToPath, setFormData } = props;

  const { installmentContracts = [] } = data;

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

const SearchForm = props => {
  const { folder, keyword, resultsCount, query, threadCount } = props;
  const mhvSecureMessagingFilterAccordion = useSelector(
    state =>
      state.featureToggles[

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 blue_button_report.js has 420 lines of code (exceeds 250 allowed). Consider refactoring.
Open

/**
 * Blue Button PDF template.
 *
 * NB: The order in which items are added to the document is important,
 * and thus PDFKit requires performing operations synchronously.
Severity: Minor
Found in src/platform/pdf/templates/blue_button_report.js - About 6 hrs to fix

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

      render() {
        const { supplies, order, eligibility } = this.props;
        const currentDate = moment();
        const batterySupplies = supplies.filter(
          batterySupply => batterySupply.productGroup === BATTERY,

      File validations.js has 420 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      import _ from 'platform/utilities/data';
      import some from 'lodash/some';
      import moment from 'moment';
      
      import {
      Severity: Minor
      Found in src/applications/disability-benefits/all-claims/validations.js - About 6 hrs to fix

        Function FileInput has 152 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        const FileInput = props => {
          const {
            attachments,
            setAttachments,
            setAttachFileSuccess,

          Function AllergyDetails has 152 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          const AllergyDetails = props => {
            const { runningUnitTest } = props;
            const allergy = useSelector(state => state.mr.allergies.allergyDetails);
            const allergyList = useSelector(state => state.mr.allergies.allergiesList);
            const user = useSelector(state => state.user.profile);
          Severity: Major
          Found in src/applications/mhv-medical-records/containers/AllergyDetails.jsx - About 6 hrs to fix

            Function ExtraDetails has 152 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            const ExtraDetails = rx => {
              const { dispStatus, refillRemaining } = rx;
              const pharmacyPhone = pharmacyPhoneNumber(rx);
              let noRefillRemaining = false;
              if (refillRemaining === 0 && dispStatus === 'Active') {
            Severity: Major
            Found in src/applications/mhv-medications/components/shared/ExtraDetails.jsx - About 6 hrs to fix

              File ReviewPage.jsx has 419 lines of code (exceeds 250 allowed). Consider refactoring.
              Open

              import {
                VaAccordion,
                VaAccordionItem,
                VaAlert,
              } from '@department-of-veterans-affairs/component-library/dist/react-bindings';
              Severity: Minor
              Found in src/applications/ask-va/containers/ReviewPage.jsx - About 6 hrs to fix

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

                /* eslint-disable camelcase */
                const simpleUser = {
                  data: {
                    id: '',
                    type: 'users_scaffolds',
                Severity: Minor
                Found in src/applications/personalization/common/mocks/users/index.js - About 6 hrs to fix

                  File helpers.js has 418 lines of code (exceeds 250 allowed). Consider refactoring.
                  Open

                  import { snakeCase } from 'lodash';
                  import URLSearchParams from 'url-search-params';
                  import { useLocation } from 'react-router-dom';
                  
                  import constants from 'vets-json-schema/dist/constants.json';
                  Severity: Minor
                  Found in src/applications/gi/utils/helpers.js - About 6 hrs to fix

                    File LandingPage.jsx has 417 lines of code (exceeds 250 allowed). Consider refactoring.
                    Open

                    import React, { useEffect } from 'react';
                    import { useDispatch, useSelector } from 'react-redux';
                    import { Link } from 'react-router-dom';
                    import { focusElement } from '@department-of-veterans-affairs/platform-utilities/ui';
                    import {
                    Severity: Minor
                    Found in src/applications/mhv-medical-records/containers/LandingPage.jsx - About 6 hrs to fix

                      Function uiSchema has 150 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                      export function uiSchema(label = 'Address', useStreet3 = true) {
                        let fieldOrder = [
                          'street',
                          'unitNumber',
                          'street2',
                      Severity: Major
                      Found in src/applications/ask-va/config/schema-helpers/addressHelper.js - About 6 hrs to fix

                        File display-conditions.js has 415 lines of code (exceeds 250 allowed). Consider refactoring.
                        Open

                        import { range } from 'lodash';
                        import { months } from 'platform/static-data/options-for-select';
                        import { RESPONSES } from './question-data-map';
                        
                        const get15YearsPast = () => `${new Date().getFullYear() - 15}`;
                        Severity: Minor
                        Found in src/applications/discharge-wizard/constants/display-conditions.js - About 5 hrs to fix

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

                            render() {
                              const showUploadModal =
                                this.props.uploading && this.state.canShowUploadModal;
                          
                              return (

                            Function ChooseDateAndTime has 148 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                            export const ChooseDateAndTime = () => {
                              const history = useHistory();
                              const selectedDates = useSelector(state => getSelectedDate(state));
                              const dispatch = useDispatch();
                              const startMonth = format(startOfMonth(referral.preferredDate), 'yyyy-MM');
                            Severity: Major
                            Found in src/applications/vaos/referral-appointments/ChooseDateAndTime.jsx - About 5 hrs to fix

                              Function EvidenceVaRecords has a Cognitive Complexity of 39 (exceeds 5 allowed). Consider refactoring.
                              Open

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

                              export const addressUISchema = (
                                isMilitaryBaseAddress = false,
                                path,
                                callback,
                              ) => {
                              Severity: Minor
                              Found in src/applications/disability-benefits/2346/schemas/address-schema.js - About 5 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 DeleteDraft has a Cognitive Complexity of 39 (exceeds 5 allowed). Consider refactoring.
                              Open

                              const DeleteDraft = props => {
                                const history = useHistory();
                                const location = useLocation();
                                const dispatch = useDispatch();
                                const deleteDraftButtonRef = useRef();

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

                              export function getCalendarData({ appointment, facility }) {
                                let data = {};
                                const isAtlas = appointment?.videoData.isAtlas;
                                const isHome = isVideoHome(appointment);
                                const videoKind = appointment?.videoData.kind;
                              Severity: Minor
                              Found in src/applications/vaos/services/appointment/index.js - About 5 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