department-of-veterans-affairs/vets-website

View on GitHub
src/applications/personalization/profile/components/military-information/MilitaryInformation.jsx

Summary

Maintainability
D
2 days
Test Coverage

Function NotInDEERSAlert has 41 lines of code (exceeds 25 allowed). Consider refactoring.
Open

const NotInDEERSAlert = () => {
  return (
    <>
      <va-alert
        status="warning"

    Function NoServiceHistoryAlert has 36 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    const NoServiceHistoryAlert = () => {
      return (
        <>
          <va-alert status="warning" uswds class="vads-u-margin-bottom--4">
            <h2 slot="headline">

      Function MilitaryInformationContent has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

      const MilitaryInformationContent = ({ militaryInformation, veteranStatus }) => {
        useEffect(() => {
          focusElement('[data-focus-target]');
        }, []);
      
      

      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

      Avoid too many return statements within this function.
      Open

        return (
          <>
            <ProfileInfoCard
              data={serviceHistory.map(item =>
                transformServiceHistoryEntryIntoTableRow(item),

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

              <va-alert status="warning" uswds class="vads-u-margin-bottom--4">
                <h2 slot="headline">
                  We can’t match your information to any military service records
                </h2>
                <div>
        src/applications/personalization/profile/components/military-information/MilitaryInformation.jsx on lines 49..85

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

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

              <va-alert
                status="warning"
                data-testid="not-in-deers-alert"
                uswds
                class="vads-u-margin-bottom--4"
        src/applications/personalization/profile/components/military-information/MilitaryInformation.jsx on lines 93..124

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

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

                <p>
                  If you think this is an error, call us at{' '}
                  <va-telephone contact={CONTACTS.HELP_DESK} /> (
                  <va-telephone contact={CONTACTS['711']} tty />
                  ). We’re here Monday through Friday, 8:00 a.m. to 8:00 p.m. ET.
        src/applications/_mock-form-ae-design-patterns/patterns/pattern1/TaskPurple/GetFormHelp.jsx on lines 7..12
        src/applications/appeals/996/content/contestableIssues.jsx on lines 135..141
        src/applications/appeals/testing/hlr/content/contestableIssues.jsx on lines 57..63
        src/applications/mhv-secure-messaging/containers/EditContactList.jsx on lines 226..231
        src/applications/personalization/profile/components/military-information/MilitaryInformation.jsx on lines 190..196
        src/applications/personalization/profile/components/personal-health-care-contacts/NonVAPatientMessage.jsx on lines 11..16

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

                  <p>
                    You can call the DMDC at{' '}
                    <va-telephone contact={CONTACTS.DS_LOGON} /> (
                    <va-telephone contact={CONTACTS['711']} tty />
                    ). They’re available Monday through Friday (except federal
        src/applications/_mock-form-ae-design-patterns/patterns/pattern1/TaskPurple/GetFormHelp.jsx on lines 7..12
        src/applications/appeals/996/content/contestableIssues.jsx on lines 135..141
        src/applications/appeals/testing/hlr/content/contestableIssues.jsx on lines 57..63
        src/applications/mhv-secure-messaging/containers/EditContactList.jsx on lines 226..231
        src/applications/personalization/profile/components/military-information/MilitaryInformation.jsx on lines 34..39
        src/applications/personalization/profile/components/personal-health-care-contacts/NonVAPatientMessage.jsx on lines 11..16

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

          veteranStatus: PropTypes.shape({
            isVeteran: PropTypes.bool,
            status: PropTypes.string,
            servedInMilitary: PropTypes.bool,
          }).isRequired,
        src/applications/personalization/profile/components/direct-deposit/AccountInfoView.jsx on lines 68..72
        src/applications/simple-forms/form-upload/containers/ConfirmationPage.jsx on lines 37..41

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

        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