department-of-veterans-affairs/vets-website

View on GitHub

Showing 12,675 of 12,675 total issues

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

const RecreationalVehiclesReview = ({ data, title }) => {
  const { assets } = data;
  const { recVehicleAmount } = assets;

  return (
src/applications/financial-status-report/components/otherAssets/RealEstateReview.jsx on lines 5..24

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

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 CompareLayout has a Cognitive Complexity of 46 (exceeds 5 allowed). Consider refactoring.
Open

const CompareLayout = ({
  calculated,
  estimated,
  institutions,
  showDifferences,
Severity: Minor
Found in src/applications/gi/containers/CompareLayout.jsx - About 7 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

Function getEventContent has 177 lines of code (exceeds 25 allowed). Consider refactoring.
Open

export function getEventContent(event) {
  switch (event.type) {
    case EVENT_TYPES.claimDecision:
      return {
        title: 'VA sent you a claim decision',
Severity: Major
Found in src/applications/claims-status/utils/appeals-v2-helpers.jsx - About 7 hrs to fix

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

        <VaCheckboxGroup
          label={content.issuesLabel}
          name="issues"
          onVaChange={handlers.onIssueChange}
          onBlur={handlers.onBlur}
    src/applications/appeals/995/components/EvidenceRecords.jsx on lines 89..114

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

    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

      missing: {
        location: (
          <span className="usa-input-error-message">Missing location name</span>
        ),
        facility: (
    src/applications/appeals/995/content/evidenceSummary.jsx on lines 69..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 176.

    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

          try {
            const response = await getMonthlyExpensesAPI(data);
    
            if (!response)
              throw new Error('No response from getMonthlyExpensesAPI');
    src/applications/financial-status-report/components/otherExpenses/OtherExpensesChecklist.jsx on lines 46..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 176.

    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

      missing: {
        location: (
          <span className="usa-input-error-message">Missing location name</span>
        ),
        facility: (
    Severity: Major
    Found in src/applications/appeals/995/content/evidenceSummary.jsx and 1 other location - About 7 hrs to fix
    src/applications/appeals/testing/sc/content/evidenceSummary.jsx on lines 70..100

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

    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

          try {
            const response = await getMonthlyExpensesAPI(data);
    
            if (!response)
              throw new Error('No response from getMonthlyExpensesAPI');
    src/applications/financial-status-report/components/otherExpenses/OtherExpensesSummary.jsx on lines 50..83

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

    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

        <VaCheckboxGroup
          label={content.issuesLabel}
          name="issues"
          onVaChange={handlers.onIssueChange}
          onBlur={handlers.onBlur}
    Severity: Major
    Found in src/applications/appeals/995/components/EvidenceRecords.jsx and 1 other location - About 7 hrs to fix
    src/applications/appeals/testing/sc/components/EvidenceRecords.jsx on lines 86..111

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

    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

    File form.js has 460 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    import React from 'react';
    import environment from '@department-of-veterans-affairs/platform-utilities/environment';
    import { externalServices } from 'platform/monitoring/DowntimeNotification';
    import get from 'platform/utilities/data/get';
    import manifest from '../manifest.json';
    Severity: Minor
    Found in src/applications/ivc-champva/10-7959C/config/form.js - About 7 hrs to fix

      Function AppointmentListItem has 176 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      const AppointmentListItem = props => {
        const { appointment, goToDetails, router, app, page, count } = props;
        const { t } = useTranslation();
        const selectFeatureToggles = useMemo(makeSelectFeatureToggles, []);
        const { isMedicationReviewContentEnabled } = useSelector(

        Function PreSubmitSection has 175 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        export function PreSubmitSection(props) {
          const {
            form,
            preSubmit = {},
            setPreSubmit,
        Severity: Major
        Found in src/platform/forms/components/review/PreSubmitSection.jsx - About 7 hrs to fix

          Function render has 175 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            render() {
              const { schema, uiSchema, path, pageTitle, formContext } = this.props;
          
              const uiOptions = uiSchema['ui:options'] || {};
              const fieldName = path[path.length - 1];
          Severity: Major
          Found in src/platform/forms-system/src/js/review/ArrayField.jsx - About 7 hrs to fix

            Function render has 175 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              render() {
                const { schema, uiSchema, path, pageTitle, formContext } = this.props;
            
                const uiOptions = uiSchema['ui:options'] || {};
                const fieldName = path[path.length - 1];
            Severity: Major
            Found in src/applications/ask-va/components/ArrayField.jsx - About 7 hrs to fix

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

              export function timeFromNow(date, userFromDate = null) {
                // Not using defaulting because we want today to be when this function
                // is called, not when the file is parsed and run
                const fromDate = userFromDate || moment();
                const dayDiff = date.diff(fromDate, 'days');
              Severity: Major
              Found in src/platform/forms-system/src/js/utilities/date/index.js and 1 other location - About 7 hrs to fix
              src/platform/utilities/date/index.js on lines 40..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 175.

              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

              IntroductionPage.propTypes = {
                location: PropTypes.shape({
                  basename: PropTypes.string,
                }),
                route: PropTypes.shape({
              src/applications/appeals/995/containers/IntroductionPage.jsx on lines 183..199

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

              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 saveBankInfo = () => {
                  // commented out until tied in with redu
                  const fields = {
                    phone: formData[`${prefix}phone`],
                    // phone2: formData[`${prefix}phone`],
              src/applications/personalization/profile/components/direct-deposit/vye/containers/ChangeOfDirectDepositWrapper.jsx on lines 48..62

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

              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 timeFromNow(date, userFromDate = null) {
                // Not using defaulting because we want today to be when this function
                // is called, not when the file is parsed and run
                const fromDate = userFromDate || moment();
                const dayDiff = date.diff(fromDate, 'days');
              Severity: Major
              Found in src/platform/utilities/date/index.js and 1 other location - About 7 hrs to fix
              src/platform/forms-system/src/js/utilities/date/index.js on lines 151..180

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

              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

                          if (
                            formData?.countryCodeIso3 === undefined ||
                            formData?.countryCodeIso3 === 'USA'
                          ) {
                            setAddressSchema(
              src/applications/personalization/profile/components/direct-deposit/vye/components/ChangeOfAddressForm.jsx on lines 206..272

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

              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 saveBankInfo = () => {
                  // commented out until tied in with redu
                  const fields = {
                    phone: formData[`${prefix}phone`],
                    // phone2: formData[`${prefix}phone`],
              src/applications/verify-your-enrollment/containers/ChangeOfDirectDepositWrapper.jsx on lines 47..61

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

              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