department-of-veterans-affairs/vets-website

View on GitHub
src/applications/ivc-champva/shared/components/applicantLists/ApplicantRelationshipPage.jsx

Summary

Maintainability
C
1 day
Test Coverage

File ApplicantRelationshipPage.jsx has 305 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import React, { useState, useEffect } from 'react';
import {
  VaButton,
  VaRadio,
  VaTextInput,

    Function ApplicantRelationshipPage has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
    Open

    export default function ApplicantRelationshipPage({
      data,
      genOp,
      setFormData,
      goBack,

    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 ApplicantRelationshipReviewPage has 50 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    export function ApplicantRelationshipReviewPage(props) {
      const { data, keyname = KEYNAME, primary = PRIMARY, secondary = SECONDARY } =
        props || {};
      const genOps = props.genOp || generateOptions;
      const {

      Function ApplicantRelationshipReviewPage has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

      export function ApplicantRelationshipReviewPage(props) {
        const { data, keyname = KEYNAME, primary = PRIMARY, secondary = SECONDARY } =
          props || {};
        const genOps = props.genOp || generateOptions;
        const {

      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

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

      ApplicantRelationshipReviewPage.propTypes = {
        data: PropTypes.object,
        editPage: PropTypes.func,
        genOp: PropTypes.func,
        keyname: PropTypes.string,
      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/SubTopicSelectPage.jsx on lines 115..121
      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/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

        const {
          keyname,
          currentListItem,
          personTitle,
          applicant,
      src/applications/vaos/appointment-list/components/ConfirmedAppointmentDetailsPage/CalendarLink.jsx on lines 17..27

      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

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

        const {
          currentListItem,
          options,
          customOtherDescription,
          description,
      src/applications/static-pages/cta-widget/index.js on lines 536..544

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

      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