department-of-veterans-affairs/vets-website

View on GitHub

Showing 3,724 of 12,675 total issues

Function Edit has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

export const Edit = () => {
  const dispatch = useDispatch();
  const history = useHistory();
  const query = useQuery();

Severity: Minor
Found in src/applications/personalization/profile/components/edit/Edit.jsx - About 45 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 NotificationCheckbox has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

export const NotificationCheckbox = ({
  channelId,
  label,
  isOptedIn,
  onValueChange,

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

export const fetchNotifications = () => async dispatch => {
  const getNotifications = () => {
    const options = {
      method: 'GET',
      credentials: 'include',
Severity: Minor
Found in src/applications/personalization/common/actions/notifications.js - About 45 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 ViewDependentsList has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

function ViewDependentsList(props) {
  let mainContent;
  const manageDependentsToggle = props?.manageDependentsToggle ?? null;
  if (props.loading) {
    mainContent = (

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

const mapStateToProps = state => {
  const togglesLoaded = togglesAreLoaded(state);
  const profileToggles = selectProfileToggles(state);
  const signInServicesEligibleForDD = new Set([
    CSP_IDS.ID_ME,
Severity: Minor
Found in src/applications/personalization/profile/components/Profile.jsx - About 45 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 IconCTALink has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

const IconCTALink = ({
  ariaLabel,
  href,
  text,
  // icon should be a valid Font Awesome 5 icon name
Severity: Minor
Found in src/applications/personalization/dashboard/components/IconCTALink.jsx - About 45 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 ConditionDetails has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

const ConditionDetails = props => {
  const { runningUnitTest } = props;
  const record = useSelector(state => state.mr.conditions.conditionDetails);
  const conditionList = useSelector(
    state => state.mr.conditions.conditionsList,
Severity: Minor
Found in src/applications/mhv-medical-records/containers/ConditionDetails.jsx - About 45 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 DownloadRecordsPage has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

const DownloadRecordsPage = ({ runningUnitTest }) => {
  const dispatch = useDispatch();
  const user = useSelector(state => state.user.profile);
  const name = formatName(user.userFullName);
  const dob = formatDateLong(user.dob);
Severity: Minor
Found in src/applications/mhv-medical-records/containers/DownloadRecordsPage.jsx - About 45 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 buildPrescriptionsPDFList has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

export const buildPrescriptionsPDFList = prescriptions => {
  return prescriptions?.map(rx => {
    if (rx?.prescriptionSource === 'NV') {
      return {
        ...buildNonVAPrescriptionPDFList(rx)[0],
Severity: Minor
Found in src/applications/mhv-medications/util/pdfConfigs.js - About 45 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 FillRefillButton has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

const FillRefillButton = rx => {
  const dispatch = useDispatch();

  const { dispensedDate, error, prescriptionId, success, isRefillable } = rx;

Severity: Minor
Found in src/applications/mhv-medications/components/shared/FillRefillButton.jsx - About 45 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 PrescriptionsPrintOnly has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

const PrescriptionsPrintOnly = ({ list, hasError = false }) => {
  const { search } = useLocation();
  const allergies = useSelector(state => state.rx.allergies.allergiesList);
  const selectedSortOption = useSelector(
    state => state.rx.prescriptions.selectedSortOption,
Severity: Minor
Found in src/applications/mhv-medications/containers/PrescriptionsPrintOnly.jsx - About 45 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 buildVAPrescriptionTXT has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

export const buildVAPrescriptionTXT = prescription => {
  const refillHistory = [...(prescription?.rxRfRecords || [])];
  const originalFill = createOriginalFillRecord(prescription);
  refillHistory.push(originalFill);

Severity: Minor
Found in src/applications/mhv-medications/util/txtConfigs.js - About 45 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

Consider simplifying this complex logical expression.
Open

  if (errorEl) {
    // document.body.scrollTop doesn’t work with all browsers, so we’ll cover them all like so:
    const currentPosition =
      window.pageYOffset ||
      document.documentElement.scrollTop ||
Severity: Major
Found in src/platform/utilities/ui/scroll.js - About 40 mins to fix

    Consider simplifying this complex logical expression.
    Open

      if (typeof fromOptions === 'object' && typeof toOptions === 'object') {
        // Extract custom options
        fromLabel = fromOptions.title || fromLabel;
        toLabel = toOptions.title || toLabel;
        fromCustomOptions = { ...fromOptions };
    Severity: Major
    Found in src/platform/forms-system/src/js/web-component-patterns/datePatterns.jsx - About 40 mins to fix

      Consider simplifying this complex logical expression.
      Open

                if (!errorExists(processedErrors, propertyName, index)) {
                  const { chapterKey = '', pageKey = '' } =
                    reviewErrors._override?.(property || err?.stack || argument) ||
                    getPropertyInfo(
                      // List of all form pages; includes chapterKey, pageKey and
      Severity: Major
      Found in src/platform/forms-system/src/js/utilities/data/reduceErrors.js - About 40 mins to fix

        Consider simplifying this complex logical expression.
        Open

          if (
            !value ||
            isNaN(value) ||
            isNaN(string) ||
            // ignore fractions
        Severity: Major
        Found in src/platform/forms-system/src/js/utilities/data/numberToWords.js - About 40 mins to fix

          Consider simplifying this complex logical expression.
          Open

                  if (
                    (uiSchema &&
                      schema?.properties &&
                      isMaxItemsReached &&
                      props.data[hasItemsKey] !== false) ||

            Consider simplifying this complex logical expression.
            Open

              if (errorEl) {
                // document.body.scrollTop doesn’t work with all browsers, so we’ll cover them all like so:
                const currentPosition =
                  window.pageYOffset ||
                  document.documentElement.scrollTop ||
            Severity: Major
            Found in src/platform/forms-system/src/js/utilities/ui/index.js - About 40 mins to fix

              Consider simplifying this complex logical expression.
              Open

                if (
                  sanitizedOperatingHours.search(/ByAppointmentOnly/i) === 0 ||
                  sanitizedOperatingHours.search(/AppointmentsOnly/i) === 0 ||
                  sanitizedOperatingHours.search(/PleaseCallforHours/i) === 0 ||
                  sanitizedOperatingHours.search(
              Severity: Major
              Found in src/applications/facility-locator/utils/helpers.jsx - About 40 mins to fix

                Consider simplifying this complex logical expression.
                Open

                  if (
                    (formattedOpeningHour.search(/Invalid date/i) !== 0 &&
                      formattedClosingHour.search(/Invalid date/i) !== 0) ||
                    (formattedOpeningHour.search(/Invalid date/i) !== 0 &&
                      formattedClosingHour.search(/Invalid date/i) === 0) ||
                Severity: Major
                Found in src/applications/facility-locator/utils/helpers.jsx - About 40 mins to fix
                  Severity
                  Category
                  Status
                  Source
                  Language