department-of-veterans-affairs/vets-website

View on GitHub
src/applications/check-in/components/layout/ReloadWrapper.jsx

Summary

Maintainability
B
5 hrs
Test Coverage

Function ReloadWrapper has 106 lines of code (exceeds 25 allowed). Consider refactoring.
Open

const ReloadWrapper = props => {
  const { children, router, app, reloadUpcoming = false } = props;
  const location = window.location.pathname;
  const { t } = useTranslation();
  const dispatch = useDispatch();
Severity: Major
Found in src/applications/check-in/components/layout/ReloadWrapper.jsx - About 4 hrs to fix

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

    ReloadWrapper.propTypes = {
      app: PropTypes.string.isRequired,
      children: PropTypes.node,
      reloadUpcoming: PropTypes.bool,
      router: PropTypes.object,
    Severity: Major
    Found in src/applications/check-in/components/layout/ReloadWrapper.jsx and 22 other locations - About 50 mins to fix
    src/applications/claims-status/components/ClaimCard/ClaimCard.jsx on lines 23..28
    src/applications/claims-status/components/ClaimPhase.jsx on lines 20..25
    src/applications/discharge-wizard/components/questions/BranchOfService.jsx on lines 68..73
    src/applications/discharge-wizard/components/questions/CourtMartial.jsx on lines 78..83
    src/applications/discharge-wizard/components/questions/DischargeMonth.jsx on lines 64..69
    src/applications/discharge-wizard/components/questions/DischargeType.jsx on lines 66..71
    src/applications/discharge-wizard/components/questions/DischargeYear.jsx on lines 69..74
    src/applications/discharge-wizard/components/questions/FailureToExhaust.jsx on lines 77..82
    src/applications/discharge-wizard/components/questions/Intention.jsx on lines 67..72
    src/applications/discharge-wizard/components/questions/PrevApplication.jsx on lines 69..74
    src/applications/discharge-wizard/components/questions/PrevApplicationType.jsx on lines 83..88
    src/applications/discharge-wizard/components/questions/PrevApplicationYear.jsx on lines 73..78
    src/applications/discharge-wizard/components/questions/PriorService.jsx on lines 83..88
    src/applications/discharge-wizard/components/questions/Reason.jsx on lines 71..76
    src/applications/find-forms/components/SearchResult.jsx on lines 220..225
    src/applications/mhv-medications/components/PrescriptionDetails/PrescriptionPrintOnly.jsx on lines 264..269
    src/applications/personalization/dashboard/components/notifications/Notifications.jsx on lines 96..101
    src/applications/static-pages/cta-widget/components/messages/DirectDeposit/Unauthed.jsx on lines 36..41
    src/applications/static-pages/mhv-signin-cta/components/messages/UnverifiedAlert.jsx on lines 148..153
    src/applications/vaos/new-appointment/components/ReviewPage/ReviewRequestInfo/index.jsx on lines 38..43
    src/applications/vaos/new-appointment/components/VAFacilityPage/EligibilityModal.jsx on lines 39..44
    src/platform/user/authentication/components/SessionTimeoutModal.jsx on lines 155..160

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

    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