department-of-veterans-affairs/vets-website

View on GitHub

Showing 3,724 of 12,675 total issues

Function ChangeOfAddressWrapper has a Cognitive Complexity of 35 (exceeds 5 allowed). Consider refactoring.
Open

const ChangeOfAddressWrapper = ({ mailingAddress, loading, applicantName }) => {
  const { loading: isLoading, error, data: response } = useSelector(
    state => state.updateAddress,
  );
  const {

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 35 (exceeds 5 allowed). Consider refactoring.
Open

export default function App({ children }) {
  const dispatch = useDispatch();
  const profileLoading = useSelector(state => isProfileLoading(state));
  const userLoggedIn = useSelector(state => isLoggedIn(state));

Severity: Minor
Found in src/applications/travel-pay/containers/TravelPayStatusApp.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 transform has a Cognitive Complexity of 35 (exceeds 5 allowed). Consider refactoring.
Open

export function transform(formConfig, form) {
  // Grab isBDD before things are changed/deleted
  const isBDDForm = isBDD(form.data);
  // Grab ratedDisabilities before they're deleted in case the page is inactive
  // We need to send all of these to vets-api even if the veteran doesn't apply
Severity: Minor
Found in src/applications/disability-benefits/all-claims/submit-transformer.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 SettingsPage has a Cognitive Complexity of 35 (exceeds 5 allowed). Consider refactoring.
Open

const SettingsPage = () => {
  const dispatch = useDispatch();

  const fullState = useSelector(state => state);
  const isSharing = useSelector(state => state.mr.sharing.isSharing);
Severity: Minor
Found in src/applications/mhv-medical-records/containers/SettingsPage.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

File exportsFile.js has 385 lines of code (exceeds 250 allowed). Consider refactoring.
Open

export {
  selectUser,
  isLoggedIn,
  selectProfile,
  isVAPatient,
Severity: Minor
Found in src/platform/user/exportsFile.js - About 5 hrs to fix

    File ProfilePageHeader.jsx has 385 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    import PropTypes from 'prop-types';
    import React, { useState } from 'react';
    import { connect } from 'react-redux';
    import _ from 'lodash';
    import classNames from 'classnames';
    Severity: Minor
    Found in src/applications/gi/containers/ProfilePageHeader.jsx - About 5 hrs to fix

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

        render() {
          const { location } = this.props;
      
          if (!location) {
            return null;
      Severity: Major
      Found in src/applications/facility-locator/components/AppointmentInfo.jsx - About 5 hrs to fix

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

          render() {
            const {
              benefitSummaryOptions,
              requestOptions,
              isVeteran,
        Severity: Major
        Found in src/applications/letters/containers/VeteranBenefitSummaryLetter.jsx - About 5 hrs to fix

          Function ConfirmedAppointmentDetailsPage has 130 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          export default function ConfirmedAppointmentDetailsPage() {
            const dispatch = useDispatch();
            const { id } = useParams();
            const {
              appointment,

            File ProfileInformationEditView.jsx has 383 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            import React, { Component } from 'react';
            import PropTypes from 'prop-types';
            import { connect } from 'react-redux';
            
            import { focusElement } from 'platform/utilities/ui';

              File ProfileInformationEditView.jsx has 383 lines of code (exceeds 250 allowed). Consider refactoring.
              Open

              import React, { Component } from 'react';
              import PropTypes from 'prop-types';
              import { connect } from 'react-redux';
              
              import { focusElement } from 'platform/utilities/ui';

                File ResultCard.jsx has 382 lines of code (exceeds 250 allowed). Consider refactoring.
                Open

                import React, { useState } from 'react';
                import { connect } from 'react-redux';
                import classNames from 'classnames';
                import appendQuery from 'append-query';
                import { Link } from 'react-router-dom';
                Severity: Minor
                Found in src/applications/gi/containers/search/ResultCard.jsx - About 5 hrs to fix

                  Function FieldTemplate has 129 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  export default function FieldTemplate(props) {
                    const {
                      id,
                      schema,
                      help,
                  Severity: Major
                  Found in src/platform/forms-system/src/js/components/FieldTemplate.jsx - About 5 hrs to fix

                    Function alertMessage has 129 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                    const alertMessage = (alertType, appType) => {
                      switch (alertType) {
                        case ALERT_TYPES.ALL_ZERO:
                          return {
                            alertStatus: 'info',

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

                        render() {
                          const downloadStatus = this.props.letterDownloadStatus;
                          const letterItems = (this.props.letters || []).map((letter, index) => {
                            let content;
                            let letterTitle;
                      Severity: Major
                      Found in src/applications/letters/containers/LetterList.jsx - About 5 hrs to fix

                        Function AppointmentsPage has 128 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                        const AppointmentsPage = props => {
                          const { router } = props;
                          const selectFeatureToggles = useMemo(makeSelectFeatureToggles, []);
                          const { isUpcomingAppointmentsEnabled } = useSelector(selectFeatureToggles);
                          const selectApp = useMemo(makeSelectApp, []);
                        Severity: Major
                        Found in src/applications/check-in/components/pages/Appointments/index.jsx - About 5 hrs to fix

                          Function MessageThreadItem has 128 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                          const MessageThreadItem = props => {
                            const dispatch = useDispatch();
                            const accordionItemRef = useRef();
                            const { message, isDraftThread, open, forPrint } = props;
                            const {

                            Function createSuccessPayment has 128 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                            const createSuccessPayment = (hasRecentPayment = false) => {
                              return {
                                data: {
                                  id: '',
                                  type: 'bgs_va_payment_history_response',

                              File ContactInfo.jsx has 379 lines of code (exceeds 250 allowed). Consider refactoring.
                              Open

                              import React, { useEffect, useState, useRef } from 'react';
                              import { useSelector } from 'react-redux';
                              import PropTypes from 'prop-types';
                              import { Link } from 'react-router';
                              import { Element } from 'react-scroll';
                              Severity: Minor
                              Found in src/platform/forms-system/src/js/components/ContactInfo.jsx - About 5 hrs to fix

                                File form-submit-transform.js has 379 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
                                // the lts values were found on the LTS database and LTS validates them, so we need to send correct value from here
                                const countries = [
                                  { schemaValue: 'USA', ltsValue: 'US', label: 'United States' },
                                  { schemaValue: 'AFG', ltsValue: 'AF', label: 'Afghanistan' },
                                Severity: Minor
                                Found in src/applications/toe/utils/form-submit-transform.js - About 5 hrs to fix
                                  Severity
                                  Category
                                  Status
                                  Source
                                  Language