department-of-veterans-affairs/vets-website

View on GitHub
src/applications/ask-va/containers/SubTopicSelectPage.jsx

Summary

Maintainability
C
1 day
Test Coverage

Function SubTopicSelectPage has 86 lines of code (exceeds 25 allowed). Consider refactoring.
Open

const SubTopicSelectPage = props => {
  const { onChange, loggedIn, goBack, goToPath, formData, topicID } = props;

  const [apiData, setApiData] = useState([]);
  const [loading, isLoading] = useState(false);
Severity: Major
Found in src/applications/ask-va/containers/SubTopicSelectPage.jsx - About 3 hrs to fix

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

            <VaRadio
              onVaValueChange={handleChange}
              className="vads-u-margin-top--neg3"
              label={CHAPTER_1.PAGE_3.QUESTION_1}
              label-header-level={CHAPTER_1.PAGE_3.QUESTION_1}
    Severity: Major
    Found in src/applications/ask-va/containers/SubTopicSelectPage.jsx and 1 other location - About 3 hrs to fix
    src/applications/ask-va/containers/TopicSelectPage.jsx on lines 110..131

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

    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

    Identical blocks of code found in 6 locations. Consider refactoring.
    Open

      const getApiData = url => {
        isLoading(true);
        return apiRequest(url)
          .then(res => {
            setApiData(res.data);
    Severity: Major
    Found in src/applications/ask-va/containers/SubTopicSelectPage.jsx and 5 other locations - About 2 hrs to fix
    src/applications/ask-va/components/FormFields/CategorySelect.jsx on lines 41..52
    src/applications/ask-va/components/FormFields/SubtopicSelect.jsx on lines 27..38
    src/applications/ask-va/components/FormFields/TopicSelect.jsx on lines 42..53
    src/applications/ask-va/containers/CategorySelectPage.jsx on lines 52..63
    src/applications/ask-va/containers/TopicSelectPage.jsx on lines 69..80

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

    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 50 locations. Consider refactoring.
    Open

    SubTopicSelectPage.propTypes = {
      loggedIn: PropTypes.bool,
      id: PropTypes.string,
      value: PropTypes.string,
      onChange: PropTypes.func,
    Severity: Major
    Found in src/applications/ask-va/containers/SubTopicSelectPage.jsx and 49 other locations - About 1 hr to fix
    src/applications/ask-va/components/FormFields/SubtopicSelect.jsx on lines 103..109
    src/applications/ask-va/components/FormFields/TopicSelect.jsx on lines 118..124
    src/applications/ask-va/components/YourPersonalInformationAuthenticated.jsx on lines 80..86
    src/applications/ask-va/containers/TopicSelectPage.jsx on lines 147..153
    src/applications/caregivers/components/FormFields/FacilitySearch.jsx on lines 302..308
    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 226..232
    src/applications/ezr/components/PreSubmitNotice/index.jsx on lines 54..60
    src/applications/facility-locator/components/SearchResultMessage.jsx on lines 61..67
    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/gi/components/vet-tec/VetTecEstimateYourBenefitsForm.jsx on lines 236..242
    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-medications/components/shared/PrintDownload.jsx on lines 207..213
    src/applications/mhv-secure-messaging/components/ComposeForm/ElectronicSignature.jsx on lines 49..55
    src/applications/mhv-secure-messaging/components/FacilityCheckboxGroup.jsx on lines 75..81
    src/applications/mhv-secure-messaging/components/MessageThread/MessageThreadItem.jsx on lines 156..162
    src/applications/mhv-secure-messaging/components/Modals/RemoveAttachmentModal.jsx on lines 66..72
    src/applications/mhv-secure-messaging/components/Search/SearchForm.jsx on lines 346..352
    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/containers/App.jsx on lines 68..74
    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/components/VAOSApp/DowntimeMessage.jsx on lines 95..101
    src/applications/vaos/new-appointment/components/VAFacilityPage/FacilitiesRadioWidget.jsx on lines 197..203
    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 300..306
    src/platform/forms-system/src/js/components/EditContactInfo.jsx on lines 90..96
    src/platform/forms-system/src/js/review/submit-states/ThrottledError.jsx on lines 58..64
    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 30..36
    src/platform/site-wide/loading-button/LoadingButton.jsx on lines 35..41
    src/applications/vaos/appointment-list/components/PageLayout.jsx on lines 40..46
    src/applications/vaos/components/AddToCalendar.jsx on lines 76..82

    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

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

    function mapStateToProps(state) {
      return {
        loggedIn: isLoggedIn(state),
        formData: state.form.data,
        topicID: state.askVA.topicID,
    Severity: Minor
    Found in src/applications/ask-va/containers/SubTopicSelectPage.jsx and 1 other location - About 40 mins to fix
    src/applications/ask-va/containers/TopicSelectPage.jsx on lines 155..161

    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