department-of-veterans-affairs/vets-website

View on GitHub

Showing 4,177 of 14,709 total issues

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 {
            ...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">Expired</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,
                refillableList,
                renewableList,
                apiError: false,
        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,
                  refillNotification: initialState.refillNotification,
                };
          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.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">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 null;
                  Severity: Major
                  Found in src/applications/mhv-medications/util/helpers.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 {
                                ...state,
                                refillNotification: {
                                  successfulMeds,
                                  failedMeds,
                        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 {
                                    ...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

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

                              const Search = () => {
                                const onInputSubmit = componentState => {
                                  const inputValue = componentState?.inputValue;
                                  const savedSuggestions = componentState?.savedSuggestions || [];
                                  const suggestions = componentState?.suggestions || [];
                              Severity: Minor
                              Found in src/platform/site-wide/header/components/Search/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 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 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 startApp has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                              Open

                              export default function startApp({
                                routes,
                                createRoutesWithStore,
                                component,
                                reducer,
                              Severity: Minor
                              Found in src/platform/startup/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

                              Severity
                              Category
                              Status
                              Source
                              Language