department-of-veterans-affairs/vets-website

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

Summary

Maintainability
F
2 wks
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 470 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 46 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

        Function getButton has a Cognitive Complexity of 7 (exceeds 5 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 35 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

          render() {
            const {
              newBenefit,
              serviceBenefitBasedOn,
              transferredEduBenefits,
        src/applications/_mock-form-ae-design-patterns/patterns/pattern2/TaskOrange/components/EducationWizard.jsx on lines 163..482

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

        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

          constructor(props) {
            super(props);
        
            // props passed for unit testing
            const { test, testLevels } = this.props;
        Severity: Major
        Found in src/applications/edu-benefits/components/EducationWizard.jsx and 1 other location - About 7 hrs to fix
        src/applications/_mock-form-ae-design-patterns/patterns/pattern2/TaskOrange/components/EducationWizard.jsx on lines 30..52

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

        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

          answerQuestion = (field, answer) => {
            const newState = { [field]: answer };
            if (field === 'newBenefit') {
              recordEvent({
                event: 'edu-howToApply-formChange',
        Severity: Major
        Found in src/applications/edu-benefits/components/EducationWizard.jsx and 1 other location - About 6 hrs to fix
        src/applications/_mock-form-ae-design-patterns/patterns/pattern2/TaskOrange/components/EducationWizard.jsx on lines 93..116

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

        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

          recordWizardValues = () => {
            sessionStorage.setItem(WIZARD_STATUS, WIZARD_STATUS_COMPLETE);
            recordEvent({
              event: 'edu-howToApply-applyNow',
              'edu-benefitUpdate': this.eduFormChange(this.state.newBenefit),
        Severity: Major
        Found in src/applications/edu-benefits/components/EducationWizard.jsx and 1 other location - About 5 hrs to fix
        src/applications/_mock-form-ae-design-patterns/patterns/pattern2/TaskOrange/components/EducationWizard.jsx on lines 144..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 150.

        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

              case '1990E':
                if (this?.props.showMebDgi40Feature) {
                  url = `/education/survivor-dependent-benefits/apply-for-transferred-benefits-form-22-1990e`;
                  break;
                }
        Severity: Minor
        Found in src/applications/edu-benefits/components/EducationWizard.jsx and 1 other location - About 40 mins to fix
        src/applications/_mock-form-ae-design-patterns/patterns/pattern2/TaskOrange/components/EducationWizard.jsx on lines 66..72

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

        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

            return (
              <a
                id="apply-now-link"
                className="vads-c-action-link--green"
                href={url}
        Severity: Minor
        Found in src/applications/edu-benefits/components/EducationWizard.jsx and 1 other location - About 40 mins to fix
        src/applications/_mock-form-ae-design-patterns/patterns/pattern2/TaskOrange/components/EducationWizard.jsx on lines 81..90

        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

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

          isReceivingSponsorBenefits = input => {
            const formChangeMap = {
              own: 'no',
              transferred: 'yes',
              fry: 'no with scholarship',
        Severity: Major
        Found in src/applications/edu-benefits/components/EducationWizard.jsx and 3 other locations - About 30 mins to fix
        src/applications/_mock-form-ae-design-patterns/patterns/pattern2/TaskOrange/components/EducationWizard.jsx on lines 118..125
        src/applications/_mock-form-ae-design-patterns/patterns/pattern2/TaskOrange/components/EducationWizard.jsx on lines 127..134
        src/applications/edu-benefits/components/EducationWizard.jsx on lines 132..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 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 4 locations. Consider refactoring.
        Open

          eduFormChange = input => {
            const formChangeMap = {
              yes: 'new',
              no: 'update',
              extend: 'stem-scholarship',
        Severity: Major
        Found in src/applications/edu-benefits/components/EducationWizard.jsx and 3 other locations - About 30 mins to fix
        src/applications/_mock-form-ae-design-patterns/patterns/pattern2/TaskOrange/components/EducationWizard.jsx on lines 118..125
        src/applications/_mock-form-ae-design-patterns/patterns/pattern2/TaskOrange/components/EducationWizard.jsx on lines 127..134
        src/applications/edu-benefits/components/EducationWizard.jsx on lines 141..148

        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

              case '5490':
                if (this?.props.meb160630Automation) {
                  url = `/education/survivor-dependent-education-benefit-22-5490`;
                  break;
                }
        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 74..81

        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

              case '1990':
                if (this?.props.meb160630Automation) {
                  url = `/education/apply-for-benefits-form-22-1990`;
                  break;
                }
        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 82..89

        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