department-of-veterans-affairs/vets-website

View on GitHub

Showing 12,811 of 12,811 total issues

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

const saveDischargeDate = (date, isBDD) => {
  if (date) {
    window.sessionStorage.setItem(SAVED_SEPARATION_DATE, date);
    // this flag helps maintain the correct form title within a session
    window.sessionStorage.setItem(FORM_STATUS_BDD, isBDD ? 'true' : 'false');
src/applications/disability-benefits/wizard/pages/bdd.jsx on lines 16..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 99.

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

        <VaRadio
          class="vads-u-margin-y--2"
          label="Has your spouse had any jobs in the last 2 years? "
          onVaValueChange={onSelection}
          required
src/applications/financial-status-report/components/employment/EmploymentQuestion.jsx on lines 144..163

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

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

        events: [
          {
            title: 'Your appeal will be sent it to the Board',
            description: (
              <p>
Severity: Major
Found in src/applications/claims-status/utils/appeals-v2-helpers.jsx and 1 other location - About 3 hrs to fix
src/applications/claims-status/utils/appeals-v2-helpers.jsx on lines 1274..1302

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

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

  return {
    facility,
    kind,
    checkInSteps,
    clinicPhoneNumber,
src/applications/check-in/hooks/useStorage.jsx on lines 174..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 99.

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 function powConfinementDateRangeValidation(errors, fields) {
  const { powConfinementStartDate, powConfinementEndDate } = fields;
  const startDate = moment(powConfinementStartDate);
  const endDate = moment(powConfinementEndDate);

Severity: Major
Found in src/applications/simple-forms/20-10207/helpers.js and 1 other location - About 3 hrs to fix
src/applications/simple-forms/20-10207/helpers.js on lines 186..196

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

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 {
  API_VERSION,
  API_SESSION_URL,
  AUTH_EVENTS,
  SERVICE_PROVIDERS,
Severity: Major
Found in src/platform/user/exportsFile.js and 1 other location - About 3 hrs to fix
src/platform/user/exportsFile.js on lines 398..418

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

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

import PropTypes from 'prop-types';
import React from 'react';
import classNames from 'classnames';
import groupBy from 'lodash/groupBy';
import {
Severity: Minor
Found in src/platform/forms-system/src/js/fields/ObjectField.jsx - About 3 hrs to fix

    DEFAULT_ARRAY_BUILDER_TEXT has 27 functions (exceeds 20 allowed). Consider refactoring.
    Open

    export const DEFAULT_ARRAY_BUILDER_TEXT = {
      alertItemUpdated: props => {
        const itemName = props.getItemName(props.itemData);
        return itemName
          ? `${itemName}’s information has been updated`

      Function fetchInProgressForm has 79 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      export function fetchInProgressForm(
        formId,
        migrations,
        prefill = false,
        prefillTransformer = null,
      Severity: Major
      Found in src/platform/forms/save-in-progress/actions.js - About 3 hrs to fix

        Function DuplicateContactInfoModal has 79 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        function DuplicateContactInfoModal(props) {
          useEffect(
            () => {
              const allPotentialDuplicates = props?.duplicateEmail?.concat(
                props?.duplicatePhone,

          Function App has 79 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          export default function App(props) {
            const { location, children } = props;
            const { chapterTitles, findPageFromPath } = setupPages(formConfig);
            const currentPath = location.pathname;
            const { chapterIndex } = findPageFromPath(currentPath);
          Severity: Major
          Found in src/applications/appeals/testing/nod-new/containers/App.jsx - About 3 hrs to fix

            Function DuplicateContactInfoModal has 79 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            function DuplicateContactInfoModal(props) {
              useEffect(
                () => {
                  const allPotentialDuplicates = props?.duplicateEmail?.concat(
                    props?.duplicatePhone,
            Severity: Major
            Found in src/applications/toe/components/DuplicateContactInfoModal.jsx - About 3 hrs to fix

              Function DuplicateContactInfoModal has 79 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              function DuplicateContactInfoModal(props) {
                useEffect(
                  () => {
                    const allPotentialDuplicates = props?.duplicateEmail?.concat(
                      props?.duplicatePhone,

                Function MessageActionButtons has 79 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                const MessageActionButtons = props => {
                  const {
                    threadId,
                    hideReplyButton,
                    handleReplyButton,

                  Function moveToFolderModal has 79 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                    const moveToFolderModal = () => {
                      return (
                        <div
                          className="message-actions-buttons-modal"
                          data-testid="message-actions-buttons-modal"

                    Function getAppointmentSlots has 79 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                    export function getAppointmentSlots(startDate, endDate, forceFetch = false) {
                      return async (dispatch, getState) => {
                        const state = getState();
                        const siteId = getSiteIdFromFacilityId(getFormData(state).vaFacility);
                        const newAppointment = getNewAppointment(state);
                    Severity: Major
                    Found in src/applications/vaos/new-appointment/redux/actions.js - About 3 hrs to fix

                      Function content has 79 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                        const content = () => {
                          if (activeAlert && activeAlert.type === ALERT_TYPE_ERROR) {
                            return (
                              <>
                                <h1 className="vads-u-margin-bottom--0p5">Allergy:</h1>
                      Severity: Major
                      Found in src/applications/mhv-medical-records/containers/AllergyDetails.jsx - About 3 hrs to fix

                        File contactMethod.js has 298 lines of code (exceeds 250 allowed). Consider refactoring.
                        Open

                        import React from 'react';
                        import { createSelector } from 'reselect';
                        
                        import TextNotificationsDisclaimer from '../../../../components/TextNotificationsDisclaimer';
                        import { formFields } from '../../../../constants';

                          File index.js has 298 lines of code (exceeds 250 allowed). Consider refactoring.
                          Open

                          /**
                           * Functions related to patient specific information
                           * @module services/Patient
                           */
                          import environment from '@department-of-veterans-affairs/platform-utilities/environment';
                          Severity: Minor
                          Found in src/applications/vaos/services/patient/index.js - About 3 hrs to fix

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

                                        onError: (_id, fileName, _reason, { response, status }) => {
                                          if (status === 401) {
                                            dispatch({
                                              type: SET_UNAUTHORIZED,
                                            });
                            Severity: Major
                            Found in src/applications/claims-status/actions/index.js and 1 other location - About 3 hrs to fix
                            src/applications/claims-status/actions/index.js on lines 505..515

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

                            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