department-of-veterans-affairs/vets-website

View on GitHub
src/applications/mhv-medications/components/PrescriptionDetails/NonVaPrescription.jsx

Summary

Maintainability
D
1 day
Test Coverage

Function NonVaPrescription has 96 lines of code (exceeds 25 allowed). Consider refactoring.
Open

const NonVaPrescription = prescription => {
  const content = () => {
    const status = prescription?.dispStatus?.toString();
    return (
      <div className="medication-details-div vads-u-border-top--1px vads-u-border-color--gray-lighter vads-u-margin-top--3 medium-screen:vads-u-margin-top--4 vads-u-margin-bottom--3">

    Function content has 93 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      const content = () => {
        const status = prescription?.dispStatus?.toString();
        return (
          <div className="medication-details-div vads-u-border-top--1px vads-u-border-color--gray-lighter vads-u-margin-top--3 medium-screen:vads-u-margin-top--4 vads-u-margin-bottom--3">
            <h2 className="vads-u-margin-top--3 medium-screen:vads-u-margin-top--4 vads-u-margin-bottom--2 no-print">

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

                      <li>
                        Non-VA medications include these types:
                        <ul>
                          <li>Prescriptions you filled through a non-VA pharmacy</li>
                          <li>
      src/applications/dhp-connected-devices/components/TermsAndConditions.jsx on lines 6..27
      src/applications/gi/components/content/modals/SizeOfInstitutionsModalContent.jsx on lines 22..33
      src/applications/static-pages/ezr-submission-options/components/Descriptions/index.jsx on lines 67..81

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

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

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

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

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

      Refactorings

      Further Reading

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

              <section>
                <h3 className="vads-u-font-size--base vads-u-font-family--sans">
                  Reason for use
                </h3>
                <p>{validateField(prescription.indicationForUse)}</p>
      src/applications/mhv-medications/components/PrescriptionDetails/NonVaPrescription.jsx on lines 52..57
      src/applications/mhv-medications/components/PrescriptionDetails/NonVaPrescription.jsx on lines 64..69
      src/applications/mhv-medications/components/PrescriptionDetails/NonVaPrescription.jsx on lines 82..87

      Duplicated Code

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

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

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

      Tuning

      This issue has a mass of 53.

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

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

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

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

      Refactorings

      Further Reading

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

              <section>
                <h3 className="vads-u-font-size--base vads-u-font-family--sans">
                  When you started taking this medication
                </h3>
                <p>{dateFormat(prescription.dispensedDate)}</p>
      src/applications/mhv-medications/components/PrescriptionDetails/NonVaPrescription.jsx on lines 52..57
      src/applications/mhv-medications/components/PrescriptionDetails/NonVaPrescription.jsx on lines 58..63
      src/applications/mhv-medications/components/PrescriptionDetails/NonVaPrescription.jsx on lines 82..87

      Duplicated Code

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

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

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

      Tuning

      This issue has a mass of 53.

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

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

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

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

      Refactorings

      Further Reading

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

              <section>
                <h3 className="vads-u-font-size--base vads-u-font-family--sans">
                  Instructions
                </h3>
                <p>{validateField(prescription.sig)}</p>
      src/applications/mhv-medications/components/PrescriptionDetails/NonVaPrescription.jsx on lines 58..63
      src/applications/mhv-medications/components/PrescriptionDetails/NonVaPrescription.jsx on lines 64..69
      src/applications/mhv-medications/components/PrescriptionDetails/NonVaPrescription.jsx on lines 82..87

      Duplicated Code

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

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

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

      Tuning

      This issue has a mass of 53.

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

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

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

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

      Refactorings

      Further Reading

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

              <section>
                <h3 className="vads-u-font-size--base vads-u-font-family--sans">
                  Documented at this facility
                </h3>
                <p>{validateField(prescription.facilityName)}</p>
      src/applications/mhv-medications/components/PrescriptionDetails/NonVaPrescription.jsx on lines 52..57
      src/applications/mhv-medications/components/PrescriptionDetails/NonVaPrescription.jsx on lines 58..63
      src/applications/mhv-medications/components/PrescriptionDetails/NonVaPrescription.jsx on lines 64..69

      Duplicated Code

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

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

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

      Tuning

      This issue has a mass of 53.

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

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

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

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

      Refactorings

      Further Reading

      There are no issues that match your filters.

      Category
      Status