department-of-veterans-affairs/vets-website

View on GitHub

Showing 12,811 of 12,811 total issues

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

export function getInsuranceSrLabel(formData) {
  const {
    insuranceName,
    'view:policyOrGroup': { insurancePolicyNumber, insuranceGroupCode },
  } = formData;
Severity: Major
Found in src/applications/ezr/utils/helpers/insurance.js and 1 other location - About 5 hrs to fix
src/applications/_mock-form-ae-design-patterns/utils/helpers/insurance.js on lines 10..26

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

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 function getInsuranceSrLabel(formData) {
  const {
    insuranceName,
    'view:policyOrGroup': { insurancePolicyNumber, insuranceGroupCode },
  } = formData;
src/applications/ezr/utils/helpers/insurance.js on lines 10..26

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

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

    {
      id: '1',
      type: 'inquiry',
      attributes: {
        inquiryNumber: 'A-20240917-306466',
Severity: Major
Found in src/applications/ask-va/utils/mockData.js and 2 other locations - About 5 hrs to fix
src/applications/ask-va/utils/mockData.js on lines 1818..1854
src/applications/ask-va/utils/mockData.js on lines 2014..2050

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

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

    {
      id: '1',
      type: 'inquiry',
      attributes: {
        inquiryNumber: 'A-20240917-306466',
Severity: Major
Found in src/applications/ask-va/utils/mockData.js and 2 other locations - About 5 hrs to fix
src/applications/ask-va/utils/mockData.js on lines 1567..1603
src/applications/ask-va/utils/mockData.js on lines 2014..2050

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

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

    {
      id: '5',
      type: 'inquiry',
      attributes: {
        inquiryNumber: 'A-20240917-306466',
Severity: Major
Found in src/applications/ask-va/utils/mockData.js and 2 other locations - About 5 hrs to fix
src/applications/ask-va/utils/mockData.js on lines 1567..1603
src/applications/ask-va/utils/mockData.js on lines 1818..1854

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

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

    fn.tz = function (name, keepTime) {
        if (name) {
            if (typeof name !== 'string') {
                throw new Error('Time zone name must be a string, got ' + name + ' [' + typeof name + ']');
            }
Severity: Major
Found in src/applications/vaos/lib/moment-tz.js and 1 other location - About 5 hrs to fix
src/applications/personalization/dashboard/lib/moment-tz.js on lines 596..622

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

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

const initializeRealUserMonitoring = () => {
  // Prevent RUM from re-initializing the SDK OR running on local/CI environments.
  if (
    !environment.BASE_URL.includes('localhost') &&
    !window.DD_RUM?.getInitConfiguration()
Severity: Major
Found in src/applications/caregivers/hooks/useBrowserMonitoring.jsx and 1 other location - About 5 hrs to fix
src/applications/ezr/hooks/useBrowserMonitoring.jsx on lines 8..32

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

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

const initializeRealUserMonitoring = () => {
  // Prevent RUM from re-initializing the SDK OR running on local/CI environments.
  if (
    !environment.BASE_URL.includes('localhost') &&
    !window.DD_RUM?.getInitConfiguration()
Severity: Major
Found in src/applications/ezr/hooks/useBrowserMonitoring.jsx and 1 other location - About 5 hrs to fix
src/applications/caregivers/hooks/useBrowserMonitoring.jsx on lines 8..32

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

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

  fn.tz = function(name, keepTime) {
    if (name) {
      if (typeof name !== 'string') {
        throw new Error(
          'Time zone name must be a string, got ' +
Severity: Major
Found in src/applications/personalization/dashboard/lib/moment-tz.js and 1 other location - About 5 hrs to fix
src/applications/vaos/lib/moment-tz.js on lines 561..575

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

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

Function DependentInformation has 137 lines of code (exceeds 25 allowed). Consider refactoring.
Open

const DependentInformation = props => {
  const { data, goToPath, setFormData } = props;

  const { dependents = [] } = data;
  const search = new URLSearchParams(window.location.search);
Severity: Major
Found in src/applications/ezr/components/FormPages/DependentInformation.jsx - About 5 hrs to fix

    Function DependentInformation has 137 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    const DependentInformation = props => {
      const { data, goToPath, setFormData } = props;
    
      const { dependents = [] } = data;
      const search = new URLSearchParams(window.location.search);

      File dependentChildrenPages.js has 395 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      import merge from 'lodash/merge';
      import get from 'platform/utilities/data/get';
      
      import {
        arrayBuilderItemFirstPageTitleUI,

        Function EmploymentQuestion has 137 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        const EmploymentQuestion = props => {
          const {
            data,
            goBack,
            goToPath,

          Function ChemHemDetails has 137 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          const ChemHemDetails = props => {
            const { record, fullState, runningUnitTest } = props;
            const user = useSelector(state => state.user.profile);
            const allowTxtDownloads = useSelector(
              state =>

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

            export function parseResponse({ data }) {
              const { name } = data.attributes;
              const focusFileCard = () => {
                const target = $$('.schemaform-file-list li').find(entry =>
                  entry.textContent?.trim().includes(name),
            Severity: Major
            Found in src/applications/pre-need/utils/helpers.js and 3 other locations - About 5 hrs to fix
            src/applications/pre-need-integration/utils/helpers.js on lines 218..238
            src/applications/simple-forms/20-10207/helpers.js on lines 140..160
            src/applications/simple-forms/40-0247/helpers.js on lines 59..79

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

            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 parseResponse({ data }) {
              const { name } = data.attributes;
              const focusFileCard = () => {
                const target = $$('.schemaform-file-list li').find(entry =>
                  entry.textContent?.trim().includes(name),
            Severity: Major
            Found in src/applications/simple-forms/20-10207/helpers.js and 3 other locations - About 5 hrs to fix
            src/applications/pre-need-integration/utils/helpers.js on lines 218..238
            src/applications/pre-need/utils/helpers.js on lines 40..60
            src/applications/simple-forms/40-0247/helpers.js on lines 59..79

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

            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 parseResponse({ data }) {
              const { name } = data.attributes;
              const focusFileCard = () => {
                const target = $$('.schemaform-file-list li').find(entry =>
                  entry.textContent?.trim().includes(name),
            Severity: Major
            Found in src/applications/pre-need-integration/utils/helpers.js and 3 other locations - About 5 hrs to fix
            src/applications/pre-need/utils/helpers.js on lines 40..60
            src/applications/simple-forms/20-10207/helpers.js on lines 140..160
            src/applications/simple-forms/40-0247/helpers.js on lines 59..79

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

            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 parseResponse({ data }) {
              const { name } = data.attributes;
              const focusFileCard = () => {
                const target = $$('.schemaform-file-list li').find(entry =>
                  entry.textContent?.trim().includes(name),
            Severity: Major
            Found in src/applications/simple-forms/40-0247/helpers.js and 3 other locations - About 5 hrs to fix
            src/applications/pre-need-integration/utils/helpers.js on lines 218..238
            src/applications/pre-need/utils/helpers.js on lines 40..60
            src/applications/simple-forms/20-10207/helpers.js on lines 140..160

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

            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

            export const DependentNameHeader = ({ formData }) => {
              const { first, last } = formData.fullName;
              return (
                <div>
                  <p className="vads-u-font-weight--bold vads-u-font-size--h3 vads-u-border-bottom--2px vads-u-border-color--primary vads-u-font-family--serif">
            src/applications/disability-benefits/686c-674-v2/config/chapters/add-a-child/helpers.jsx on lines 3..14
            src/applications/disability-benefits/686c-674-v2/config/chapters/report-dependent-death/dependent-additional-information/helpers.js on lines 3..14
            src/applications/disability-benefits/686c-674/config/chapters/add-a-child/helpers.jsx on lines 3..14

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

            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

            export const ChildNameHeader = ({ formData }) => {
              const { first, last } = formData.fullName;
              return (
                <div>
                  <p className="vads-u-font-weight--bold vads-u-font-size--h3 vads-u-border-bottom--2px vads-u-border-color--primary vads-u-font-family--serif">
            src/applications/disability-benefits/686c-674-v2/config/chapters/report-dependent-death/dependent-additional-information/helpers.js on lines 3..14
            src/applications/disability-benefits/686c-674/config/chapters/add-a-child/helpers.jsx on lines 3..14
            src/applications/disability-benefits/686c-674/config/chapters/report-dependent-death/dependent-additional-information/helpers.js on lines 3..14

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

            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