department-of-veterans-affairs/vets-website

View on GitHub
src/applications/disability-benefits/2346/schemas/address-schema.js

Summary

Maintainability
F
4 days
Test Coverage

Function addressUISchema has 274 lines of code (exceeds 25 allowed). Consider refactoring.
Open

export const addressUISchema = (
  isMilitaryBaseAddress = false,
  path,
  callback,
) => {
Severity: Major
Found in src/applications/disability-benefits/2346/schemas/address-schema.js - About 1 day to fix

    File address-schema.js has 551 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    /**
     * The intent for this module is to provide a flexible, reusable address schema and widget that can be used in any form throughout VA.gov.
     * The address uiSchema should be flexible enough to handle these cases:
     * 1. Top level address property (schema.properties.address)
     * 2. Nested address property (schema.properties.someProperty.properties.address)
    Severity: Major
    Found in src/applications/disability-benefits/2346/schemas/address-schema.js - About 1 day to fix

      Function addressUISchema has a Cognitive Complexity of 39 (exceeds 5 allowed). Consider refactoring.
      Open

      export const addressUISchema = (
        isMilitaryBaseAddress = false,
        path,
        callback,
      ) => {
      Severity: Minor
      Found in src/applications/disability-benefits/2346/schemas/address-schema.js - About 5 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

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

              hideIf: (formData, index) => {
                let countryNamePath = `${path}.country`;
                if (typeof index === 'number') {
                  countryNamePath = insertArrayIndex(countryNamePath, index);
                }
      src/applications/disability-benefits/2346/schemas/address-schema.js on lines 592..603

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

      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

              hideIf: (formData, index) => {
                let countryNamePath = `${path}.country`;
                if (typeof index === 'number') {
                  countryNamePath = insertArrayIndex(countryNamePath, index);
                }
      src/applications/disability-benefits/2346/schemas/address-schema.js on lines 522..533

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

      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

            <p>
              If you want to change your address for other VA benefits and services,
              <a href="https://va.gov/profile" className="vads-u-margin-left--0p5">
                go to your VA.gov profile
              </a>
      src/applications/combined-debt-portal/medical-copays/components/Modals.jsx on lines 181..202
      src/applications/combined-debt-portal/medical-copays/components/Modals.jsx on lines 221..234

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

      const MilitaryBaseInfo = () => (
        <div className="vads-u-padding-x--2p5">
          <va-additional-info trigger="Learn more about military base addresses">
            <span>
              The United States is automatically chosen as your country if you live on
      src/applications/ask-va/config/chapters/personalInformation/veteransPostalCode.js on lines 14..23
      src/applications/ask-va/config/chapters/personalInformation/yourMailingAddress.js on lines 11..20
      src/applications/ask-va/config/chapters/personalInformation/yourPostalCode.js on lines 14..23
      src/applications/ask-va/config/helpers.jsx on lines 223..232
      src/applications/disability-benefits/686c-674/config/address-schema.js on lines 62..72

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 57.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      There are no issues that match your filters.

      Category
      Status