department-of-veterans-affairs/vets-website

View on GitHub
src/applications/representative-appoint/config/form.js

Summary

Maintainability
D
2 days
Test Coverage

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

import commonDefinitions from 'vets-json-schema/dist/definitions.json';
import environment from '@department-of-veterans-affairs/platform-utilities/environment';
import profileContactInfo from 'platform/forms-system/src/js/definitions/profileContactInfo';
import configService from '../utilities/configService';
import manifest from '../manifest.json';
Severity: Minor
Found in src/applications/representative-appoint/config/form.js - About 3 hrs to fix

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

            veteranContactMailingClaimant: {
              path: 'veteran-contact-mailing-address',
              title: `The Veteran's mailing address`,
              depends: formData => !preparerIsVeteran({ formData }),
              uiSchema: veteranContactMailingClaimant.uiSchema,
    Severity: Major
    Found in src/applications/representative-appoint/config/form.js and 3 other locations - About 1 hr to fix
    src/applications/representative-appoint/config/form.js on lines 256..263
    src/applications/representative-appoint/config/form.js on lines 264..271
    src/applications/representative-appoint/config/form.js on lines 272..279

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

    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

            veteranContactPhoneEmail: {
              path: 'veteran-contact-phone-email',
              title: `Veteran's phone number and email address`,
              depends: formData => !preparerIsVeteran({ formData }),
              uiSchema: veteranContactPhoneEmail.uiSchema,
    Severity: Major
    Found in src/applications/representative-appoint/config/form.js and 3 other locations - About 1 hr to fix
    src/applications/representative-appoint/config/form.js on lines 248..255
    src/applications/representative-appoint/config/form.js on lines 264..271
    src/applications/representative-appoint/config/form.js on lines 272..279

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

    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

            veteranIdentification: {
              path: 'veteran-identification',
              title: `Veteran's identification information`,
              depends: formData => !preparerIsVeteran({ formData }),
              uiSchema: veteranIdentification.uiSchema,
    Severity: Major
    Found in src/applications/representative-appoint/config/form.js and 3 other locations - About 1 hr to fix
    src/applications/representative-appoint/config/form.js on lines 248..255
    src/applications/representative-appoint/config/form.js on lines 256..263
    src/applications/representative-appoint/config/form.js on lines 272..279

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

    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

            veteranServiceInformation: {
              path: 'veteran-service-information',
              title: `Veteran's service information`,
              depends: formData => !preparerIsVeteran({ formData }),
              uiSchema: veteranServiceInformation.uiSchema,
    Severity: Major
    Found in src/applications/representative-appoint/config/form.js and 3 other locations - About 1 hr to fix
    src/applications/representative-appoint/config/form.js on lines 248..255
    src/applications/representative-appoint/config/form.js on lines 256..263
    src/applications/representative-appoint/config/form.js on lines 264..271

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

    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

            veteranContactMailing: {
              path: 'veteran-contact-mailing',
              title: `Your mailing address`,
              depends: formData => preparerIsVeteran({ formData }),
              uiSchema: veteranContactMailing.uiSchema,
    Severity: Major
    Found in src/applications/representative-appoint/config/form.js and 3 other locations - About 1 hr to fix
    src/applications/representative-appoint/config/form.js on lines 210..217
    src/applications/representative-appoint/config/form.js on lines 218..225
    src/applications/representative-appoint/config/form.js on lines 226..233

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

            veteranServiceInformation: {
              path: 'veteran-service-information',
              title: `Your service information`,
              depends: formData => preparerIsVeteran({ formData }),
              uiSchema: veteranServiceInformation.uiSchema,
    Severity: Major
    Found in src/applications/representative-appoint/config/form.js and 3 other locations - About 1 hr to fix
    src/applications/representative-appoint/config/form.js on lines 202..209
    src/applications/representative-appoint/config/form.js on lines 210..217
    src/applications/representative-appoint/config/form.js on lines 218..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 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 4 locations. Consider refactoring.
    Open

            veteranIdentification: {
              path: 'veteran-identification',
              title: `Your identification information`,
              depends: formData => preparerIsVeteran({ formData }),
              uiSchema: veteranIdentification.uiSchema,
    Severity: Major
    Found in src/applications/representative-appoint/config/form.js and 3 other locations - About 1 hr to fix
    src/applications/representative-appoint/config/form.js on lines 202..209
    src/applications/representative-appoint/config/form.js on lines 210..217
    src/applications/representative-appoint/config/form.js on lines 226..233

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

            veteranContactPhoneEmail: {
              path: 'veteran-contact-phone-email',
              title: `Your phone number and email address`,
              depends: formData => preparerIsVeteran({ formData }),
              uiSchema: veteranContactPhoneEmail.uiSchema,
    Severity: Major
    Found in src/applications/representative-appoint/config/form.js and 3 other locations - About 1 hr to fix
    src/applications/representative-appoint/config/form.js on lines 202..209
    src/applications/representative-appoint/config/form.js on lines 218..225
    src/applications/representative-appoint/config/form.js on lines 226..233

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

            authorizeOutsideVANames: {
              path: 'authorize-outside-va/names',
              depends: formData => {
                return formData?.repTypeRadio === ('Attorney' || 'Claims Agent');
              },
    Severity: Major
    Found in src/applications/representative-appoint/config/form.js and 2 other locations - About 1 hr to fix
    src/applications/representative-appoint/config/form.js on lines 309..317
    src/applications/representative-appoint/config/form.js on lines 318..326

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

    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

            authorizeInsideVA: {
              path: 'authorize-inside-va',
              depends: formData => {
                return formData?.repTypeRadio === ('Attorney' || 'Claims Agent');
              },
    Severity: Major
    Found in src/applications/representative-appoint/config/form.js and 2 other locations - About 1 hr to fix
    src/applications/representative-appoint/config/form.js on lines 318..326
    src/applications/representative-appoint/config/form.js on lines 327..335

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

    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

            authorizeOutsideVA: {
              path: 'authorize-outside-va',
              depends: formData => {
                return formData?.repTypeRadio === ('Attorney' || 'Claims Agent');
              },
    Severity: Major
    Found in src/applications/representative-appoint/config/form.js and 2 other locations - About 1 hr to fix
    src/applications/representative-appoint/config/form.js on lines 309..317
    src/applications/representative-appoint/config/form.js on lines 327..335

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

    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

            claimantContactMailing: {
              path: 'claimant-contact-mailing',
              depends: formData => !preparerIsVeteran({ formData }),
              title: 'Your mailing address',
              uiSchema: claimantContactMailing.uiSchema,
    Severity: Major
    Found in src/applications/representative-appoint/config/form.js and 1 other location - About 1 hr to fix
    src/applications/representative-appoint/config/form.js on lines 156..163

    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

            claimantContactPhoneEmail: {
              path: 'claimant-contact-phone-email',
              depends: formData => !preparerIsVeteran({ formData }),
              title: 'Your phone number and email address',
              uiSchema: claimantContactPhoneEmail.uiSchema,
    Severity: Major
    Found in src/applications/representative-appoint/config/form.js and 1 other location - About 1 hr to fix
    src/applications/representative-appoint/config/form.js on lines 180..187

    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

    There are no issues that match your filters.

    Category
    Status