department-of-veterans-affairs/vets-website

View on GitHub
src/applications/ezr/components/FormFields/DependentList.jsx

Summary

Maintainability
F
6 days
Test Coverage

Function listItems has 63 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  const listItems = dependents.map((item, index) => {
    const { fullName, dependentRelation } = item;
    const dependentName = normalizeFullName(fullName);
    const modalDescription = replaceStrValues(
      content['household-dependent-modal-remove-description'],
Severity: Major
Found in src/applications/ezr/components/FormFields/DependentList.jsx - About 2 hrs to fix

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

    const DependentList = ({ labelledBy, list, mode, onDelete }) => {
      const scrollIdPrefix = 'ezr-dependent-item';
      const scrollId = `${scrollIdPrefix}--${window.sessionStorage.getItem(
        SESSION_ITEMS.dependent,
      )}`;
    Severity: Major
    Found in src/applications/ezr/components/FormFields/DependentList.jsx and 1 other location - About 6 days to fix
    src/applications/_mock-form-ae-design-patterns/patterns/pattern1/ezr/components/DependentList.jsx on lines 26..183

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 1041.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 70 locations. Consider refactoring.
    Open

    DependentList.propTypes = {
      labelledBy: PropTypes.string,
      list: PropTypes.array,
      mode: PropTypes.string,
      onDelete: PropTypes.func,
    Severity: Major
    Found in src/applications/ezr/components/FormFields/DependentList.jsx and 69 other locations - About 40 mins to fix
    src/applications/_mock-form-ae-design-patterns/patterns/pattern1/ezr/components/DependentList.jsx on lines 185..190
    src/applications/_mock-form-ae-design-patterns/patterns/pattern1/ezr/components/InsurancePolicyList.jsx on lines 172..177
    src/applications/accredited-representative-portal/containers/SignedInLayout.jsx on lines 44..49
    src/applications/appeals/testing/nod-new/components/EditContactInfo.jsx on lines 38..43
    src/applications/ask-va/components/CustomYourQuestionReviewField.jsx on lines 76..81
    src/applications/ask-va/components/FormFields/CategorySelect.jsx on lines 100..105
    src/applications/ask-va/components/FormFields/CountrySelect.jsx on lines 32..37
    src/applications/ask-va/components/PageFieldSummary.jsx on lines 62..67
    src/applications/ask-va/containers/CategorySelectPage.jsx on lines 126..131
    src/applications/avs/components/ParagraphBlock.jsx on lines 38..43
    src/applications/caregivers/components/FormPages/FacilityConfirmation.jsx on lines 81..86
    src/applications/claims-status/components/IndexLink.jsx on lines 25..30
    src/applications/claims-status/containers/ClaimsStatusApp.jsx on lines 100..105
    src/applications/claims-status/containers/StemClaimStatusPage.jsx on lines 105..110
    src/applications/combined-debt-portal/combined/components/BalanceCard.jsx on lines 55..60
    src/applications/combined-debt-portal/debt-letters/components/DebtDetailsOnThisPageLinks.jsx on lines 120..125
    src/applications/combined-debt-portal/debt-letters/components/OnThisPageLinks.jsx on lines 106..111
    src/applications/disability-benefits/all-claims/components/ComboBox.jsx on lines 433..438
    src/applications/edu-benefits/10203/containers/IntroductionPage.jsx on lines 252..257
    src/applications/ezr/components/FormFields/InsurancePolicyList.jsx on lines 172..177
    src/applications/ezr/components/FormPages/FinancialStatusConfirmation.jsx on lines 42..47
    src/applications/facility-locator/components/search-results-items/common/LocationPhoneLink.jsx on lines 92..97
    src/applications/financial-status-report/components/contactInfo/EditContactInfo.jsx on lines 66..71
    src/applications/financial-status-report/components/householdIncome/SpouseTransitionExplainer.jsx on lines 26..31
    src/applications/financial-status-report/components/shared/PreSubmitSignature.jsx on lines 261..266
    src/applications/financial-status-report/components/shared/StreamlinedExplainer.jsx on lines 24..29
    src/applications/gi/components/VaAccordionGi.jsx on lines 27..32
    src/applications/hca/components/FormFields/DependentList.jsx on lines 175..180
    src/applications/hca/components/FormPages/FinancialInformation.jsx on lines 71..76
    src/applications/hca/components/FormPages/FinancialOnboarding.jsx on lines 73..78
    src/applications/hca/components/FormPages/InsuranceInformation.jsx on lines 63..68
    src/applications/hca/components/IdentityPage/VerificationForm.jsx on lines 62..67
    src/applications/ivc-champva/shared/components/maskSSN.jsx on lines 67..72
    src/applications/mhv-landing-page/components/HeaderLayout.jsx on lines 168..173
    src/applications/mhv-landing-page/components/alerts/AlertMhvBasicAccount.jsx on lines 102..107
    src/applications/mhv-landing-page/components/alerts/AlertMhvRegistration.jsx on lines 64..69
    src/applications/mhv-medical-records/components/RecordList/RecordList.jsx on lines 120..125
    src/applications/mhv-medical-records/components/shared/NewRecordsIndicator.jsx on lines 172..177
    src/applications/mhv-medical-records/components/shared/PrintDownload.jsx on lines 135..140
    src/applications/mhv-medications/components/shared/AllergiesErrorModal.jsx on lines 45..50
    src/applications/mhv-medications/components/shared/TrackingInfo.jsx on lines 88..93
    src/applications/mhv-secure-messaging/components/ComposeForm/FileInput.jsx on lines 185..190
    src/applications/mhv-secure-messaging/components/MessageActionButtons/TrashButton.jsx on lines 93..98
    src/applications/mhv-secure-messaging/components/MessageThread/MessageThreadBody.jsx on lines 31..36
    src/applications/mhv-secure-messaging/components/Modals/DeleteMessageModal.jsx on lines 31..36
    src/applications/mhv-secure-messaging/components/SectionGuideButton.jsx on lines 32..37
    src/applications/mhv-secure-messaging/components/shared/AlertBackgroundBox.jsx on lines 179..184
    src/applications/personalization/common/components/devtools/DevToolsLoader.jsx on lines 131..136
    src/applications/personalization/dashboard/components/Dashboard.jsx on lines 178..183
    src/applications/personalization/dashboard/components/benefit-application-drafts/ApplicationsInProgress.jsx on lines 208..213
    src/applications/personalization/dashboard/components/benefit-application-drafts/BenefitApplications.jsx on lines 72..77
    src/applications/personalization/profile/components/direct-deposit/vye/components/AlertModal.jsx on lines 30..35
    src/applications/representative-appoint/components/ClaimantTypeForm.jsx on lines 33..38
    src/applications/resources-and-support/components/SearchBar.jsx on lines 235..240
    src/applications/static-pages/events/components/Results/ResultsWhereContent.jsx on lines 98..103
    src/applications/vaos/new-appointment/components/ReviewPage/ReviewRequestInfo/ReviewDirectScheduleInfo/ReviewDirectScheduleInfo.jsx on lines 40..45
    src/applications/vaos/new-appointment/components/VAFacilityPage/FacilitiesNotShown.jsx on lines 110..115
    src/applications/verify-your-enrollment/components/Alert.jsx on lines 24..29
    src/applications/verify-your-enrollment/components/AlertModal.jsx on lines 29..34
    src/applications/verify-your-enrollment/components/EnrollmentStatus.jsx on lines 28..33
    src/platform/forms-system/src/js/review/submit-states/ClientError.jsx on lines 65..70
    src/platform/forms-system/src/js/review/submit-states/Default.jsx on lines 39..44
    src/platform/forms-system/src/js/review/submit-states/GenericError.jsx on lines 67..72
    src/platform/mhv/downtime/components/MHVDown.jsx on lines 44..49
    src/platform/mhv/downtime/components/MHVDowntimeApproaching.jsx on lines 34..39
    src/platform/user/authentication/components/CreateAccountLink.jsx on lines 56..61
    src/platform/user/authentication/components/VerifyAccountLink.jsx on lines 45..50
    src/applications/check-in/components/BackButton.jsx on lines 59..64
    src/applications/static-pages/facilities/FacilityMapWidgetDynamic.jsx on lines 124..129

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 48.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    There are no issues that match your filters.

    Category
    Status