department-of-veterans-affairs/vets-website

View on GitHub
src/applications/pre-need/utils/helpers.js

Summary

Maintainability
F
1 wk
Test Coverage

File helpers.js has 654 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import React from 'react';
import { merge } from 'lodash';
import PropTypes from 'prop-types';
import get from 'platform/utilities/data/get';
import omit from 'platform/utilities/data/omit';
Severity: Major
Found in src/applications/pre-need/utils/helpers.js - About 1 day to fix

    Function transform has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
    Open

    export function transform(formConfig, form) {
      // Copy over sponsor data if the claimant is the veteran.
      const populateSponsorData = application =>
        isVeteran({ application })
          ? merge({}, application, {
    Severity: Minor
    Found in src/applications/pre-need/utils/helpers.js - About 2 hrs 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 transform has 51 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    export function transform(formConfig, form) {
      // Copy over sponsor data if the claimant is the veteran.
      const populateSponsorData = application =>
        isVeteran({ application })
          ? merge({}, application, {
    Severity: Major
    Found in src/applications/pre-need/utils/helpers.js - About 2 hrs to fix

      Function getCemeteries has 26 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      export function getCemeteries() {
        return fetch(`${environment.API_URL}/v0/preneeds/cemeteries`, {
          credentials: 'include',
          headers: {
            'X-Key-Inflection': 'camel',
      Severity: Minor
      Found in src/applications/pre-need/utils/helpers.js - About 1 hr to fix

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

        export function transform(formConfig, form) {
          // Copy over sponsor data if the claimant is the veteran.
          const populateSponsorData = application =>
            isVeteran({ application })
              ? merge({}, application, {
        Severity: Major
        Found in src/applications/pre-need/utils/helpers.js and 1 other location - About 2 days to fix
        src/applications/pre-need-integration/utils/helpers.js on lines 639..751

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

        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

        class SSNWidget extends React.Component {
          constructor(props) {
            super(props);
            this.state = { val: props.value };
          }
        Severity: Major
        Found in src/applications/pre-need/utils/helpers.js and 1 other location - About 1 day to fix
        src/applications/pre-need-integration/utils/helpers.js on lines 784..813

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

        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

        export function getCemeteries() {
          return fetch(`${environment.API_URL}/v0/preneeds/cemeteries`, {
            credentials: 'include',
            headers: {
              'X-Key-Inflection': 'camel',
        Severity: Major
        Found in src/applications/pre-need/utils/helpers.js and 1 other location - About 1 day to fix
        src/applications/pre-need-integration/utils/helpers.js on lines 1346..1377

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

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

        export function parseResponse({ data }) {
          const { name } = data.attributes;
          const focusFileCard = () => {
            const target = $$('.schemaform-file-list li').find(entry =>
              entry.textContent?.trim().includes(name),
        Severity: Major
        Found in src/applications/pre-need/utils/helpers.js and 3 other locations - About 5 hrs to fix
        src/applications/pre-need-integration/utils/helpers.js on lines 218..238
        src/applications/simple-forms/20-10207/helpers.js on lines 140..160
        src/applications/simple-forms/40-0247/helpers.js on lines 59..79

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

        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

        export function formatName(name) {
          const { first, middle, last, suffix } = name;
          return (
            (first || last) &&
            `${first} ${middle ? `${middle} ` : ''}${last}${
        Severity: Major
        Found in src/applications/pre-need/utils/helpers.js and 1 other location - About 3 hrs to fix
        src/applications/pre-need-integration/utils/helpers.js on lines 624..632

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

        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

          <va-additional-info
            trigger={"If you're applying for someone else, who can you sign for?"}
          >
            <p>A preparer can sign for an applicant who’s:</p>
            <ul>
        Severity: Major
        Found in src/applications/pre-need/utils/helpers.js and 1 other location - About 2 hrs to fix
        src/applications/pre-need-integration/utils/helpers.js on lines 361..376

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

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

        export const createPayload = (file, formId, password) => {
          const payload = new FormData();
          payload.set('form_id', formId);
          payload.append('file', file);
          if (password) {
        Severity: Major
        Found in src/applications/pre-need/utils/helpers.js and 2 other locations - About 1 hr to fix
        src/applications/pre-need-integration/utils/helpers.js on lines 208..216
        src/applications/simple-forms/40-0247/helpers.js on lines 49..57

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

        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

        export const fullMaidenNameUI = merge({}, fullNameUI, {
          first: { 'ui:title': 'First name' },
          middle: { 'ui:title': 'Middle name' },
          last: { 'ui:title': 'Last name' },
          maiden: { 'ui:title': 'Maiden name' },
        Severity: Major
        Found in src/applications/pre-need/utils/helpers.js and 1 other location - About 1 hr to fix
        src/applications/pre-need-integration/utils/helpers.js on lines 753..759

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

        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

        export const militaryNameUI = {
          application: {
            veteran: {
              'view:hasServiceName': {
                'ui:title': 'Did you serve under another name?',
        Severity: Major
        Found in src/applications/pre-need/utils/helpers.js and 1 other location - About 1 hr to fix
        src/applications/pre-need-integration/utils/helpers.js on lines 1316..1330

        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

        Identical blocks of code found in 3 locations. Consider refactoring.
        Open

            'ui:validations': [
              // require at least one value to be true/checked
              (errors, fields) => {
                if (!Object.values(fields).some(val => val === true)) {
                  errors.addError('Please provide a response');
        Severity: Major
        Found in src/applications/pre-need/utils/helpers.js and 2 other locations - About 1 hr to fix
        src/applications/pre-need-integration/utils/helpers.js on lines 925..932
        src/applications/pre-need-integration/utils/helpers.js on lines 1065..1072

        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

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

        export function claimantHeader({ formData }) {
          const name = formatName(formData.claimant.name);
          return <h4 className="highlight">{name}</h4>;
        }
        Severity: Major
        Found in src/applications/pre-need/utils/helpers.js and 1 other location - About 1 hr to fix
        src/applications/pre-need-integration/utils/helpers.js on lines 634..637

        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

        export const spouseRelationshipDescription = (
          <va-alert
            status="info"
            background-only
            role="status"
        Severity: Major
        Found in src/applications/pre-need/utils/helpers.js and 1 other location - About 1 hr to fix
        src/applications/pre-need-integration/utils/helpers.js on lines 394..407

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

        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

          maritalStatus: {
            'ui:title': 'What’s your marital status?',
            'ui:widget': 'radio',
            'ui:options': {
              labels: {
        Severity: Major
        Found in src/applications/pre-need/utils/helpers.js and 3 other locations - About 55 mins to fix
        src/applications/_mock-form/pages/contactInfoSettings.js on lines 3..15
        src/applications/disability-benefits/all-claims/pages/individualsInvolvedFollowUp.js on lines 85..97
        src/applications/edu-benefits/0994/pages/highTechIndustry.js on lines 43..56

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

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

        export const veteranRelationshipDescription = (
          <va-alert
            status="info"
            background-only
            role="status"
        Severity: Major
        Found in src/applications/pre-need/utils/helpers.js and 5 other locations - About 50 mins to fix
        src/applications/pre-need-integration/utils/helpers.js on lines 346..357
        src/applications/pre-need-integration/utils/helpers.js on lines 409..417
        src/applications/pre-need-integration/utils/helpers.js on lines 419..426
        src/applications/pre-need/utils/helpers.js on lines 306..314
        src/applications/pre-need/utils/helpers.js on lines 316..323

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

        export const childRelationshipDescription = (
          <va-alert status="info" background-only role="status" id="child-relationship">
            You’re applying as the <strong>unmarried adult child</strong> of the service
            member or Veteran who’s your sponsor. We’ll ask you questions about your
            sponsor’s military status and history to determine if you qualify for burial
        Severity: Major
        Found in src/applications/pre-need/utils/helpers.js and 5 other locations - About 50 mins to fix
        src/applications/pre-need-integration/utils/helpers.js on lines 346..357
        src/applications/pre-need-integration/utils/helpers.js on lines 409..417
        src/applications/pre-need-integration/utils/helpers.js on lines 419..426
        src/applications/pre-need/utils/helpers.js on lines 261..272
        src/applications/pre-need/utils/helpers.js on lines 316..323

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

        export const otherRelationshipDescription = (
          <va-alert status="info" background-only role="status" id="other-relationship">
            You’re applying on <strong>behalf</strong> of the service member or Veteran
            who’s your sponsor. We’ll ask you questions about your sponsor’s military
            status and history to determine if they qualify for burial in a VA national
        Severity: Major
        Found in src/applications/pre-need/utils/helpers.js and 5 other locations - About 50 mins to fix
        src/applications/pre-need-integration/utils/helpers.js on lines 346..357
        src/applications/pre-need-integration/utils/helpers.js on lines 409..417
        src/applications/pre-need-integration/utils/helpers.js on lines 419..426
        src/applications/pre-need/utils/helpers.js on lines 261..272
        src/applications/pre-need/utils/helpers.js on lines 306..314

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

        export const contactInfoDescription = (
          <va-additional-info trigger="Why do we need your contact information?">
            <p>
              We may contact you by phone if we need more information about your
              application.
        Severity: Major
        Found in src/applications/pre-need/utils/helpers.js and 2 other locations - About 50 mins to fix
        src/applications/pre-need-integration/utils/helpers.js on lines 240..251
        src/applications/my-education-benefits/helpers.js on lines 50..60

        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

        export function ApplicantDescriptionWrapper({ formContext }) {
          return (
            <div className="ApplicantDescriptionWrapper">
              <ApplicantDescription formContext={formContext} />
            </div>
        Severity: Minor
        Found in src/applications/pre-need/utils/helpers.js and 1 other location - About 50 mins to fix
        src/applications/pre-need-integration/utils/helpers.js on lines 76..82

        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

        export const desiredCemeteryNoteDescriptionNonVeteran = (
          <va-alert status="info" background-only id="burial-cemetary-note">
            <strong>Please note:</strong> This doesn’t guarantee the applicant will be
            buried in their preferred cemetery, but we’ll try to fulfill their wishes.
            If space is unavailable, we’ll work with their family to assign a gravesite
        Severity: Minor
        Found in src/applications/pre-need/utils/helpers.js and 1 other location - About 35 mins to fix
        src/applications/pre-need/utils/helpers.js on lines 333..340

        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

        export const desiredCemeteryNoteDescriptionVeteran = (
          <va-alert status="info" background-only id="burial-cemetary-note">
            <strong>Please note:</strong> This doesn’t guarantee you’ll be buried in
            your preferred cemetery, but we’ll try to fulfill your wishes. If space is
            unavailable, we’ll work with your family to assign a gravesite in a cemetery
        Severity: Minor
        Found in src/applications/pre-need/utils/helpers.js and 1 other location - About 35 mins to fix
        src/applications/pre-need/utils/helpers.js on lines 342..349

        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

            <ul>
              <>
                <li>
                  You’re considered the sponsor if you’re the service member or Veteran
                  sponsoring the applicant’s benefits. We’ll ask you to provide your
        Severity: Minor
        Found in src/applications/pre-need/utils/helpers.js and 1 other location - About 35 mins to fix
        src/applications/simple-forms/40-0247/helpers.js on lines 40..45

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

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

        export function sponsorMailingAddressHasState(item) {
          const country = get('application.veteran.address.country', item);
          const countriesWithStates = ['USA', 'CAN'];
          return countriesWithStates.includes(country);
        }
        Severity: Major
        Found in src/applications/pre-need/utils/helpers.js and 5 other locations - About 30 mins to fix
        src/applications/pre-need-integration/utils/helpers.js on lines 547..554
        src/applications/pre-need-integration/utils/helpers.js on lines 556..560
        src/applications/pre-need-integration/utils/helpers.js on lines 562..566
        src/applications/pre-need/utils/helpers.js on lines 351..358
        src/applications/pre-need/utils/helpers.js on lines 360..364

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

        export function preparerAddressHasState(item) {
          const country = get(
            'application.applicant.view:applicantInfo.mailingAddress.country',
            item,
          );
        Severity: Major
        Found in src/applications/pre-need/utils/helpers.js and 5 other locations - About 30 mins to fix
        src/applications/pre-need-integration/utils/helpers.js on lines 547..554
        src/applications/pre-need-integration/utils/helpers.js on lines 556..560
        src/applications/pre-need-integration/utils/helpers.js on lines 562..566
        src/applications/pre-need/utils/helpers.js on lines 360..364
        src/applications/pre-need/utils/helpers.js on lines 366..370

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

        export function applicantsMailingAddressHasState(item) {
          const country = get('application.claimant.address.country', item);
          const countriesWithStates = ['USA', 'CAN'];
          return countriesWithStates.includes(country);
        }
        Severity: Major
        Found in src/applications/pre-need/utils/helpers.js and 5 other locations - About 30 mins to fix
        src/applications/pre-need-integration/utils/helpers.js on lines 547..554
        src/applications/pre-need-integration/utils/helpers.js on lines 556..560
        src/applications/pre-need-integration/utils/helpers.js on lines 562..566
        src/applications/pre-need/utils/helpers.js on lines 351..358
        src/applications/pre-need/utils/helpers.js on lines 366..370

        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