department-of-veterans-affairs/vets-website

View on GitHub
src/applications/ask-va/config/schema-helpers/formFlowHelper.js

Summary

Maintainability
D
2 days
Test Coverage

File formFlowHelper.js has 545 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import _ from 'lodash';
import {
  CategoryEducation,
  CHAPTER_2,
  CHAPTER_3,
Severity: Major
Found in src/applications/ask-va/config/schema-helpers/formFlowHelper.js - About 1 day to fix

    Function flowPages has 42 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    export const flowPages = (obj, list, path) => {
      const pages = _.cloneDeep(obj);
      const flowGroup = {};
      const flowGroupName = path
        .split('-')
    Severity: Minor
    Found in src/applications/ask-va/config/schema-helpers/formFlowHelper.js - About 1 hr to fix

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

      export const flowPaths = {
        aboutMyselfRelationshipVeteran: 'about-myself-relationship-veteran',
        aboutMyselfRelationshipFamilyMember:
          'about-myself-relationship-family-member',
        aboutSomeoneElseRelationshipVeteran:
      src/applications/mhv-medical-records/util/constants.js on lines 233..244
      src/applications/mhv-medications/util/constants.js on lines 156..167
      src/platform/utilities/oauth/constants.js on lines 40..51
      src/applications/lgy/coe/shared/constants.js on lines 1..12

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

        const conditionMap = {
          aboutmyselfrelationshipveteran: aboutMyselfRelationshipVeteranCondition,
          aboutmyselfrelationshipfamilymember: aboutMyselfRelationshipFamilyMemberCondition,
          aboutsomeoneelserelationshipveteran: aboutSomeoneElseRelationshipVeteranCondition,
          aboutsomeoneelserelationshipfamilymember: aboutSomeoneElseRelationshipFamilyMemberCondition,
      src/applications/claims-status/components/claim-files-tab/AdditionalEvidencePage.jsx on lines 219..230
      src/applications/facility-locator/containers/FacilitiesMap.jsx on lines 685..696
      src/applications/appeals/shared/props.js on lines 65..76
      src/platform/forms-system/src/js/patterns/array-builder/arrayBuilder.jsx on lines 393..404

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

        dateOfDeath: {
          title: CHAPTER_3.DEATH_DATE.TITLE,
          uiSchema: deathDatePage.uiSchema,
          schema: deathDatePage.schema,
          depends: form => form.isVeteranDeceased === 'Yes',
      src/applications/ask-va/config/schema-helpers/formFlowHelper.js on lines 120..125
      src/applications/ask-va/config/schema-helpers/formFlowHelper.js on lines 214..219
      src/applications/ask-va/config/schema-helpers/formFlowHelper.js on lines 220..225

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

      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

        yourPostalCode: {
          title: CHAPTER_3.YOUR_POSTAL_CODE.TITLE,
          uiSchema: yourPostalCodePage.uiSchema,
          schema: yourPostalCodePage.schema,
          depends: form => form.contactPreference !== 'U.S. mail',
      src/applications/ask-va/config/schema-helpers/formFlowHelper.js on lines 98..103
      src/applications/ask-va/config/schema-helpers/formFlowHelper.js on lines 214..219
      src/applications/ask-va/config/schema-helpers/formFlowHelper.js on lines 220..225

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

      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

        yourMailingAddress: {
          title: CHAPTER_3.YOUR_MAILING_ADDRESS.TITLE,
          uiSchema: yourMailingAddressPage.uiSchema,
          schema: yourMailingAddressPage.schema,
          depends: form => form.contactPreference === 'U.S. mail',
      src/applications/ask-va/config/schema-helpers/formFlowHelper.js on lines 98..103
      src/applications/ask-va/config/schema-helpers/formFlowHelper.js on lines 120..125
      src/applications/ask-va/config/schema-helpers/formFlowHelper.js on lines 214..219

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

      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

        yourCountry: {
          title: CHAPTER_3.YOUR_COUNTRY.TITLE,
          uiSchema: yourCountryPage.uiSchema,
          schema: yourCountryPage.schema,
          depends: form => form.contactPreference === 'U.S. mail',
      src/applications/ask-va/config/schema-helpers/formFlowHelper.js on lines 98..103
      src/applications/ask-va/config/schema-helpers/formFlowHelper.js on lines 120..125
      src/applications/ask-va/config/schema-helpers/formFlowHelper.js on lines 220..225

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

      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

      const aboutSomeoneElseRelationshipFamilyMemberCondition = formData => {
        return (
          formData.whoIsYourQuestionAbout === 'Someone else' &&
          formData.relationshipToVeteran === "I'm a family member of a Veteran" &&
          formData.selectCategory !== CategoryEducation
      src/applications/ask-va/config/schema-helpers/formFlowHelper.js on lines 305..311
      src/applications/ask-va/config/schema-helpers/formFlowHelper.js on lines 335..342
      src/applications/ask-va/config/schema-helpers/formFlowHelper.js on lines 354..361

      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

      const aboutSomeoneElseRelationshipConnectedThroughWorkCondition = formData => {
        return (
          formData.whoIsYourQuestionAbout === 'Someone else' &&
          formData.relationshipToVeteran ===
            "I'm connected to the Veteran through my work (for example, as a School Certifying Official or fiduciary)" &&
      src/applications/ask-va/config/schema-helpers/formFlowHelper.js on lines 305..311
      src/applications/ask-va/config/schema-helpers/formFlowHelper.js on lines 313..319
      src/applications/ask-va/config/schema-helpers/formFlowHelper.js on lines 354..361

      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

      const aboutSomeoneElseRelationshipVeteranCondition = formData => {
        return (
          formData.whoIsYourQuestionAbout === 'Someone else' &&
          formData.relationshipToVeteran === "I'm the Veteran" &&
          formData.selectCategory !== CategoryEducation
      src/applications/ask-va/config/schema-helpers/formFlowHelper.js on lines 313..319
      src/applications/ask-va/config/schema-helpers/formFlowHelper.js on lines 335..342
      src/applications/ask-va/config/schema-helpers/formFlowHelper.js on lines 354..361

      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

      const aboutSomeoneElseRelationshipVeteranOrFamilyMemberEducationCondition = formData => {
        return (
          formData.whoIsYourQuestionAbout === 'Someone else' &&
          formData.relationshipToVeteran !==
            "I'm connected to the Veteran through my work (for example, as a School Certifying Official or fiduciary)" &&
      src/applications/ask-va/config/schema-helpers/formFlowHelper.js on lines 305..311
      src/applications/ask-va/config/schema-helpers/formFlowHelper.js on lines 313..319
      src/applications/ask-va/config/schema-helpers/formFlowHelper.js on lines 335..342

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

        theirRelationshipToVeteran: {
          editModeOnReviewPage: false,
          title: CHAPTER_3.RELATIONSHIP_TO_FAM_MEM.TITLE,
          uiSchema: theirRelationshipToVeteranPage.uiSchema,
          schema: theirRelationshipToVeteranPage.schema,
      Severity: Minor
      Found in src/applications/ask-va/config/schema-helpers/formFlowHelper.js and 1 other location - About 35 mins to fix
      src/applications/ask-va/config/schema-helpers/formFlowHelper.js on lines 239..245

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

      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

        aboutYourRelationshipToFamilyMember: {
          editModeOnReviewPage: false,
          title: CHAPTER_3.RELATIONSHIP_TO_FAM_MEM.TITLE,
          uiSchema: aboutYourRelationshipToFamilyMemberPage.uiSchema,
          schema: aboutYourRelationshipToFamilyMemberPage.schema,
      Severity: Minor
      Found in src/applications/ask-va/config/schema-helpers/formFlowHelper.js and 1 other location - About 35 mins to fix
      src/applications/ask-va/config/schema-helpers/formFlowHelper.js on lines 246..252

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

      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