department-of-veterans-affairs/vets-website

View on GitHub

Showing 12,848 of 12,848 total issues

Function NotificationItem has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
Open

const NotificationItem = ({ channelIds, itemName, description, itemId }) => {
  const {
    profileShowMhvNotificationSettingsEmailAppointmentReminders: aptReminderToggle,
    profileShowMhvNotificationSettingsEmailRxShipment: shipmentToggle,
  } = useNotificationSettingsUtils().toggles;

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 Decision has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
Open

const Decision = ({ issues, aoj, ama = true, boardDecision = false }) => {
  const allowedIssues = issues
    .filter(issue => issue.disposition === 'allowed')
    .map((issue, i) => <li key={`allowed-${i}`}>{issue.description}</li>);
  const deniedIssues = issues

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 pharmacyPhoneNumber has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
Open

export const pharmacyPhoneNumber = prescription => {
  if (prescription.cmopDivisionPhone) {
    return prescription.cmopDivisionPhone;
  }
  if (prescription.dialCmopDivisionPhone) {
Severity: Minor
Found in src/applications/mhv-medications/util/helpers.js - About 1 hr 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

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/my-education-benefits/helpers.js and 11 other locations - About 1 hr to fix
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
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/my-education-benefits/helpers.js 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/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
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 (vapHomePhone.areaCode && vapHomePhone.phoneNumber) {
    homePhoneNumber = [vapHomePhone.areaCode, vapHomePhone.phoneNumber].join();
    homePhoneIsInternational = vapHomePhone.isInternational;
  } else {
    homePhoneNumber = contactInfo?.homePhoneNumber;
Severity: Major
Found in src/applications/my-education-benefits/helpers.js 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 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
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 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/my-education-benefits/helpers.js 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 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
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 10 locations. Consider refactoring.
Open

        veteranMarriageHistoryDetailsPartThree: {
          depends: formData =>
            isChapterFieldRequired(formData, TASK_KEYS.addSpouse) &&
            formData?.veteranWasMarriedBefore,
          title:
src/applications/disability-benefits/686c-674-v2/config/form.js on lines 299..311
src/applications/disability-benefits/686c-674-v2/config/form.js on lines 312..324
src/applications/disability-benefits/686c-674-v2/config/form.js on lines 325..337
src/applications/disability-benefits/686c-674-v2/config/form.js on lines 338..350
src/applications/disability-benefits/686c-674-v2/config/form.js on lines 351..363
src/applications/disability-benefits/686c-674-v2/config/form.js on lines 393..404
src/applications/disability-benefits/686c-674-v2/config/form.js on lines 405..416
src/applications/disability-benefits/686c-674-v2/config/form.js on lines 429..441
src/applications/disability-benefits/686c-674-v2/config/form.js on lines 442..453

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

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

        veteranMarriageHistoryDetailsPartFive: {
          depends: formData =>
            isChapterFieldRequired(formData, TASK_KEYS.addSpouse) &&
            formData?.veteranWasMarriedBefore,
          title:
src/applications/disability-benefits/686c-674-v2/config/form.js on lines 299..311
src/applications/disability-benefits/686c-674-v2/config/form.js on lines 312..324
src/applications/disability-benefits/686c-674-v2/config/form.js on lines 325..337
src/applications/disability-benefits/686c-674-v2/config/form.js on lines 338..350
src/applications/disability-benefits/686c-674-v2/config/form.js on lines 351..363
src/applications/disability-benefits/686c-674-v2/config/form.js on lines 393..404
src/applications/disability-benefits/686c-674-v2/config/form.js on lines 405..416
src/applications/disability-benefits/686c-674-v2/config/form.js on lines 417..428
src/applications/disability-benefits/686c-674-v2/config/form.js on lines 429..441

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/my-education-benefits/helpers.js 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 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
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/my-education-benefits/helpers.js 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 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
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/my-education-benefits/helpers.js 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 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
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 10 locations. Consider refactoring.
Open

        veteranMarriageHistoryDetails: {
          depends: formData =>
            isChapterFieldRequired(formData, TASK_KEYS.addSpouse) &&
            formData?.veteranWasMarriedBefore,
          title:
src/applications/disability-benefits/686c-674-v2/config/form.js on lines 299..311
src/applications/disability-benefits/686c-674-v2/config/form.js on lines 312..324
src/applications/disability-benefits/686c-674-v2/config/form.js on lines 325..337
src/applications/disability-benefits/686c-674-v2/config/form.js on lines 338..350
src/applications/disability-benefits/686c-674-v2/config/form.js on lines 351..363
src/applications/disability-benefits/686c-674-v2/config/form.js on lines 405..416
src/applications/disability-benefits/686c-674-v2/config/form.js on lines 417..428
src/applications/disability-benefits/686c-674-v2/config/form.js on lines 429..441
src/applications/disability-benefits/686c-674-v2/config/form.js on lines 442..453

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/my-education-benefits/helpers.js 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 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
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 10 locations. Consider refactoring.
Open

        spouseMarriageHistoryDetailsPartThree: {
          depends: formData =>
            isChapterFieldRequired(formData, TASK_KEYS.addSpouse) &&
            formData?.spouseWasMarriedBefore,
          title:
src/applications/disability-benefits/686c-674-v2/config/form.js on lines 299..311
src/applications/disability-benefits/686c-674-v2/config/form.js on lines 312..324
src/applications/disability-benefits/686c-674-v2/config/form.js on lines 338..350
src/applications/disability-benefits/686c-674-v2/config/form.js on lines 351..363
src/applications/disability-benefits/686c-674-v2/config/form.js on lines 393..404
src/applications/disability-benefits/686c-674-v2/config/form.js on lines 405..416
src/applications/disability-benefits/686c-674-v2/config/form.js on lines 417..428
src/applications/disability-benefits/686c-674-v2/config/form.js on lines 429..441
src/applications/disability-benefits/686c-674-v2/config/form.js on lines 442..453

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

        spouseMarriageHistoryDetails: {
          depends: formData =>
            isChapterFieldRequired(formData, TASK_KEYS.addSpouse) &&
            formData?.spouseWasMarriedBefore,
          title:
src/applications/disability-benefits/686c-674-v2/config/form.js on lines 312..324
src/applications/disability-benefits/686c-674-v2/config/form.js on lines 325..337
src/applications/disability-benefits/686c-674-v2/config/form.js on lines 338..350
src/applications/disability-benefits/686c-674-v2/config/form.js on lines 351..363
src/applications/disability-benefits/686c-674-v2/config/form.js on lines 393..404
src/applications/disability-benefits/686c-674-v2/config/form.js on lines 405..416
src/applications/disability-benefits/686c-674-v2/config/form.js on lines 417..428
src/applications/disability-benefits/686c-674-v2/config/form.js on lines 429..441
src/applications/disability-benefits/686c-674-v2/config/form.js on lines 442..453

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

Severity
Category
Status
Source
Language