department-of-veterans-affairs/vets-website

View on GitHub
src/applications/toe/helpers.jsx

Summary

Maintainability
F
1 wk
Test Coverage

File helpers.jsx has 402 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import { cloneDeep } from 'lodash';

import { formFields } from './constants';

import { getSchemaCountryCode } from './utils/form-submit-transform';
Severity: Minor
Found in src/applications/toe/helpers.jsx - About 5 hrs to fix

    Function prefillTransformerV2 has 116 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    export function prefillTransformerV2(pages, formData, metadata, state) {
      const bankInformation = state.data?.bankInformation || {};
      const claimant = state.data?.formData?.data?.attributes?.claimant || {};
      const contactInfo = claimant?.contactInfo || {};
      const sponsors = state.data?.formData?.attributes?.sponsors;
    Severity: Major
    Found in src/applications/toe/helpers.jsx - About 4 hrs to fix

      Function prefillTransformerV1 has 112 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      export function prefillTransformerV1(pages, formData, metadata, state) {
        const bankInformation = state.data?.bankInformation || {};
        const claimant = state.data?.formData?.data?.attributes?.claimant || {};
        const contactInfo = claimant?.contactInfo || {};
        const sponsors = state.data?.formData?.attributes?.sponsors;
      Severity: Major
      Found in src/applications/toe/helpers.jsx - About 4 hrs to fix

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

        export function prefillTransformerV1(pages, formData, metadata, state) {
          const bankInformation = state.data?.bankInformation || {};
          const claimant = state.data?.formData?.data?.attributes?.claimant || {};
          const contactInfo = claimant?.contactInfo || {};
          const sponsors = state.data?.formData?.attributes?.sponsors;
        Severity: Minor
        Found in src/applications/toe/helpers.jsx - 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 prefillTransformerV2 has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
        Open

        export function prefillTransformerV2(pages, formData, metadata, state) {
          const bankInformation = state.data?.bankInformation || {};
          const claimant = state.data?.formData?.data?.attributes?.claimant || {};
          const contactInfo = claimant?.contactInfo || {};
          const sponsors = state.data?.formData?.attributes?.sponsors;
        Severity: Minor
        Found in src/applications/toe/helpers.jsx - 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 formatReadableDate has 28 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        export const formatReadableDate = rawDate => {
          const months = [
            'January',
            'February',
            'March',
        Severity: Minor
        Found in src/applications/toe/helpers.jsx - About 1 hr to fix

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

          export const formatReadableDate = rawDate => {
            const months = [
              'January',
              'February',
              'March',
          Severity: Major
          Found in src/applications/toe/helpers.jsx and 2 other locations - About 7 hrs to fix
          src/applications/fry-dea/helpers.jsx on lines 34..67
          src/applications/survivor-dependent-education-benefit/22-5490/helpers.jsx on lines 45..78

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

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

            if (profile?.userFullName?.first && profile?.userFullName?.last) {
              firstName = profile.userFullName.first;
              middleName = profile.userFullName.middle;
              lastName = profile.userFullName.last;
              // suffix = ???
          Severity: Major
          Found in src/applications/toe/helpers.jsx and 6 other locations - About 4 hrs to fix
          src/applications/my-education-benefits/helpers.js on lines 263..273
          src/applications/my-education-benefits/helpers.js on lines 392..402
          src/applications/my-education-benefits/helpers.js on lines 528..538
          src/applications/my-education-benefits/helpers.js on lines 673..683
          src/applications/survivor-dependent-education-benefit/22-5490/helpers.jsx on lines 105..115
          src/applications/toe/helpers.jsx on lines 115..125

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

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

            if (profile?.userFullName?.first && profile?.userFullName?.last) {
              firstName = profile.userFullName.first;
              middleName = profile.userFullName.middle;
              lastName = profile.userFullName.last;
              // suffix = ???
          Severity: Major
          Found in src/applications/toe/helpers.jsx and 6 other locations - About 4 hrs to fix
          src/applications/my-education-benefits/helpers.js on lines 263..273
          src/applications/my-education-benefits/helpers.js on lines 392..402
          src/applications/my-education-benefits/helpers.js on lines 528..538
          src/applications/my-education-benefits/helpers.js on lines 673..683
          src/applications/survivor-dependent-education-benefit/22-5490/helpers.jsx on lines 105..115
          src/applications/toe/helpers.jsx on lines 240..250

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

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

            if (suffix) {
              newData[formFields.viewUserFullName].userFullName.suffix =
                state?.form?.pages?.applicantInformation?.schema?.properties[
                  formFields.viewUserFullName
                ]?.properties?.userFullName?.properties?.suffix?.enum?.find(e =>
          Severity: Major
          Found in src/applications/toe/helpers.jsx and 5 other locations - About 3 hrs to fix
          src/applications/my-education-benefits/helpers.js on lines 360..367
          src/applications/my-education-benefits/helpers.js on lines 490..497
          src/applications/my-education-benefits/helpers.js on lines 639..646
          src/applications/my-education-benefits/helpers.js on lines 777..784
          src/applications/toe/helpers.jsx on lines 339..346

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

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

            if (suffix) {
              newData[formFields.viewUserFullName].userFullName.suffix =
                state?.form?.pages?.applicantInformation?.schema?.properties[
                  formFields.viewUserFullName
                ]?.properties?.userFullName?.properties?.suffix?.enum?.find(e =>
          Severity: Major
          Found in src/applications/toe/helpers.jsx and 5 other locations - About 3 hrs to fix
          src/applications/my-education-benefits/helpers.js on lines 360..367
          src/applications/my-education-benefits/helpers.js on lines 490..497
          src/applications/my-education-benefits/helpers.js on lines 639..646
          src/applications/my-education-benefits/helpers.js on lines 777..784
          src/applications/toe/helpers.jsx on lines 209..216

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

          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 function obfuscate(str, numVisibleChars = 4, obfuscateChar = '●') {
            if (!str) {
              return '';
            }
          
          
          Severity: Major
          Found in src/applications/toe/helpers.jsx and 2 other locations - About 3 hrs to fix
          src/applications/my-education-benefits/helpers.js on lines 65..78
          src/applications/survivor-dependent-education-benefit/22-5490/helpers.jsx on lines 23..36

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

          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 toSnakeCase = obj => {
            const result = {};
            Object.keys(obj).forEach(key => {
              const snakeKey = key.replace(/([A-Z])/g, '_$1').toLowerCase();
              result[snakeKey] = obj[key];
          Severity: Major
          Found in src/applications/toe/helpers.jsx and 1 other location - About 2 hrs to fix
          src/applications/my-education-benefits/helpers.js on lines 834..841

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

          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

                [formFields.address]: {
                  street: address?.addressLine1,
                  street2: address?.addressLine2 || undefined,
                  city: address?.city,
                  state: address?.stateCode,
          Severity: Major
          Found in src/applications/toe/helpers.jsx and 1 other location - About 2 hrs to fix
          src/applications/my-education-benefits/helpers.js on lines 338..345

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

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

              [formFields.viewPhoneNumbers]: {
                [formFields.mobilePhoneNumber]: {
                  phone: mobilePhoneNumber?.replace(/\D/g, '') || undefined,
                  isInternational: mobilePhoneIsInternational,
                },
          Severity: Major
          Found in src/applications/toe/helpers.jsx and 5 other locations - About 2 hrs to fix
          src/applications/my-education-benefits/helpers.js on lines 324..333
          src/applications/my-education-benefits/helpers.js on lines 453..462
          src/applications/my-education-benefits/helpers.js on lines 589..598
          src/applications/my-education-benefits/helpers.js on lines 734..743
          src/applications/toe/helpers.jsx on lines 177..186

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

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

              [formFields.viewPhoneNumbers]: {
                [formFields.mobilePhoneNumber]: {
                  phone: mobilePhoneNumber?.replace(/\D/g, '') || undefined,
                  isInternational: mobilePhoneIsInternational,
                },
          Severity: Major
          Found in src/applications/toe/helpers.jsx and 5 other locations - About 2 hrs to fix
          src/applications/my-education-benefits/helpers.js on lines 324..333
          src/applications/my-education-benefits/helpers.js on lines 453..462
          src/applications/my-education-benefits/helpers.js on lines 589..598
          src/applications/my-education-benefits/helpers.js on lines 734..743
          src/applications/toe/helpers.jsx on lines 302..311

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

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

            if (vapHomePhone.areaCode && vapHomePhone.phoneNumber) {
              homePhoneNumber = [vapHomePhone.areaCode, vapHomePhone.phoneNumber].join();
              homePhoneIsInternational = vapHomePhone.isInternational;
            } else {
              homePhoneNumber = contactInfo?.homePhoneNumber;
          Severity: Major
          Found in src/applications/toe/helpers.jsx and 11 other locations - About 1 hr to fix
          src/applications/my-education-benefits/helpers.js on lines 284..292
          src/applications/my-education-benefits/helpers.js on lines 297..302
          src/applications/my-education-benefits/helpers.js on lines 413..421
          src/applications/my-education-benefits/helpers.js on lines 426..431
          src/applications/my-education-benefits/helpers.js on lines 549..557
          src/applications/my-education-benefits/helpers.js on lines 562..567
          src/applications/my-education-benefits/helpers.js on lines 694..702
          src/applications/my-education-benefits/helpers.js on lines 707..712
          src/applications/toe/helpers.jsx on lines 136..144
          src/applications/toe/helpers.jsx on lines 261..269
          src/applications/toe/helpers.jsx on lines 274..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 70.

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

            if (vapMobilePhone.areaCode && vapMobilePhone.phoneNumber) {
              mobilePhoneNumber = [
                vapMobilePhone.areaCode,
                vapMobilePhone.phoneNumber,
              ].join();
          Severity: Major
          Found in src/applications/toe/helpers.jsx and 11 other locations - About 1 hr to fix
          src/applications/my-education-benefits/helpers.js on lines 284..292
          src/applications/my-education-benefits/helpers.js on lines 297..302
          src/applications/my-education-benefits/helpers.js on lines 413..421
          src/applications/my-education-benefits/helpers.js on lines 426..431
          src/applications/my-education-benefits/helpers.js on lines 549..557
          src/applications/my-education-benefits/helpers.js on lines 562..567
          src/applications/my-education-benefits/helpers.js on lines 694..702
          src/applications/my-education-benefits/helpers.js on lines 707..712
          src/applications/toe/helpers.jsx on lines 136..144
          src/applications/toe/helpers.jsx on lines 149..154
          src/applications/toe/helpers.jsx on lines 274..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 70.

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

            if (vapHomePhone.areaCode && vapHomePhone.phoneNumber) {
              homePhoneNumber = [vapHomePhone.areaCode, vapHomePhone.phoneNumber].join();
              homePhoneIsInternational = vapHomePhone.isInternational;
            } else {
              homePhoneNumber = contactInfo?.homePhoneNumber;
          Severity: Major
          Found in src/applications/toe/helpers.jsx and 11 other locations - About 1 hr to fix
          src/applications/my-education-benefits/helpers.js on lines 284..292
          src/applications/my-education-benefits/helpers.js on lines 297..302
          src/applications/my-education-benefits/helpers.js on lines 413..421
          src/applications/my-education-benefits/helpers.js on lines 426..431
          src/applications/my-education-benefits/helpers.js on lines 549..557
          src/applications/my-education-benefits/helpers.js on lines 562..567
          src/applications/my-education-benefits/helpers.js on lines 694..702
          src/applications/my-education-benefits/helpers.js on lines 707..712
          src/applications/toe/helpers.jsx on lines 136..144
          src/applications/toe/helpers.jsx on lines 149..154
          src/applications/toe/helpers.jsx on lines 261..269

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

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

            if (vapMobilePhone.areaCode && vapMobilePhone.phoneNumber) {
              mobilePhoneNumber = [
                vapMobilePhone.areaCode,
                vapMobilePhone.phoneNumber,
              ].join();
          Severity: Major
          Found in src/applications/toe/helpers.jsx and 11 other locations - About 1 hr to fix
          src/applications/my-education-benefits/helpers.js on lines 284..292
          src/applications/my-education-benefits/helpers.js on lines 297..302
          src/applications/my-education-benefits/helpers.js on lines 413..421
          src/applications/my-education-benefits/helpers.js on lines 426..431
          src/applications/my-education-benefits/helpers.js on lines 549..557
          src/applications/my-education-benefits/helpers.js on lines 562..567
          src/applications/my-education-benefits/helpers.js on lines 694..702
          src/applications/my-education-benefits/helpers.js on lines 707..712
          src/applications/toe/helpers.jsx on lines 149..154
          src/applications/toe/helpers.jsx on lines 261..269
          src/applications/toe/helpers.jsx on lines 274..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 70.

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

              [formFields.viewUserFullName]: {
                [formFields.userFullName]: {
                  first: firstName || undefined,
                  middle: middleName || undefined,
                  last: lastName || undefined,
          Severity: Major
          Found in src/applications/toe/helpers.jsx and 5 other locations - About 35 mins to fix
          src/applications/my-education-benefits/helpers.js on lines 312..318
          src/applications/my-education-benefits/helpers.js on lines 441..447
          src/applications/my-education-benefits/helpers.js on lines 577..583
          src/applications/my-education-benefits/helpers.js on lines 722..728
          src/applications/toe/helpers.jsx on lines 290..296

          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

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

              [formFields.viewUserFullName]: {
                [formFields.userFullName]: {
                  first: firstName || undefined,
                  middle: middleName || undefined,
                  last: lastName || undefined,
          Severity: Major
          Found in src/applications/toe/helpers.jsx and 5 other locations - About 35 mins to fix
          src/applications/my-education-benefits/helpers.js on lines 312..318
          src/applications/my-education-benefits/helpers.js on lines 441..447
          src/applications/my-education-benefits/helpers.js on lines 577..583
          src/applications/my-education-benefits/helpers.js on lines 722..728
          src/applications/toe/helpers.jsx on lines 165..171

          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

          function mapNotificationMethod({ notificationMethod }) {
            if (notificationMethod === 'EMAIL') {
              return 'No, just send me email notifications';
            }
            if (notificationMethod === 'TEXT') {
          Severity: Minor
          Found in src/applications/toe/helpers.jsx and 1 other location - About 35 mins to fix
          src/applications/my-education-benefits/helpers.js on lines 212..221

          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

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

          export function titleCase(str) {
            return str[0].toUpperCase() + str.slice(1).toLowerCase();
          }
          Severity: Major
          Found in src/applications/toe/helpers.jsx and 3 other locations - About 30 mins to fix
          src/applications/fry-dea/helpers.jsx on lines 17..19
          src/applications/my-education-benefits/helpers.js on lines 62..64
          src/applications/survivor-dependent-education-benefit/22-5490/helpers.jsx on lines 19..21

          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