department-of-veterans-affairs/vets-website

View on GitHub
src/applications/edu-benefits/5490/config/form.js

Summary

Maintainability
D
2 days
Test Coverage

File form.js has 644 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import { merge, omit } from 'lodash';
import get from 'platform/utilities/data/get';

import fullSchema5490 from 'vets-json-schema/dist/22-5490-schema.json';
import currentOrPastDateUI from 'platform/forms-system/src/js/definitions/currentOrPastDate';
Severity: Major
Found in src/applications/edu-benefits/5490/config/form.js - About 1 day to fix

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

                'view:sponsorDateListedMiaOrPow': {
                  ...currentOrPastDateUI('Sponsor’s date listed as MIA or POW'),
                  'ui:options': {
                    expandUnder: 'sponsorStatus',
                    expandUnderCondition: status => status && status === 'powOrMia',
    Severity: Major
    Found in src/applications/edu-benefits/5490/config/form.js and 1 other location - About 1 hr to fix
    src/applications/edu-benefits/5490/config/form.js on lines 570..579

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

    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

                'view:sponsorDateOfDeath': {
                  ...currentOrPastDateUI('Sponsor’s date of death'),
                  'ui:options': {
                    expandUnder: 'sponsorStatus',
                    expandUnderCondition: status => status && status !== 'powOrMia',
    Severity: Major
    Found in src/applications/edu-benefits/5490/config/form.js and 1 other location - About 1 hr to fix
    src/applications/edu-benefits/5490/config/form.js on lines 580..589

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

    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 {
      benefit,
      benefitsRelinquishedDate,
      currentlyActiveDuty,
      currentSameAsPrevious,
    Severity: Major
    Found in src/applications/edu-benefits/5490/config/form.js and 3 other locations - About 1 hr to fix
    src/applications/disability-benefits/686c-674-v2/config/utilities.js on lines 72..84
    src/applications/disability-benefits/686c-674/config/utilities.js on lines 71..83
    src/applications/mhv-secure-messaging/components/ThreadList/ThreadListItem.jsx on lines 14..26

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

    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

              schema: {
                type: 'object',
                required: ['benefitsRelinquishedDate'],
                properties: {
                  'view:benefitsRelinquishedInfo': {
    Severity: Major
    Found in src/applications/edu-benefits/5490/config/form.js and 2 other locations - About 1 hr to fix
    src/applications/pensions/config/chapters/05-financial-information/totalNetWorth.js on lines 43..57
    src/applications/pensions/config/chapters/05-financial-information/transferredAssets.js on lines 34..48

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

    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 relationshipEqualToChild = (myGet, formData) => {
      return (
        myGet('relationshipAndChildType', formData) === 'adopted' ||
        myGet('relationshipAndChildType', formData) === 'biological' ||
        myGet('relationshipAndChildType', formData) === 'step'
    Severity: Minor
    Found in src/applications/edu-benefits/5490/config/form.js and 1 other location - About 50 mins to fix
    src/applications/edu-benefits/5490/config/form.js on lines 87..93

    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

    const relationshipNotEqualToChild = (myGet, formData) => {
      return (
        myGet('relationshipAndChildType', formData) !== 'adopted' ||
        myGet('relationshipAndChildType', formData) !== 'biological' ||
        myGet('relationshipAndChildType', formData) !== 'step'
    Severity: Minor
    Found in src/applications/edu-benefits/5490/config/form.js and 1 other location - About 50 mins to fix
    src/applications/edu-benefits/5490/config/form.js on lines 79..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 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 7 locations. Consider refactoring.
    Open

    const {
      date,
      dateRange,
      educationType,
      fullName,
    Severity: Major
    Found in src/applications/edu-benefits/5490/config/form.js and 6 other locations - About 35 mins to fix
    src/applications/burials-ez/config/form.js on lines 51..59
    src/applications/claims-status/components/ClaimsListItem.jsx on lines 52..60
    src/applications/disability-benefits/all-claims/pages/homelessOrAtRisk.js on lines 6..14
    src/applications/hca/config/chapters/veteranInformation/demographicInformation.js on lines 5..13
    src/applications/personalization/view-dependents/manage-dependents/utils/index.js on lines 30..38
    src/applications/vre/25-8832/config/utilities.js on lines 3..11

    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