department-of-veterans-affairs/vets-website

View on GitHub
src/applications/edu-benefits/components/EducationWizard.jsx

Summary

Maintainability
F
4 days
Test Coverage

Function render has 309 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  render() {
    const {
      newBenefit,
      serviceBenefitBasedOn,
      transferredEduBenefits,
Severity: Major
Found in src/applications/edu-benefits/components/EducationWizard.jsx - About 1 day to fix

    File EducationWizard.jsx has 457 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    // disabled for unit testing to work
    /* eslint-disable no-restricted-syntax */
    /* eslint-disable guard-for-in */
    
    import React from 'react';
    Severity: Minor
    Found in src/applications/edu-benefits/components/EducationWizard.jsx - About 7 hrs to fix

      Function getButton has 35 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        getButton(form) {
          let url = '';
          switch (form) {
            case '0994':
              url = `/education/about-gi-bill-benefits/how-to-use-benefits/vettec-high-tech-program/apply-for-vettec-form-22-0994`;
      Severity: Minor
      Found in src/applications/edu-benefits/components/EducationWizard.jsx - About 1 hr to fix

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

          render() {
            const {
              newBenefit,
              serviceBenefitBasedOn,
              transferredEduBenefits,
        Severity: Minor
        Found in src/applications/edu-benefits/components/EducationWizard.jsx - About 45 mins 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

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

                <button
                  id="findFormButton"
                  aria-expanded={this.state.open ? 'true' : 'false'}
                  aria-controls="wizardOptions"
                  className={buttonClasses}
        Severity: Major
        Found in src/applications/edu-benefits/components/EducationWizard.jsx and 1 other location - About 2 hrs to fix
        src/applications/static-pages/wizard/index.js on lines 131..139

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

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

                    {newBenefit === 'yes' && (
                      <VARadioButton
                        radioLabel="Are you a Veteran or service member claiming a benefit based on your own service?"
                        name="serviceBenefitBasedOn"
                        initialValue={serviceBenefitBasedOn}
        src/applications/edu-benefits/components/EducationWizard.jsx on lines 265..275
        src/applications/edu-benefits/components/EducationWizard.jsx on lines 288..298
        src/applications/edu-benefits/components/EducationWizard.jsx on lines 299..309

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

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

                    {newBenefit === 'no' && (
                      <VARadioButton
                        radioLabel="Are you receiving education benefits transferred to you by a sponsor Veteran?"
                        name="transferredEduBenefits"
                        initialValue={transferredEduBenefits}
        src/applications/edu-benefits/components/EducationWizard.jsx on lines 254..264
        src/applications/edu-benefits/components/EducationWizard.jsx on lines 288..298
        src/applications/edu-benefits/components/EducationWizard.jsx on lines 299..309

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

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

                    {serviceBenefitBasedOn === 'other' && (
                      <VARadioButton
                        radioLabel="Has your sponsor transferred their benefits to you?"
                        name="sponsorTransferredBenefits"
                        initialValue={sponsorTransferredBenefits}
        src/applications/edu-benefits/components/EducationWizard.jsx on lines 254..264
        src/applications/edu-benefits/components/EducationWizard.jsx on lines 265..275
        src/applications/edu-benefits/components/EducationWizard.jsx on lines 299..309

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

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

                    {sponsorTransferredBenefits === 'no' && (
                      <VARadioButton
                        radioLabel="Is your sponsor deceased, 100% permanently disabled, MIA, or a POW?"
                        name="sponsorDeceasedDisabledMIA"
                        initialValue={sponsorDeceasedDisabledMIA}
        src/applications/edu-benefits/components/EducationWizard.jsx on lines 254..264
        src/applications/edu-benefits/components/EducationWizard.jsx on lines 265..275
        src/applications/edu-benefits/components/EducationWizard.jsx on lines 288..298

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

        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

                          <div className="usa-alert-body">
                            <h4>
                              Your application can't be approved until your sponsor
                              transfers their benefits.
                            </h4>
        src/applications/my-education-benefits/components/confirmation/ConfirmationApproved.jsx on lines 116..130

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

        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

                                  <a
                                    aria-label="See eligible degree and clinical training programs, opening in new tab"
                                    href="https://www.va.gov/resources/approved-fields-of-study-for-the-stem-scholarship/"
                                    rel="noopener noreferrer"
                                    target="_blank"
        src/applications/edu-benefits/components/EducationWizard.jsx on lines 407..420

        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

                              <a
                                className="checkBenefitsLink"
                                href="/education/gi-bill/post-9-11/ch-33-benefit/"
                                rel="noopener noreferrer"
                                target="_blank"
        src/applications/edu-benefits/components/EducationWizard.jsx on lines 386..399

        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

            const {
              newBenefit,
              serviceBenefitBasedOn,
              transferredEduBenefits,
              sponsorDeceasedDisabledMIA,
        Severity: Major
        Found in src/applications/edu-benefits/components/EducationWizard.jsx and 2 other locations - About 50 mins to fix
        src/platform/site-wide/mega-menu/components/MenuSection.jsx on lines 42..51
        src/platform/user/profile/vap-svc/containers/AddressValidationModal.jsx on lines 226..235

        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

          eduFormChange = input => {
            const formChangeMap = {
              yes: 'new',
              no: 'update',
              extend: 'stem-scholarship',
        Severity: Minor
        Found in src/applications/edu-benefits/components/EducationWizard.jsx and 1 other location - About 30 mins to fix
        src/applications/edu-benefits/components/EducationWizard.jsx on lines 127..134

        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

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

          isReceivingSponsorBenefits = input => {
            const formChangeMap = {
              own: 'no',
              transferred: 'yes',
              fry: 'no with scholarship',
        Severity: Minor
        Found in src/applications/edu-benefits/components/EducationWizard.jsx and 1 other location - About 30 mins to fix
        src/applications/edu-benefits/components/EducationWizard.jsx on lines 118..125

        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