department-of-veterans-affairs/vets-website

View on GitHub

Showing 3,724 of 12,675 total issues

Avoid too many return statements within this function.
Open

      return {
        ...state,
        prescriptionsList: state.prescriptionsList?.map(
          rx =>
            rx.prescriptionId === action.response.id
Severity: Major
Found in src/applications/mhv-medications/reducers/prescriptions.js - About 30 mins to fix

    Avoid too many return statements within this function.
    Open

              return Promise.reject(
                new Error(
                  `post-911-gib-status getEnrollmentData() received unexpected error: ${
                    error.status
                  }: ${error.title}: ${error.detail}`,
    Severity: Major
    Found in src/applications/post-911-gib-status/actions/post-911-gib-status.js - About 30 mins to fix

      Avoid too many return statements within this function.
      Open

              return Promise.reject(
                new Error(
                  'post-911-gib-status getEnrollmentData() received unexpected error (no status code available)',
                ),
              );
      Severity: Major
      Found in src/applications/post-911-gib-status/actions/post-911-gib-status.js - About 30 mins to fix

        Avoid too many return statements within this function.
        Open

                return (
                  <>
                    <p data-testid="status">Active: Refill in process</p>
                    <va-additional-info uswds trigger="What does this status mean?">
                      {dropdownContent()}
        Severity: Major
        Found in src/applications/mhv-medications/components/shared/StatusDropdown.jsx - About 30 mins to fix

          Avoid too many return statements within this function.
          Open

                  return (
                    <>
                      <p data-testid="status">Active: Submitted</p>
                      <va-additional-info
                        uswds
          Severity: Major
          Found in src/applications/mhv-medications/components/shared/StatusDropdown.jsx - About 30 mins to fix

            Avoid too many return statements within this function.
            Open

                    return (
                      <>
                        <p data-testid="status">Transferred</p>
                        <va-additional-info
                          uswds
            Severity: Major
            Found in src/applications/mhv-medications/components/shared/StatusDropdown.jsx - About 30 mins to fix

              Avoid too many return statements within this function.
              Open

                    return {
                      ...state,
                      selectedSortOption: action.payload,
                    };
              Severity: Major
              Found in src/applications/mhv-medications/reducers/prescriptions.js - About 30 mins to fix

                Avoid too many return statements within this function.
                Open

                        return (
                          <>
                            <p data-testid="status">Discontinued</p>
                            <va-additional-info
                              uswds
                Severity: Major
                Found in src/applications/mhv-medications/components/shared/StatusDropdown.jsx - About 30 mins to fix

                  Avoid too many return statements within this function.
                  Open

                        return {
                          ...state,
                          prescriptionsList: state.prescriptionsList?.map(
                            rx =>
                              rx.prescriptionId === action.err.id
                  Severity: Major
                  Found in src/applications/mhv-medications/reducers/prescriptions.js - About 30 mins to fix

                    Avoid too many return statements within this function.
                    Open

                          return {
                            ...state,
                            prescriptionsList: state.prescriptionsList?.map(
                              rx =>
                                rx.prescriptionId === action.prescriptionId
                    Severity: Major
                    Found in src/applications/mhv-medications/reducers/prescriptions.js - About 30 mins to fix

                      Avoid too many return statements within this function.
                      Open

                              return (
                                <>
                                  <p data-testid="status">Unknown</p>
                                  <va-additional-info
                                    uswds
                      Severity: Major
                      Found in src/applications/mhv-medications/components/shared/StatusDropdown.jsx - About 30 mins to fix

                        Avoid too many return statements within this function.
                        Open

                              return {
                                ...state,
                                apiError: true,
                              };
                        Severity: Major
                        Found in src/applications/mhv-medications/reducers/prescriptions.js - About 30 mins to fix

                          Function render has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                          Open

                            render() {
                              if (!this.props.user.login.currentlyLoggedIn) return null;
                              const { savedStatus } = this.props.form;
                              const { formConfig } = this.props;
                              const appType = formConfig?.customText?.appType || APP_TYPE_DEFAULT;
                          Severity: Minor
                          Found in src/platform/forms/save-in-progress/SaveFormLink.jsx - About 25 mins 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 setStaticHeaderDisplay has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                          Open

                          function setStaticHeaderDisplay(
                            show,
                            isMinimalHeaderApplicable,
                            headerState,
                            isDesktop,
                          Severity: Minor
                          Found in src/platform/site-wide/header/components/App/index.js - About 25 mins 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 defaultPostHook has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                          Open

                          const defaultPostHook = pathname => {
                            // On review pages, check the privacy agreement box if it exists and submit.
                            if (pathname.endsWith('/review-and-submit')) {
                              return () => {
                                cy.get(APP_SELECTOR, NO_LOG_OPTION).then($form => {
                          Severity: Minor
                          Found in src/platform/testing/e2e/cypress/support/form-tester/index.js - About 25 mins 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 determineHeaderState has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                          Open

                          function determineHeaderState(show, showMinimalHeader, path, isDesktop) {
                            if (!show) {
                              return 'none';
                            }
                            if (
                          Severity: Minor
                          Found in src/platform/site-wide/header/components/App/index.js - About 25 mins 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 FormSaved has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                          Open

                          const FormSaved = props => {
                            const {
                              router,
                              route,
                              lastSavedDate,
                          Severity: Minor
                          Found in src/platform/forms/save-in-progress/FormSaved.jsx - About 25 mins 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 createDetailItem has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                          Open

                          const createDetailItem = async (doc, config, x, item) => {
                            const paragraphOptions = { lineGap: 6 };
                            let titleText = item.title ?? '';
                            const content = [];
                            const monospaceFont = config.text.monospaceFont || config.text.font;
                          Severity: Minor
                          Found in src/platform/pdf/templates/utils.js - About 25 mins 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 SET_IN_PROGRESS_FORM has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                          Open

                            [SET_IN_PROGRESS_FORM]: (state, action) => {
                              let newState;
                          
                              // if we’re prefilling, we want to use whatever initial data the form has
                              if (state.prefillStatus === PREFILL_STATUSES.pending) {
                          Severity: Minor
                          Found in src/platform/forms/save-in-progress/reducers.js - About 25 mins 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 MHVDowntime has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                          Open

                          function MHVDowntime({
                            appTitle = 'our health tools',
                            children = null,
                            endTime,
                            status,
                          Severity: Minor
                          Found in src/platform/mhv/downtime/containers/MHVDowntime.jsx - About 25 mins 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