department-of-veterans-affairs/vets-website

View on GitHub
src/applications/personalization/dashboard/components/claims-and-appeals/Decision.jsx

Summary

Maintainability
D
2 days
Test Coverage

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

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

  return (
    <div>
      <div className="decision-items">
        {allowedBlock}
        {allowedBlock &&
src/applications/claims-status/components/appeals-v2/Decision.jsx on lines 75..99

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

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

  if (allowedIssues.length) {
    allowedBlock = (
      <div data-testid="allowed-items">
        <h5 className="allowed-items">Granted</h5>
        <p>
src/applications/personalization/dashboard/components/claims-and-appeals/Decision.jsx on lines 40..51

Duplicated Code

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

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

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

Tuning

This issue has a mass of 102.

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

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

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

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

Refactorings

Further Reading

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

  if (deniedIssues.length) {
    deniedBlock = (
      <div data-testid="denied-items">
        <h5 className="denied-items">Denied</h5>
        <p>
src/applications/personalization/dashboard/components/claims-and-appeals/Decision.jsx on lines 28..39

Duplicated Code

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

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

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

Tuning

This issue has a mass of 102.

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

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

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

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

Refactorings

Further Reading

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

  const allowedIssues = issues
    .filter(issue => issue.disposition === 'allowed')
    .map((issue, i) => <li key={`allowed-${i}`}>{issue.description}</li>);
src/applications/claims-status/components/appeals-v2/Decision.jsx on lines 7..9
src/applications/claims-status/components/appeals-v2/Decision.jsx on lines 10..12
src/applications/claims-status/components/appeals-v2/Decision.jsx on lines 13..15
src/applications/personalization/dashboard/components/claims-and-appeals/Decision.jsx on lines 10..12
src/applications/personalization/dashboard/components/claims-and-appeals/Decision.jsx on lines 13..15

Duplicated Code

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

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

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

Tuning

This issue has a mass of 73.

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

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

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

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

Refactorings

Further Reading

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

  const deniedIssues = issues
    .filter(issue => issue.disposition === 'denied')
    .map((issue, i) => <li key={`denied-${i}`}>{issue.description}</li>);
src/applications/claims-status/components/appeals-v2/Decision.jsx on lines 7..9
src/applications/claims-status/components/appeals-v2/Decision.jsx on lines 10..12
src/applications/claims-status/components/appeals-v2/Decision.jsx on lines 13..15
src/applications/personalization/dashboard/components/claims-and-appeals/Decision.jsx on lines 7..9
src/applications/personalization/dashboard/components/claims-and-appeals/Decision.jsx on lines 13..15

Duplicated Code

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

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

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

Tuning

This issue has a mass of 73.

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

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

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

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

Refactorings

Further Reading

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

  const remandIssues = issues
    .filter(issue => issue.disposition === 'remand')
    .map((issue, i) => <li key={`remanded-${i}`}>{issue.description}</li>);
src/applications/claims-status/components/appeals-v2/Decision.jsx on lines 7..9
src/applications/claims-status/components/appeals-v2/Decision.jsx on lines 10..12
src/applications/claims-status/components/appeals-v2/Decision.jsx on lines 13..15
src/applications/personalization/dashboard/components/claims-and-appeals/Decision.jsx on lines 7..9
src/applications/personalization/dashboard/components/claims-and-appeals/Decision.jsx on lines 10..12

Duplicated Code

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

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

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

Tuning

This issue has a mass of 73.

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

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

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

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

Refactorings

Further Reading

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

  const pluralize = {
    allowed: allowedIssues.length > 1 ? 'issues' : 'issue',
    denied: deniedIssues.length > 1 ? 'issues' : 'issue',
    remand: remandIssues.length > 1 ? 'these issues' : 'this issue',
  };
src/applications/claims-status/components/appeals-v2/Decision.jsx on lines 17..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 65.

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

Decision.propTypes = {
  aoj: PropTypes.string.isRequired,
  issues: PropTypes.array.isRequired,
  ama: PropTypes.bool,
  boardDecision: PropTypes.bool,
src/applications/claims-status/components/ClaimCard/ClaimCardLink.jsx on lines 24..29
src/applications/claims-status/components/appeals-v2/Decision.jsx on lines 102..107
src/applications/financial-status-report/components/householdExpenses/CreditCardBillSummary.jsx on lines 147..152
src/applications/financial-status-report/components/householdExpenses/InstallmentContractSummary.jsx on lines 191..196
src/applications/personalization/profile/components/ProfileLink.jsx on lines 57..62
src/applications/personalization/profile/components/direct-deposit/vye/components/Buttons.jsx on lines 18..23
src/applications/post-911-gib-status/containers/Main.jsx on lines 49..54
src/applications/sco/components/HubRail/shared/liVaLinkAndVaTelephone.jsx on lines 21..26
src/applications/simple-forms/20-10207/containers/App.jsx on lines 43..48
src/applications/simple-forms/21-4138/containers/App.jsx on lines 34..39
src/applications/verify-your-enrollment/components/Buttons.jsx on lines 22..27
src/platform/site-wide/header/components/LogoRow/index.js on lines 92..97
src/applications/check-in/components/ListWrapper.jsx on lines 20..25

Duplicated Code

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

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

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

Tuning

This issue has a mass of 56.

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

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

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

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

Refactorings

Further Reading

There are no issues that match your filters.

Category
Status