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

    it('shows check-in alert message when there are upcoming appointments', () => {
      const { getByTestId } = render(
        <CheckInProvider
          store={{
            upcomingAppointments: multipleAppointments,
src/applications/check-in/components/pages/UpcomingAppointments/UpcomingAppointmentsPage.unit.spec.jsx on lines 182..197

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

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

      it('should skip a page that has been updated less than 168 hours ago', () => {
        MockDate.set('2022-01-08T06:00:00.000-05:00');
        const patientDemographicsStatus = {
          demographicsNeedsUpdate: true,
          demographicsConfirmedAt: '2022-01-04T00:00:00.000-05:00',
src/applications/check-in/utils/navigation/navigation.unit.spec.js on lines 116..133

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

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

OtherNotification.propTypes = {
  notification: PropTypes.shape({
    id: PropTypes.string.isRequired,
    type: PropTypes.string.isRequired,
    attributes: PropTypes.shape({
src/applications/personalization/common/components/DebtNotification.jsx on lines 35..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 114.

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

      it('should skip a page that has been updated more than 168 hours ago but within seven calendar days', () => {
        MockDate.set('2022-01-08T14:00:00.000-05:00');
        const patientDemographicsStatus = {
          demographicsNeedsUpdate: true,
          demographicsConfirmedAt: '2022-01-04T00:00:00.000-05:00',
src/applications/check-in/utils/navigation/navigation.unit.spec.js on lines 134..151

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

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

      <div className="vads-u-display--flex vads-u-flex-direction--column vads-u-align-itmes--stretch small-screen:vads-u-flex-direction--row">
        <va-button
          uswds
          big
          onClick={onYesClick}
src/applications/check-in/day-of/pages/ArrivedAtFacility.jsx on lines 62..82

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

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 const claimantRelationshipToVeteranSpouseOrChildUI = personTitle => {
  const person = personTitle ?? 'Veteran';

  return {
    relationshipToVeteran: radioUI({
src/platform/forms-system/src/js/web-component-patterns/relationshipToVeteranPattern.jsx on lines 73..89

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

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

import PropTypes from 'prop-types';
import React from 'react';
import { connect } from 'react-redux';
import { withRouter } from 'react-router';
import appendQuery from 'append-query';
Severity: Minor
Found in src/platform/user/authorization/containers/MHVApp.jsx - About 3 hrs to fix

    Function nextQuestion has 98 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    function nextQuestion(currentQuestion, answer, state) {
      let next;
      const noGeneralCourtMartial = ['2', '3'].includes(state['7_courtMartial']);
      const dischargeYear = state['2_dischargeYear'];
      const dischargeMonth = state['3_dischargeMonth'] || 1;
    Severity: Major
    Found in src/applications/discharge-wizard/reducers/discharge-wizard.js - About 3 hrs to fix

      Function ConsentNotice has 98 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      export function ConsentNotice() {
        return (
          <span>
            <strong>What is this research about?</strong>
            <p>

        Function ConsentNotice has 98 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        export function ConsentNotice() {
          return (
            <span>
              <strong>What is this research about?</strong>
              <p>

          File ChangeOfAddressWrapper.jsx has 330 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          import React, { useState, useEffect, useCallback } from 'react';
          import PropTypes from 'prop-types';
          import '../sass/change-of-address-wrapper.scss';
          import { useDispatch, useSelector } from 'react-redux';
          import { useLocation } from 'react-router-dom';

            Function handleSearchOnQueryChange has 98 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              const handleSearchOnQueryChange = () => {
                const { currentQuery, searchResults } = props;
                const {
                  context,
                  representativeInputString,
            Severity: Major
            Found in src/applications/representative-search/containers/SearchPage.jsx - About 3 hrs to fix

              Function makeSchemas has 98 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              export function makeSchemas(prefix) {
                const properties = makeFormProperties(prefix);
                const schema = {
                  type: 'object',
                  properties: {

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

                // Node modules.
                import React, { Component } from 'react';
                import PropTypes from 'prop-types';
                import { isEmpty, map, replace } from 'lodash';
                import * as Sentry from '@sentry/browser';

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

                    render() {
                      let paymentsReceivedTable = '';
                      let paymentsReturnedTable = '';
                      let content;
                      // If the app is loading, show a loading LoadingIndicator

                    File helpers.js has 330 lines of code (exceeds 250 allowed). Consider refactoring.
                    Open

                    import { isEmpty } from 'lodash';
                    import { createInitialState } from '@department-of-veterans-affairs/platform-forms-system/state/helpers';
                    import { format } from 'date-fns';
                    import { apiRequest } from 'platform/utilities/api';
                    import environment from '@department-of-veterans-affairs/platform-utilities/environment';
                    Severity: Minor
                    Found in src/applications/simple-forms/21-0966/config/helpers.js - About 3 hrs to fix

                      File InstallmentContract.jsx has 330 lines of code (exceeds 250 allowed). Consider refactoring.
                      Open

                      import React, { useState } from 'react';
                      import PropTypes from 'prop-types';
                      import { connect } from 'react-redux';
                      import { setData } from 'platform/forms-system/src/js/actions';
                      import {

                        File SearchForm.jsx has 330 lines of code (exceeds 250 allowed). Consider refactoring.
                        Open

                        import React, { useEffect, useMemo, useRef, useState } from 'react';
                        import FEATURE_FLAG_NAMES from '@department-of-veterans-affairs/platform-utilities/featureFlagNames';
                        import PropTypes from 'prop-types';
                        import { useLocation } from 'react-router-dom';
                        import { useDispatch, useSelector } from 'react-redux';

                          Function AppointmentsPage has 98 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                          export default function AppointmentsPage() {
                            const location = useLocation();
                            const [hasTypeChanged, setHasTypeChanged] = useState(false);
                            let [pageTitle] = useState('VA online scheduling');
                          
                          

                            Function useClinicFormState has 98 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                            export default function useClinicFormState() {
                              const initialData = useSelector(getFormData);
                              const location = useSelector(selectChosenFacilityInfo);
                            
                              const selectedTypeOfCare = getTypeOfCare(initialData);
                              Severity
                              Category
                              Status
                              Source
                              Language