department-of-veterans-affairs/vets-website

View on GitHub

Showing 12,675 of 12,675 total issues

Function IntroductionPage has 259 lines of code (exceeds 25 allowed). Consider refactoring.
Open

const IntroductionPage = props => {
  const { route } = props;
  // WIP: need to keep unit-tests passing with these new selector-hooks
  const userLoggedIn = useSelector(state => isLoggedIn(state));
  const userIdVerified = useSelector(state => isLOA3(state));

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

    const moreAboutYourRelationshipToVeteranPage = {
      uiSchema: {
        moreAboutYourRelationshipToVeteran: radioUI({
          title: CHAPTER_3.MORE_ABOUT_YOUR_RELATIONSHIP_TO_VETERAN.TITLE,
          labelHeaderLevel: '3',
    src/applications/ask-va/config/chapters/personalInformation/relationshipToFamilyMember.js on lines 8..59

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

    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 aboutYourRelationshipToFamilyMemberPage = {
      uiSchema: {
        aboutYourRelationshipToFamilyMember: radioUI({
          title: CHAPTER_3.RELATIONSHIP_TO_FAM_MEM.TITLE,
          labelHeaderLevel: '3',
    src/applications/ask-va/config/chapters/personalInformation/moreAboutYourRelationshipToVeteran.js on lines 8..59

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

    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

    function CustomEmailField(props) {
      function handleChange(event) {
        if (props?.showMebEnhancements08) {
          if (props.email !== event) {
            props.setFormData({
    src/applications/toe/components/CustomEmailField.jsx on lines 10..46

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

    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

    function CustomEmailField(props) {
      function handleChange(event) {
        if (props?.toeDupContactInfoCall) {
          if (props.email !== event) {
            props.setFormData({
    Severity: Major
    Found in src/applications/toe/components/CustomEmailField.jsx and 1 other location - About 1 day to fix
    src/applications/my-education-benefits/components/CustomEmailField.jsx on lines 10..46

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

    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

    function mockPrescriptionArray(n = 20) {
      return [...Array(n)].map((_, i) => {
        const today = new Date();
        const someDate = sub(today, { days: i * 2 + 1 });
        const monthsAgo = sub(someDate, { months: 3 });
    src/applications/mhv-medications/mocks/api/mhv-api/prescriptions/index.js on lines 97..120

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

    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 compareAddressObjects(obj1, obj2) {
      const { hasOwnProperty } = Object.prototype;
    
      const keys1 = Object.keys(obj1);
      const keys2 = Object.keys(obj2);
    src/applications/verify-your-enrollment/helpers.jsx on lines 735..773

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

    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 compareAddressObjects(obj1, obj2) {
      const { hasOwnProperty } = Object.prototype;
    
      const keys1 = Object.keys(obj1);
      const keys2 = Object.keys(obj2);
    Severity: Major
    Found in src/applications/verify-your-enrollment/helpers.jsx and 1 other location - About 1 day to fix
    src/applications/personalization/profile/components/direct-deposit/vye/helper.js on lines 134..172

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

    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

    function mockPrescriptionArray(n = 20) {
      return [...Array(n)].map((_, i) => {
        const today = new Date();
        const someDate = sub(today, { days: i * 2 + 1 });
        const monthsAgo = sub(someDate, { months: 3 });
    src/platform/mhv/api/mocks/medications/prescriptions/index.js on lines 95..118

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

    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 Intention = ({
      formResponses,
      setIntention,
      router,
      viewedIntroPage,
    src/applications/discharge-wizard/components/v2/questions/DischargeType.jsx on lines 14..56

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

    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 DischargeType = ({
      formResponses,
      setDischargeType,
      router,
      viewedIntroPage,
    src/applications/discharge-wizard/components/v2/questions/Intention.jsx on lines 14..56

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

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

    /* eslint-disable jsx-a11y/no-noninteractive-element-to-interactive-role */
    /* Customized copy of Platform's FileField component
      * - Adds new optional prop `ariaLabelAdditionalText` to append additional
      *   text to the upload button's aria-label attribute.
    */
    Severity: Major
    Found in src/applications/simple-forms/40-0247/components/FileField.jsx - About 1 day to fix

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

      describe('hasTotalDisabilityServerError', () => {
        it('returns `true` when there is a 500 error in the Redux state', () => {
          const state = {
            totalRating: {
              loading: false,
      Severity: Major
      Found in src/applications/rated-disabilities/selectors.unit.spec.js and 1 other location - About 1 day to fix
      src/applications/rated-disabilities/selectors.unit.spec.js on lines 49..88

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

      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

      describe('hasTotalDisabilityClientError', () => {
        it('returns `false` when there is a 500 error in the Redux state', () => {
          const state = {
            totalRating: {
              loading: false,
      Severity: Major
      Found in src/applications/rated-disabilities/selectors.unit.spec.js and 1 other location - About 1 day to fix
      src/applications/rated-disabilities/selectors.unit.spec.js on lines 8..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 240.

      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 default function createDirectDepositPage() {
        const bankAccountProperties = {
          type: 'object',
          properties: {
            accountType: {
      Severity: Major
      Found in src/applications/edu-benefits/1990/pages/DirectDeposit.jsx and 1 other location - About 1 day to fix
      src/applications/edu-benefits/5490/content/directDepositUpdate.jsx on lines 17..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 240.

      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 default function createDirectDepositPageUpdate() {
        const bankAccountProperties = {
          type: 'object',
          properties: {
            accountType: {
      src/applications/edu-benefits/1990/pages/DirectDeposit.jsx on lines 17..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 240.

      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 FolderThreadListView has 256 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      const FolderThreadListView = props => {
        const { testing } = props;
        const dispatch = useDispatch();
        const error = null;
        const threadsPerPage = THREADS_PER_PAGE_DEFAULT;

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

        import merge from 'lodash/merge';
        import fullSchema from 'vets-json-schema/dist/FEEDBACK-TOOL-schema.json';
        import dateRangeUI from 'platform/forms-system/src/js/definitions/dateRange';
        import phoneUI from 'platform/forms-system/src/js/definitions/phone';
        import emailUI from 'platform/forms-system/src/js/definitions/email';
        Severity: Major
        Found in src/applications/edu-benefits/feedback-tool/config/form.js - About 1 day to fix

          File FileField.jsx has 592 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          /* eslint-disable jsx-a11y/no-noninteractive-element-to-interactive-role */
          import PropTypes from 'prop-types';
          import React, { useEffect, useState, useRef } from 'react';
          import { connect } from 'react-redux';
          import classNames from 'classnames';
          Severity: Major
          Found in src/applications/pre-need/components/FileField.jsx - About 1 day to fix

            Function FacilitySearch has 255 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            const FacilitySearch = props => {
              const { data: formData, goBack, goForward, goToPath } = props;
              const [query, setQuery] = useState('');
              const [submittedQuery, setSubmittedQuery] = useState('');
              const [loading, setLoading] = useState(false);
            Severity: Major
            Found in src/applications/caregivers/components/FormFields/FacilitySearch.jsx - About 1 day to fix
              Severity
              Category
              Status
              Source
              Language