department-of-veterans-affairs/vets-website

View on GitHub

Showing 12,827 of 12,827 total issues

Function prefillTransformerV3 has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
Open

export function prefillTransformerV3(pages, formData, metadata, state) {
  const bankInformation = state.data?.bankInformation || {};
  const claimant = state.data?.formData?.data?.attributes?.claimant || {};
  const exclusionPeriods = Array.isArray(state.data?.exclusionPeriods)
    ? state.data?.exclusionPeriods
Severity: Minor
Found in src/applications/my-education-benefits/helpers.js - About 2 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 formatOperatingHours has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
Open

export const formatOperatingHours = operatingHours => {
  if (!operatingHours) return operatingHours;
  // Remove all whitespace and sanitize dashes.
  const sanitizedOperatingHours = operatingHours
    .replace(/ /g, '')
Severity: Minor
Found in src/applications/facility-locator/utils/helpers.jsx - About 2 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 displayConditionsMet has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
Open

export const displayConditionsMet = (SHORT_NAME, formResponses) => {
  const displayConditionsForShortName = DISPLAY_CONDITIONS[SHORT_NAME];
  const questionRequirements = Object.keys(displayConditionsForShortName);

  if (questionRequirements.includes('FORK')) {

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

export const getInitialFormValues = options => {
  const { fieldName, data, modalData } = options;

  if (fieldName === FIELD_NAMES.EMAIL) {
    return data ? { ...data } : { emailAddress: '' };

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

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

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

const AddOtherExpense = ({ data, goToPath, setFormData }) => {
  const { otherExpenses = [] } = data;

  // Borrowed from 995 AddIssue
  // get index from url '/add-issue?index={index}'

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

const SpousePayrollDeductionChecklist = props => {
  const { goToPath, goBack, setFormData } = props;

  const editIndex = getJobIndex();

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

const PayrollDeductionChecklist = props => {
  const { goToPath, goBack, setFormData } = props;

  const editIndex = getJobIndex();

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

const EditContactList = () => {
  const dispatch = useDispatch();
  const location = useLocation();
  const history = useHistory();
  const [allTriageTeams, setAllTriageTeams] = useState(null);
Severity: Minor
Found in src/applications/mhv-secure-messaging/containers/EditContactList.jsx - About 2 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 PrescriptionPrintOnly has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
Open

const PrescriptionPrintOnly = props => {
  const { rx, hideLineBreak, refillHistory, isDetailsRx } = props;
  const pharmacyPhone = pharmacyPhoneNumber(rx);

  const activeNonVaContent = pres => (

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

File address.js has 267 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import { createSelector } from 'reselect';
import {
  countries,
  states,
  isValidUSZipCode,
Severity: Minor
Found in src/platform/forms-system/src/js/definitions/address.js - About 2 hrs to fix

    File v2.js has 267 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    /* istanbul ignore file */
    import appendQuery from 'append-query';
    // eslint-disable-next-line import/no-unresolved
    import { apiRequest } from '@department-of-veterans-affairs/platform-utilities/exports';
    import environment from '@department-of-veterans-affairs/platform-utilities/environment';
    Severity: Minor
    Found in src/applications/check-in/api/versions/v2.js - About 2 hrs to fix

      Function debtsReducer has 60 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      export const debtsReducer = (state = debtInitialState, action) => {
        switch (action.type) {
          case DEBTS_FETCH_INITIATED:
            return {
              ...state,
      Severity: Major
      Found in src/applications/combined-debt-portal/combined/reducers/index.js - About 2 hrs to fix

        Function IntroductionProcessListV2 has 60 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        function IntroductionProcessListV2() {
          return (
            <va-process-list>
              <va-process-list-item header="Check your eligibility">
                <p>Make sure you meet our eligibility requirements before you apply.</p>

          Function createDirectDepositPageUpdate has 60 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          export default function createDirectDepositPageUpdate() {
            const bankAccountProperties = {
              type: 'object',
              properties: {
                accountType: {
          Severity: Major
          Found in src/applications/edu-benefits/5490/content/directDepositUpdate.jsx - About 2 hrs to fix

            Function createDirectDepositPage has 60 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            export default function createDirectDepositPage() {
              const bankAccountProperties = {
                type: 'object',
                properties: {
                  accountType: {
            Severity: Major
            Found in src/applications/edu-benefits/1990/pages/DirectDeposit.jsx - About 2 hrs to fix

              Function geocodeUserAddress has 60 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              export const geocodeUserAddress = query => {
                // Prevent empty search request to Mapbox, which would result in error.
                if (!query.locationInputString) {
                  return {
                    type: GEOCODE_FAILED,

                Function Declined has 60 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                export default function Declined() {
                  const shouldRedirectToMobile =
                    sessionStorage.getItem(COOKIES.CI) === CLIENT_IDS.VAMOBILE;
                  const dispatch = useDispatch();
                  const openSignInModal = useCallback(
                Severity: Major
                Found in src/applications/terms-of-use/components/Declined.jsx - About 2 hrs to fix

                  Function useTravelPayFlags has 60 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  const useTravelPayFlags = appointment => {
                    const [travelPayClaimSent, setTravelPayClaimSent] = useState();
                    const selectCurrentContext = useMemo(makeSelectCurrentContext, []);
                    const context = useSelector(selectCurrentContext);
                    const { token } = context;
                  Severity: Major
                  Found in src/applications/check-in/hooks/useTravelPayFlags.jsx - About 2 hrs to fix

                    Function transform5490Form has 60 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                    export function transform5490Form(_formConfig, form) {
                      const formFieldUserFullName = form?.data?.fullName;
                      const viewComponentUserFullName = form?.loadedData?.formData?.fullName;
                      // const formFieldDateOfBirth = form?.data?.dateOfBirth;
                      // const viewComponentDateOfBirth = form?.loadedData?.formData.dateOfBirth;
                      Severity
                      Category
                      Status
                      Source
                      Language