department-of-veterans-affairs/vets-website

View on GitHub
src/applications/gi/components/profile/BenefitsForm.jsx

Summary

Maintainability
F
4 days
Test Coverage

Function renderYourMilitaryDetails has 180 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  const renderYourMilitaryDetails = () => {
    const chapter33Check = giBillChapter === '33a' || giBillChapter === '33b';
    /*
      ***toggleCumulativeDropDown***
      Hide Cumulative Post 9/11 active-duty service drop down if applicant selects 'Fry Scholarship'
Severity: Major
Found in src/applications/gi/components/profile/BenefitsForm.jsx - About 7 hrs to fix

    File BenefitsForm.jsx has 318 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    import React, { useState } from 'react';
    import PropTypes from 'prop-types';
    import EbenefitsLink from 'platform/site-wide/ebenefits/containers/EbenefitsLink';
    import {
      ariaLabels,
    Severity: Minor
    Found in src/applications/gi/components/profile/BenefitsForm.jsx - About 3 hrs to fix

      Function BenefitsForm has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
      Open

      const BenefitsForm = ({
        children,
        cumulativeService,
        eligForPostGiBill,
        eligibilityChange,
      Severity: Minor
      Found in src/applications/gi/components/profile/BenefitsForm.jsx - About 1 hr to fix

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

        const preEligibilityChange = (e, name, number) => {
          const field = e.target.name;
          const { value } = e.target;
      
          if (field === 'giBillChapter' && value === '33a') {
      Severity: Minor
      Found in src/applications/gi/components/profile/BenefitsForm.jsx - About 1 hr to fix

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

        BenefitsForm.propTypes = {
          children: PropTypes.node,
          cumulativeService: PropTypes.string,
          eligForPostGiBill: PropTypes.string,
          eligibilityChange: PropTypes.func,
        Severity: Major
        Found in src/applications/gi/components/profile/BenefitsForm.jsx and 2 other locations - About 5 hrs to fix
        src/applications/gi/components/SearchBenefits.jsx on lines 328..344
        src/applications/mhv-secure-messaging/components/ComposeForm/ReplyDraftItem.jsx on lines 562..578

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

        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

          const cumulativeServiceOptions = () => [
            { optionValue: '1.0', optionLabel: '36+ months: 100%' }, // notice not 1.00
            { optionValue: '0.9', optionLabel: '30 months: 90%' },
            { optionValue: '0.8', optionLabel: '24 months: 80%' },
            { optionValue: '0.7', optionLabel: '18 months: 70%' },
        Severity: Major
        Found in src/applications/gi/components/profile/BenefitsForm.jsx and 1 other location - About 3 hrs to fix
        src/applications/gi/components/SearchBenefits.jsx on lines 248..263

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

        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

                      {militaryStatus === SPOUSE && (
                        <>
                          <Dropdown
                            label="Is your spouse currently on active duty?"
                            name="spouseActiveDuty"
        Severity: Major
        Found in src/applications/gi/components/profile/BenefitsForm.jsx and 1 other location - About 2 hrs to fix
        src/applications/gi/components/profile/BenefitsForm.jsx on lines 196..212

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

        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

                      {giBillChapter === '33b' && (
                        <>
                          <Dropdown
                            label="Are you currently an active duty service member?"
                            name="areYouActiveDuty"
        Severity: Major
        Found in src/applications/gi/components/profile/BenefitsForm.jsx and 1 other location - About 2 hrs to fix
        src/applications/gi/components/profile/BenefitsForm.jsx on lines 178..194

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

        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

                  {militaryStatus === 'active duty' &&
                    chapter33Check && (
                      <div className="military-status-info warning form-group">
                        <va-icon icon="warning" />
                        <a
        Severity: Major
        Found in src/applications/gi/components/profile/BenefitsForm.jsx and 1 other location - About 2 hrs to fix
        src/applications/gi/components/SearchBenefits.jsx on lines 204..221

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

        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

                  options={[
                    { optionValue: '33a', optionLabel: 'Post-9/11 GI Bill (Ch 33)' },
                    { optionValue: '33b', optionLabel: 'Fry Scholarship (Ch 33)' },
                    { optionValue: '30', optionLabel: 'Montgomery GI Bill (Ch 30)' },
                    {
        Severity: Major
        Found in src/applications/gi/components/profile/BenefitsForm.jsx and 2 other locations - About 2 hrs to fix
        src/applications/gi/components/SearchBenefits.jsx on lines 311..318
        src/applications/gi/components/profile/BenefitsForm.jsx on lines 294..301

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

        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

                    options={[
                      { optionValue: '0', optionLabel: '0 Dependents' },
                      { optionValue: '1', optionLabel: '1 Dependent' },
                      { optionValue: '2', optionLabel: '2 Dependents' },
                      { optionValue: '3', optionLabel: '3 Dependents' },
        Severity: Major
        Found in src/applications/gi/components/profile/BenefitsForm.jsx and 2 other locations - About 2 hrs to fix
        src/applications/gi/components/SearchBenefits.jsx on lines 311..318
        src/applications/gi/components/profile/BenefitsForm.jsx on lines 141..158

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

        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 BenefitsForm = ({
          children,
          cumulativeService,
          eligForPostGiBill,
          eligibilityChange,
        Severity: Major
        Found in src/applications/gi/components/profile/BenefitsForm.jsx and 1 other location - About 1 hr to fix
        src/applications/ivc-champva/shared/components/applicantLists/ApplicantAddressPage.jsx on lines 9..221

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

        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