department-of-veterans-affairs/vets-website

View on GitHub

Showing 4,177 of 14,709 total issues

Function convertMedication has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

export const convertMedication = med => {
  if (!med) return null;
  if (med.dispStatus?.toLowerCase()?.includes('non-va'))
    return convertNonVaMedication(med);

Severity: Minor
Found in src/applications/mhv-medical-records/reducers/blueButton.js - About 35 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 RefillNotification has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

const RefillNotification = ({ refillStatus }) => {
  // Selectors
  const successfulMeds = useSelector(
    state => state.rx.prescriptions?.refillNotification?.successfulMeds,
  );

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

function UserInfoSection({ enrollmentData = {}, showCurrentAsOfAlert }) {
  // Get today’s date to show information current as of
  const todayFormatted = formatDateShort(new Date());
  const percentageBenefit =
    formatPercent(enrollmentData.percentageBenefit) || 'unavailable';
Severity: Minor
Found in src/applications/post-911-gib-status/components/UserInfoSection.jsx - About 35 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 MedicationsListCard has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

const MedicationsListCard = ({ rx }) => {
  const dispatch = useDispatch();
  const showRefillContent = useSelector(selectRefillContentFlag);
  const latestTrackingStatus = rx?.trackingList?.[0];
  let showRefillRemaining = false;

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

Avoid too many return statements within this function.
Open

      return;

    Avoid too many return statements within this function.
    Open

              return;

      Avoid too many return statements within this function.
      Open

            return;

        Avoid too many return statements within this function.
        Open

                return;

          Avoid too many return statements within this function.
          Open

                return;
          Severity: Major
          Found in src/platform/site-wide/user-nav/components/SearchDropdownComponent.js - About 30 mins to fix

            Avoid too many return statements within this function.
            Open

              return null;
            Severity: Major
            Found in src/platform/mhv/util/helpers.js - About 30 mins to fix

              Avoid too many return statements within this function.
              Open

                    return;

                Avoid too many return statements within this function.
                Open

                        return;

                  Avoid too many return statements within this function.
                  Open

                        return;
                  Severity: Major
                  Found in src/platform/site-wide/user-nav/components/SearchDropdownComponent.js - About 30 mins to fix

                    Avoid too many return statements within this function.
                    Open

                            return;
                    Severity: Major
                    Found in src/platform/site-wide/user-nav/components/SearchDropdownComponent.js - About 30 mins to fix

                      Avoid too many return statements within this function.
                      Open

                            return;
                      Severity: Major
                      Found in src/platform/site-wide/user-nav/components/SearchDropdownComponent.js - About 30 mins to fix

                        Avoid too many return statements within this function.
                        Open

                                return;
                        Severity: Major
                        Found in src/platform/site-wide/user-nav/components/SearchDropdownComponent.js - About 30 mins to fix

                          Avoid too many return statements within this function.
                          Open

                                return;
                          Severity: Major
                          Found in src/platform/site-wide/user-nav/components/SearchDropdownComponent.js - About 30 mins to fix

                            Avoid too many return statements within this function.
                            Open

                                    return;

                              Avoid too many return statements within this function.
                              Open

                                      return;
                              Severity: Major
                              Found in src/platform/site-wide/user-nav/components/SearchDropdownComponent.js - About 30 mins to fix

                                Avoid too many return statements within this function.
                                Open

                                      return;
                                Severity: Major
                                Found in src/platform/site-wide/user-nav/components/SearchDropdownComponent.js - About 30 mins to fix
                                  Severity
                                  Category
                                  Status
                                  Source
                                  Language