department-of-veterans-affairs/vets-website

View on GitHub

Showing 12,675 of 12,675 total issues

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

  render() {
    const {
      enableShortWorkflow,
      errorSchema,
      formContext,
Severity: Major
Found in src/applications/lgy/coe/form/config/chapters/documents/FileField.jsx - About 1 day to fix

    File index.jsx has 617 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    import React from 'react';
    import { APP_URLS, LAST_YEAR } from '../../utils/constants';
    
    /** CHAPTER 1: Veteran Information */
    export const BirthInfoDescription = (
    Severity: Major
    Found in src/applications/hca/components/FormDescriptions/index.jsx - About 1 day to fix

      Function AttachmentsList has 269 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      const AttachmentsList = props => {
        const {
          attachments,
          compose,
          draftSequence,
      Severity: Major
      Found in src/applications/mhv-secure-messaging/components/AttachmentsList.jsx - About 1 day to fix

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

        export const parsePhoneNumber = phone => {
          if (!phone) {
            return { contact: null, extension: null };
          }
          let sanitizedNumber = phone
        src/applications/representative-search/utils/phoneNumbers.js on lines 15..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 250.

        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 uiSchema = {
          stepChildren: {
            'ui:options': {
              itemName: 'Stepchild',
              viewField: StepchildInfo,
        src/applications/disability-benefits/686c-674-v2/config/chapters/stepchild-no-longer-part-of-household/stepchildren/stepchildren.js on lines 11..76

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

        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 parsePhoneNumber = phone => {
          if (!phone) {
            return { contact: null, extension: null };
          }
          let sanitizedNumber = phone
        Severity: Major
        Found in src/applications/representative-search/utils/phoneNumbers.js and 1 other location - About 1 day to fix
        src/applications/static-pages/representative-status/utilities/phoneNumbers.js on lines 15..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 250.

        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 uiSchema = {
          stepChildren: {
            'ui:options': {
              itemName: 'Stepchild',
              viewField: StepchildInfo,
        src/applications/disability-benefits/686c-674/config/chapters/stepchild-no-longer-part-of-household/stepchildren/stepchildren.js on lines 11..76

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

        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 getPhone = formData => {
          const data = formData || {};
          const { veteran = {} } = data;
          const primary = data[PRIMARY_PHONE] || '';
          // we shouldn't ever get to this point without a home or mobile phone
        Severity: Major
        Found in src/applications/appeals/995/utils/submit.js and 1 other location - About 1 day to fix
        src/applications/appeals/testing/sc/utils/submit.js on lines 108..132

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

        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 getPhone = formData => {
          const data = formData || {};
          const { veteran = {} } = data;
          const primary = data[PRIMARY_PHONE] || '';
          // we shouldn't ever get to this point without a home or mobile phone
        Severity: Major
        Found in src/applications/appeals/testing/sc/utils/submit.js and 1 other location - About 1 day to fix
        src/applications/appeals/995/utils/submit.js on lines 108..132

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

        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 verifyDependents(state = initialState, action) {
          switch (action.type) {
            case DEPENDENCY_VERIFICATION_CALL_SUCCESS:
              return {
                ...state,
        src/applications/static-pages/dependency-verification/reducers/index.js on lines 19..67

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

        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 verifyDependents(state = initialState, action) {
          switch (action.type) {
            case DEPENDENCY_VERIFICATION_CALL_SUCCESS:
              return {
                ...state,
        src/applications/personalization/view-dependents/reducers/dependencyVerification.js on lines 24..72

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

        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 inputProps = {
            ...(props.schema.minValue && { min: props.schema.minValue }),
            ...(props.schema.maxValue && { max: props.schema.maxValue }),
            autoComplete: props.options.autocomplete,
            type: inputType,
        src/platform/forms-system/src/js/widgets/TextWidget.jsx on lines 22..38

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

        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 inputProps = {
            ...(props.schema.minValue && { min: props.schema.minValue }),
            ...(props.schema.maxValue && { max: props.schema.maxValue }),
            autoComplete: props.options.autocomplete,
            type: inputType,
        Severity: Major
        Found in src/platform/forms-system/src/js/widgets/TextWidget.jsx and 1 other location - About 1 day to fix
        src/platform/user/profile/vap-svc/components/OtherTextField.jsx on lines 22..38

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

        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 613 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/platform/forms-system/src/js/fields/FileField.jsx - About 1 day to fix

          File FacilitiesMap.jsx has 613 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          import React, { useEffect, useRef, useState } from 'react';
          import { connect } from 'react-redux';
          import appendQuery from 'append-query';
          import mapboxgl from 'mapbox-gl';
          import 'mapbox-gl/dist/mapbox-gl.css';
          Severity: Major
          Found in src/applications/facility-locator/containers/FacilitiesMap.jsx - About 1 day to fix

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

              render() {
                const {
                  uiSchema,
                  errorSchema,
                  idSchema,
            Severity: Major
            Found in src/applications/pre-need-integration/components/DeceasedPersons.jsx - About 1 day to fix

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

                  function userOffsets() {
                      var startYear = new Date().getFullYear() - 2,
                          last = new OffsetAt(new Date(startYear, 0, 1)),
                          offsets = [last],
                          change, next, i;
              Severity: Major
              Found in src/applications/vaos/lib/moment-tz.js and 1 other location - About 1 day to fix
              src/applications/personalization/dashboard/lib/moment-tz.js on lines 278..302

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

              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 getAddress = formData => {
                const { veteran = {} } = formData || {};
                const truncate = (value, max) =>
                  replaceSubmittedData(veteran.address?.[value] || '').substring(0, max);
                // user profile provides "Iso2", whereas Lighthouse wants "ISO2"
              Severity: Major
              Found in src/applications/appeals/testing/sc/utils/submit.js and 1 other location - About 1 day to fix
              src/applications/appeals/995/utils/submit.js on lines 66..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 248.

              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 userOffsets() {
                  var startYear = new Date().getFullYear() - 2,
                    last = new OffsetAt(new Date(startYear, 0, 1)),
                    offsets = [last],
                    change,
              Severity: Major
              Found in src/applications/personalization/dashboard/lib/moment-tz.js and 1 other location - About 1 day to fix
              src/applications/vaos/lib/moment-tz.js on lines 266..288

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

              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 getAddress = formData => {
                const { veteran = {} } = formData || {};
                const truncate = (value, max) =>
                  replaceSubmittedData(veteran.address?.[value] || '').substring(0, max);
                // user profile provides "Iso2", whereas Lighthouse wants "ISO2"
              Severity: Major
              Found in src/applications/appeals/995/utils/submit.js and 1 other location - About 1 day to fix
              src/applications/appeals/testing/sc/utils/submit.js on lines 66..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 248.

              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