department-of-veterans-affairs/vets-website

View on GitHub

Showing 4,177 of 14,709 total issues

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

const ChangeOfAddressWrapper = ({ mailingAddress, 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 SettingsPage has a Cognitive Complexity of 37 (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

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

  render() {
    const { supplies, order, eligibility } = this.props;
    const currentDate = moment();
    const accessorySupplies = supplies.filter(
      supply => supply.productGroup === ACCESSORY,

    Function UpcomingAppointmentsPage has 139 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    const UpcomingAppointmentsPage = props => {
      const { router } = props;
      const [refresh, setRefresh] = useState(false);
      const selectApp = useMemo(makeSelectApp, []);
      const { app } = useSelector(selectApp);

      Function mapStateToProps has 139 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      function mapStateToProps(state, ownProps) {
        const { formContext } = ownProps;
        const loggedIn = isLoggedIn(state);
        const { form, askVA } = state;
        const formData = form.data;
      Severity: Major
      Found in src/applications/ask-va/containers/ReviewPage.jsx - About 5 hrs to fix

        Function submitFilesLighthouse has 139 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        export function submitFilesLighthouse(claimId, trackedItem, files) {
          let filesComplete = 0;
          let bytesComplete = 0;
          let hasError = false;
          const totalSize = files.reduce((sum, file) => sum + file.file.size, 0);
        Severity: Major
        Found in src/applications/claims-status/actions/index.js - About 5 hrs to fix

          Function editPhoneNumberSuccess has 139 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          export const editPhoneNumberSuccess = () => {
            // store the phone number that's passed in via the POST or PUT call so we can
            // return it with the GET user/ response
            let newAreaCode;
            let newPhoneNumber;
          Severity: Major
          Found in src/applications/personalization/profile/msw-mocks.js - About 5 hrs to fix

            Function ProgressNoteDetails has 139 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            const ProgressNoteDetails = props => {
              const { record, runningUnitTest } = props;
              const user = useSelector(state => state.user.profile);
              const allowTxtDownloads = useSelector(
                state =>

              Function PathologyDetails has 139 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              const PathologyDetails = props => {
                const { record, fullState, runningUnitTest } = props;
                const user = useSelector(state => state.user.profile);
                const allowTxtDownloads = useSelector(
                  state =>

                File dependentChildrenPages.js has 397 lines of code (exceeds 250 allowed). Consider refactoring.
                Open

                import merge from 'lodash/merge';
                import get from 'platform/utilities/data/get';
                
                import {
                  arrayBuilderItemFirstPageTitleUI,

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

                    render() {
                      const {
                        route,
                        params,
                        form,
                  Severity: Major
                  Found in src/platform/forms-system/src/js/containers/FormPage.jsx - About 5 hrs to fix

                    Function generateFeatureToggles has 137 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                    const generateFeatureToggles = (toggles = {}) => {
                      const {
                        mhvLandingPagePersonalization = true,
                        mhvMedicationsToVaGovRelease = true,
                        mhvMedicationsDisplayRefillContent = true,
                    Severity: Major
                    Found in src/platform/mhv/api/mocks/feature-toggles/index.js - About 5 hrs to fix

                      Function DependentInformation has 137 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                      const DependentInformation = props => {
                        const { data, goToPath, setFormData } = props;
                      
                        const { dependents = [] } = data;
                        const search = new URLSearchParams(window.location.search);
                      Severity: Major
                      Found in src/applications/ezr/components/FormPages/DependentInformation.jsx - About 5 hrs to fix

                        Function DependentInformation has 137 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                        const DependentInformation = props => {
                          const { data, goToPath, setFormData } = props;
                        
                          const { dependents = [] } = data;
                          const search = new URLSearchParams(window.location.search);

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

                            render() {
                              const { route, userIdVerified, userLoggedIn } = this.props;
                              const { formConfig, pageList } = route;
                          
                              return (
                          Severity: Major
                          Found in src/applications/simple-forms/21-0845/containers/IntroductionPage.jsx - About 5 hrs to fix

                            Function EmploymentQuestion has 137 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                            const EmploymentQuestion = props => {
                              const {
                                data,
                                goBack,
                                goToPath,

                              Function MessageThreadItem has 137 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 {

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

                                /* eslint-disable camelcase */
                                import React from 'react';
                                import { Route } from 'react-router-dom';
                                import { expect } from 'chai';
                                import { fireEvent, waitFor } from '@testing-library/dom';

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

                                  /* eslint-disable camelcase */
                                  /* eslint-disable no-restricted-syntax */
                                  
                                  export const PAGE_TITLE = 'GI Bill® CT Redesign Sandbox';
                                  
                                  
                                  Severity: Minor
                                  Found in src/applications/gi/constants.js - About 5 hrs to fix

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

                                    // Node modules.
                                    import React from 'react';
                                    import PropTypes from 'prop-types';
                                    import { CONTACTS } from '@department-of-veterans-affairs/component-library/contacts';
                                    // Relative imports.
                                      Severity
                                      Category
                                      Status
                                      Source
                                      Language