department-of-veterans-affairs/vets-website

View on GitHub
src/applications/686c-674/config/helpers.js

Summary

Maintainability
F
5 days
Test Coverage

File helpers.js has 268 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import React from 'react';
import { CONTACTS } from '@department-of-veterans-affairs/component-library/contacts';
import constants from 'vets-json-schema/dist/constants.json';

export const isChapterFieldRequired = (formData, option) =>
Severity: Minor
Found in src/applications/686c-674/config/helpers.js - About 2 hrs to fix

    Function isInsideListLoopReturn has 39 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    export const isInsideListLoopReturn = (
      chapter,
      outerField,
      uiTitle,
      formChapter,
    Severity: Minor
    Found in src/applications/686c-674/config/helpers.js - About 1 hr to fix

      Function isOutsideListLoopReturn has 38 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      export const isOutsideListLoopReturn = (
        chapter,
        outerField,
        uiTitle,
        formChapter,
      Severity: Minor
      Found in src/applications/686c-674/config/helpers.js - About 1 hr to fix

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

        export const isInsideListLoopReturn = (
          chapter,
          outerField,
          uiTitle,
          formChapter,
        Severity: Major
        Found in src/applications/686c-674/config/helpers.js and 1 other location - About 1 day to fix
        src/applications/disability-benefits/686c-674/config/helpers.js on lines 62..110

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

        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 const isOutsideListLoopReturn = (
          chapter,
          outerField,
          uiTitle,
          formChapter,
        Severity: Major
        Found in src/applications/686c-674/config/helpers.js and 1 other location - About 1 day to fix
        src/applications/disability-benefits/686c-674/config/helpers.js on lines 112..159

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

        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 ServerErrorAlert = (
          <>
            <h2
              slot="headline"
              className="vads-u-font-size--h3 vads-u-margin-y--0 vads-u-font-size--lg"
        Severity: Major
        Found in src/applications/686c-674/config/helpers.js and 3 other locations - About 4 hrs to fix
        src/applications/disability-benefits/686c-674/config/helpers.js on lines 41..60
        src/applications/personalization/view-dependents/layouts/helpers.jsx on lines 4..20
        src/applications/disability-benefits/view-payments/utils.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 120.

        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

        export const VaFileNumberMissingAlert = (
          <>
            <h2
              slot="headline"
              className="vads-u-font-size--h3 vads-u-margin-y--0 vads-u-font-size--lg"
        Severity: Major
        Found in src/applications/686c-674/config/helpers.js and 1 other location - About 2 hrs to fix
        src/applications/disability-benefits/686c-674/config/helpers.js on lines 21..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 88.

        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

        export const VerifiedAlert = (
          <div>
            <div className="usa-alert usa-alert-info schemaform-sip-alert">
              <div className="usa-alert-body">
                <strong>Note:</strong> Since you’re signed in to your account and your
        Severity: Major
        Found in src/applications/686c-674/config/helpers.js and 1 other location - About 2 hrs to fix
        src/applications/disability-benefits/686c-674/config/helpers.js on lines 7..19

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

        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 hoursPerWeekUiSchema = {
          'ui:title': 'Hours a week',
          'ui:options': {
            widgetClassNames: 'form-select-medium',
          },
        Severity: Major
        Found in src/applications/686c-674/config/helpers.js and 3 other locations - About 1 hr to fix
        src/applications/686c-674/config/helpers.js on lines 185..198
        src/applications/disability-benefits/686c-674/config/helpers.js on lines 161..174
        src/applications/disability-benefits/686c-674/config/helpers.js on lines 176..189

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

        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 classesPerWeekUiSchema = {
          'ui:title': 'Number of sessions a week',
          'ui:options': {
            widgetClassNames: 'form-select-medium',
          },
        Severity: Major
        Found in src/applications/686c-674/config/helpers.js and 3 other locations - About 1 hr to fix
        src/applications/686c-674/config/helpers.js on lines 170..183
        src/applications/disability-benefits/686c-674/config/helpers.js on lines 161..174
        src/applications/disability-benefits/686c-674/config/helpers.js on lines 176..189

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

        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

        export const PensionIncomeRemovalQuestionTitle = (
          <p>
            Did this dependent earn an income in the last 365 days? Answer this question{' '}
            <strong>only</strong> if you are removing this dependent from your{' '}
            <strong>pension</strong>.
        Severity: Major
        Found in src/applications/686c-674/config/helpers.js and 1 other location - About 1 hr to fix
        src/applications/disability-benefits/686c-674/config/helpers.js on lines 191..197

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

        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