department-of-veterans-affairs/vets-website

View on GitHub
src/platform/site-wide/loading-button/LoadingButton.jsx

Summary

Maintainability
A
1 hr
Test Coverage

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

LoadingButton.propTypes = {
  children: PropTypes.any,
  disabled: PropTypes.bool,
  isLoading: PropTypes.bool,
  loadingText: PropTypes.string,
Severity: Major
Found in src/platform/site-wide/loading-button/LoadingButton.jsx and 50 other locations - About 1 hr to fix
src/applications/_mock-form-ae-design-patterns/patterns/pattern2/TaskGray/form/components/VeteranProfileInformation.jsx on lines 40..46
src/applications/_mock-form-ae-design-patterns/patterns/pattern2/TaskGray/status/components/DocumentList/ListItem.jsx on lines 24..30
src/applications/_mock-form-ae-design-patterns/patterns/pattern2/TaskOrange/pages/ApplicantInformation.jsx on lines 158..164
src/applications/_mock-form-ae-design-patterns/shared/components/InfoSection.jsx on lines 102..108
src/applications/ask-va/components/YourPersonalInformationAuthenticated.jsx on lines 80..86
src/applications/ask-va/containers/SubTopicSelectPage.jsx on lines 131..137
src/applications/ask-va/containers/TopicSelectPage.jsx on lines 147..153
src/applications/caregivers/components/FormFields/FacilitySearch.jsx on lines 311..317
src/applications/caregivers/components/FormFields/VaMedicalCenter.jsx on lines 126..132
src/applications/claims-status/components/claim-status-tab/WhatWeAreDoing.jsx on lines 86..92
src/applications/combined-debt-portal/medical-copays/components/BalanceCard.jsx on lines 103..109
src/applications/disability-benefits/view-payments/components/view-payments-lists/ViewPaymentsLists.jsx on lines 228..234
src/applications/ezr/components/PreSubmitNotice/index.jsx on lines 54..60
src/applications/facility-locator/containers/FacilityDetail.jsx on lines 158..164
src/applications/financial-status-report/components/household/DependentAges.jsx on lines 230..236
src/applications/financial-status-report/components/resolution/ResolutionOptions.jsx on lines 163..169
src/applications/gi/containers/search/FilterByLocation.jsx on lines 144..150
src/applications/hca/components/FormFields/DemographicViewField.jsx on lines 36..42
src/applications/hca/components/FormPages/DependentInformation.jsx on lines 217..223
src/applications/hca/components/FormPages/VeteranInformation.jsx on lines 39..45
src/applications/hca/components/PreSubmitNotice/index.jsx on lines 120..126
src/applications/ivc-champva/10-10D/pages/SupportingDocumentsPage.jsx on lines 27..33
src/applications/ivc-champva/10-7959C/components/SupportingDocumentsPage.jsx on lines 32..38
src/applications/ivc-champva/shared/components/applicantLists/ApplicantRelationshipPage.jsx on lines 310..316
src/applications/lgy/coe/status/components/DocumentList/ListItem.jsx on lines 24..30
src/applications/mhv-medical-records/components/shared/DateSubheading.jsx on lines 26..32
src/applications/mhv-secure-messaging/components/FacilityCheckboxGroup.jsx on lines 76..82
src/applications/mhv-secure-messaging/components/MessageThread/MessageThreadItem.jsx on lines 166..172
src/applications/mhv-secure-messaging/components/Modals/RemoveAttachmentModal.jsx on lines 74..80
src/applications/mhv-secure-messaging/components/Search/SearchForm.jsx on lines 362..368
src/applications/my-education-benefits/components/DuplicateContactInfoModal.jsx on lines 101..107
src/applications/personalization/view-dependents/components/ViewDependentsList/ViewDependentsList.jsx on lines 73..79
src/applications/representative-appoint/components/ProfileNotUpdatedNote.jsx on lines 46..52
src/applications/representative-appoint/containers/App.jsx on lines 72..78
src/applications/survivor-dependent-education-benefit/22-5490/components/DuplicateContactInfoModal.jsx on lines 101..107
src/applications/toe/components/DuplicateContactInfoModal.jsx on lines 101..107
src/applications/vaos/appointment-list/components/PageLayout.jsx on lines 40..46
src/applications/vaos/components/AddToCalendar.jsx on lines 76..82
src/applications/vaos/components/VAOSApp/DowntimeMessage.jsx on lines 95..101
src/applications/vaos/new-appointment/components/VAFacilityPage/FacilitiesRadioWidget.jsx on lines 199..205
src/applications/verify-your-enrollment/components/CurrentBenefitsStatus.jsx on lines 47..53
src/applications/verify-your-enrollment/components/PageLink.jsx on lines 29..35
src/applications/verify-your-enrollment/components/PeriodsToVerify.jsx on lines 113..119
src/applications/verify/components/verifyButton.jsx on lines 40..46
src/platform/forms-system/src/js/components/BackLink.jsx on lines 99..105
src/platform/forms-system/src/js/components/ContactInfoReview.jsx on lines 301..307
src/platform/forms-system/src/js/components/EditContactInfo.jsx on lines 91..97
src/platform/forms-system/src/js/review/submit-states/ThrottledError.jsx on lines 57..63
src/platform/forms-system/src/js/review/submit-states/ValidationError.jsx on lines 64..70
src/platform/forms/components/common/alerts/ErrorMessage.jsx on lines 42..48

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 57.

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