department-of-veterans-affairs/vets-website

View on GitHub

Showing 12,800 of 12,800 total issues

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

  it('should not render new layout when feature flag is true and widget type is get_medical_records_page', () => {
    const wrapper = shallow(
      <CernerCallToAction
        featureStaticLandingPage
        widgetType={widgetTypes.GET_MEDICAL_RECORDS_PAGE}
src/applications/static-pages/health-care-manage-benefits/components/CernerCallToAction/index.unit.spec.js on lines 60..79
src/applications/static-pages/health-care-manage-benefits/components/CernerCallToAction/index.unit.spec.js on lines 104..125
src/applications/static-pages/health-care-manage-benefits/components/CernerCallToAction/index.unit.spec.js on lines 127..148
src/applications/static-pages/health-care-manage-benefits/components/CernerCallToAction/index.unit.spec.js on lines 173..194

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

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

export const getVitals = (isCurrent = false) => async dispatch => {
  dispatch({
    type: Actions.Vitals.UPDATE_LIST_STATE,
    payload: Constants.loadStates.FETCHING,
  });
Severity: Major
Found in src/applications/mhv-medical-records/actions/vitals.js and 4 other locations - About 5 hrs to fix
src/applications/mhv-medical-records/actions/allergies.js on lines 8..24
src/applications/mhv-medical-records/actions/careSummariesAndNotes.js on lines 8..26
src/applications/mhv-medical-records/actions/conditions.js on lines 8..24
src/applications/mhv-medical-records/actions/vaccines.js on lines 8..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 136.

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

export const getAllergiesList = (isCurrent = false) => async dispatch => {
  dispatch({
    type: Actions.Allergies.UPDATE_LIST_STATE,
    payload: Constants.loadStates.FETCHING,
  });
Severity: Major
Found in src/applications/mhv-medical-records/actions/allergies.js and 4 other locations - About 5 hrs to fix
src/applications/mhv-medical-records/actions/careSummariesAndNotes.js on lines 8..26
src/applications/mhv-medical-records/actions/conditions.js on lines 8..24
src/applications/mhv-medical-records/actions/vaccines.js on lines 8..25
src/applications/mhv-medical-records/actions/vitals.js on lines 8..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 136.

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/_mock-form-ae-design-patterns/patterns/pattern1/TaskPurple/IntroductionPage.jsx on lines 143..158

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

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 default {
  uiSchema: {
    additionalDocuments: {
      ...fileUploadUi(evidenceOtherText),
      'ui:description': UploadDescription,
Severity: Major
Found in src/applications/appeals/testing/sc/pages/evidenceUpload.js and 1 other location - About 5 hrs to fix
src/applications/appeals/995/pages/evidenceUpload.js on lines 8..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 136.

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 default {
  uiSchema: {
    ...titleUI(content['household-spouse-information-title']),
    spouseFullName: fullNameUI(
      title => `${content['household-spouse-name-prefix']} ${title}`,
src/applications/ezr/config/chapters/householdInformation/spousePersonalInformation.js on lines 14..42

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

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/10182/containers/IntroductionPage.jsx on lines 140..155

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

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 default {
  uiSchema: {
    additionalDocuments: {
      ...fileUploadUi(evidenceOtherText),
      'ui:description': UploadDescription,
Severity: Major
Found in src/applications/appeals/995/pages/evidenceUpload.js and 1 other location - About 5 hrs to fix
src/applications/appeals/testing/sc/pages/evidenceUpload.js on lines 8..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 136.

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 default {
  uiSchema: {
    ...titleUI(content['household-spouse-information-title']),
    spouseFullName: fullNameUI(
      title => `${content['household-spouse-name-prefix']} ${title}`,
src/applications/_mock-form-ae-design-patterns/patterns/pattern1/ezr/config/chapters/householdInformation/spousePersonalInformation.js on lines 14..42

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

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 PaymentsError = () => {
  const { useToggleValue, TOGGLE_NAMES } = useFeatureToggle();

  // status will be 'warning' if toggle is on
  const status = useToggleValue(TOGGLE_NAMES.myVaUpdateErrorsWarnings)
src/applications/personalization/dashboard/components/debts/Debts.jsx on lines 26..47

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

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

            <ul>
              <li>
                <va-link
                  href="https://search.usa.gov/search?affiliate=bvadecisions"
                  text="Look up Board of Veterans' Appeals (BVA) decisions"
Severity: Major
Found in src/applications/search/containers/SearchApp.jsx and 1 other location - About 5 hrs to fix
src/applications/pensions/components/IntroductionPage.jsx on lines 93..129

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

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

              <ul>
                <li>
                  Examination for Housebound Status or Permanent Need for
                  Regular Aid and Attendance (
                  <va-link
Severity: Major
Found in src/applications/pensions/components/IntroductionPage.jsx and 1 other location - About 5 hrs to fix
src/applications/search/containers/SearchApp.jsx on lines 794..816

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

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 OutstandingDebtsError = () => {
  const { useToggleValue, TOGGLE_NAMES } = useFeatureToggle();

  // status will be 'warning' if toggle is on
  const status = useToggleValue(TOGGLE_NAMES.myVaUpdateErrorsWarnings)
src/applications/personalization/dashboard/components/benefit-payments/BenefitPayments.jsx on lines 68..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 136.

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 377 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import environment from '@department-of-veterans-affairs/platform-utilities/environment';
import footerContent from '~/platform/forms/components/FormFooter';
import manifest from '../manifest.json';
import transform from './submit-transformer';
import getHelp from '../../shared/components/GetFormHelp';
Severity: Minor
Found in src/applications/simple-forms/21-4138/config/form.js - About 5 hrs to fix

    File ReviewCollapsibleChapter.jsx has 377 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    import get from '@department-of-veterans-affairs/platform-forms-system/get';
    import set from '@department-of-veterans-affairs/platform-forms-system/set';
    import { getScrollOptions } from '@department-of-veterans-affairs/platform-utilities/ui';
    import classNames from 'classnames';
    import uniqueId from 'lodash/uniqueId';
    Severity: Minor
    Found in src/applications/ask-va/components/ReviewCollapsibleChapter.jsx - About 5 hrs to fix

      Function AppointmentMessage has 126 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      const AppointmentMessage = props => {
        const { appointment, page } = props;
        const { t } = useTranslation();
      
        const defaultMessage = t(

        Function createFormConfig781a has 126 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        export function createFormConfig781a(iterations) {
          let configObj = {};
          const formType = '781a';
          for (let index = 0; index < iterations; index++) {
            configObj = {
        Severity: Major
        Found in src/applications/disability-benefits/all-claims/config/781/index.js - About 5 hrs to fix

          Function renderExtensionBeneficiaryZIP has 126 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            const renderExtensionBeneficiaryZIP = () => {
              if (!displayedInputs.beneficiaryLocationQuestion) {
                return null;
              }
              const extensions = getExtensions();
          Severity: Major
          Found in src/applications/gi/components/profile/CalculateYourBenefitsForm.jsx - About 5 hrs to fix

            File VitalDetails.jsx has 376 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            import React, { useEffect, useState, useRef, useMemo } from 'react';
            import PropTypes from 'prop-types';
            import { useDispatch, useSelector } from 'react-redux';
            import { useParams } from 'react-router-dom';
            import { chunk } from 'lodash';
            Severity: Minor
            Found in src/applications/mhv-medical-records/containers/VitalDetails.jsx - About 5 hrs to fix

              Function prefillTransformerV4 has 125 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              export function prefillTransformerV4(pages, formData, metadata, state) {
                const bankInformation = state.data?.bankInformation || {};
                const claimant = state.data?.formData?.data?.attributes?.claimant || {};
                const serviceData = state.data?.formData?.data?.attributes?.serviceData || [];
                const contactInfo = claimant?.contactInfo || {};
              Severity: Major
              Found in src/applications/my-education-benefits/helpers.js - About 5 hrs to fix
                Severity
                Category
                Status
                Source
                Language