department-of-veterans-affairs/vets-website

View on GitHub

Showing 12,816 of 12,816 total issues

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

export default {
  uiSchema: {
    ...titleUI(
      'Your mailing address',
      'We’ll send any important information about this request to this address.',
src/applications/simple-forms/20-10207/pages/veteranMailingAddress.js on lines 10..32

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

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

  eventA.fieldDatetimeRangeTimezone.push({
    value: now
      .clone()
      .add(1, 'week')
      .unix(),
src/applications/static-pages/events/helpers/event-generator.js on lines 93..104

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

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

    militaryServiceExperienceBranchDateRangePage: pageBuilder.itemPage({
      title: 'Military service experience branch and date range',
      path: 'military-service-experiences/:index/branch-date-range',
      onNavForward: props => {
        return !props.formData.currentlyServing
src/applications/accredited-representative-portal/accreditation/21a/pages/03-employment-information-chapter/employersPages.js on lines 280..290

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

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

import React from 'react';
import PropTypes from 'prop-types';
import classNames from 'classnames';
import {
  VaModal,

    File DownloadRecordsPage.jsx has 277 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    import React, { useCallback, useEffect, useState } from 'react';
    import { useDispatch, useSelector } from 'react-redux';
    import { focusElement } from '@department-of-veterans-affairs/platform-utilities/ui';
    import { formatDateLong } from '@department-of-veterans-affairs/platform-utilities/exports';
    import PropTypes from 'prop-types';

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

        render() {
          const { formConfig, buttonOnly, devOnly } = this.props;
          const devOnlyForceShowFormControls =
            environment.isLocalhost() &&
            !window.Cypress &&
      Severity: Major
      Found in src/platform/forms/save-in-progress/SaveInProgressIntro.jsx - About 2 hrs to fix

        Function ITFBanner has 66 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        const ITFBanner = props => {
          const [messageDismissed, setMessageDismissed] = useState(false);
          const [reviewInitialFocus, setReviewInitialFocus] = useState(false);
        
          const goHome = () => {
        Severity: Major
        Found in src/applications/appeals/995/components/ITFBanner.jsx - About 2 hrs to fix

          Function ITFBanner has 66 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          const ITFBanner = props => {
            const [messageDismissed, setMessageDismissed] = useState(false);
            const [reviewInitialFocus, setReviewInitialFocus] = useState(false);
          
            const goHome = () => {
          Severity: Major
          Found in src/applications/appeals/testing/sc/components/ITFBanner.jsx - About 2 hrs to fix

            Function createDirectDepositPage has 66 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            export default function createDirectDepositPage() {
              const bankAccountProperties = {
                type: 'object',
                properties: {
                  accountType: {
            Severity: Major
            Found in src/applications/edu-benefits/5490/content/directDeposit.jsx - About 2 hrs to fix

              Function createMockAddressValidationSuccessResponse has 66 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              const createMockAddressValidationSuccessResponse = _data => {
                return {
                  data: {
                    messages: [
                      {

                Function CommunityCareProviderSelectionPage has 66 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                export default function CommunityCareProviderSelectionPage() {
                  const pageTitle = useSelector(state => getPageTitle(state, pageKey));
                
                  const dispatch = useDispatch();
                  const { data, pageChangeInProgress, schema } = useSelector(

                  Function useUnavailableItems has 66 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                    const useUnavailableItems = () => {
                      const { groups, items, channels } = getEntities(communicationPreferences);
                  
                      const excludedGroupIds = [
                        // Always exclude QUICK_SUBMIT and GENERAL

                    Function mapStateToProps has 66 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                    const mapStateToProps = state => {
                      const { isReady: hasLoadedScheduledDowntime } = state.scheduledDowntime;
                      const isLOA3 = isLOA3Selector(state);
                      const isLOA1 = isLOA1Selector(state);
                      const isVAPatient = isVAPatientSelector(state);
                    Severity: Major
                    Found in src/applications/personalization/dashboard/components/Dashboard.jsx - About 2 hrs to fix

                      Function directDeposit has 66 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                      function directDeposit(state = initialState, action) {
                        switch (action.type) {
                          case DIRECT_DEPOSIT_FETCH_SUCCEEDED:
                          case DIRECT_DEPOSIT_SAVE_SUCCEEDED: {
                            return {
                      Severity: Major
                      Found in src/applications/personalization/profile/reducers/directDeposit.js - About 2 hrs to fix

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

                          const content = () => {
                            if (accessAlert) {
                              return (
                                <AccessTroubleAlertBox
                                  alertType={accessAlertTypes.VITALS}
                        Severity: Major
                        Found in src/applications/mhv-medical-records/containers/Vitals.jsx - About 2 hrs to fix

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

                            render() {
                              const { enrollment, id } = this.props;
                              const amendments = enrollment.amendments || [];
                              const yellowRibbonStatus = enrollment.yellowRibbonAmount > 0 && (
                                <div className="yellow-ribbon-school">
                          Severity: Major
                          Found in src/applications/post-911-gib-status/components/EnrollmentPeriod.jsx - About 2 hrs to fix

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

                              render() {
                                const contentClasses = classNames(
                                  'form-expanding-group-open',
                                  'wizard-content',
                                  {
                            Severity: Major
                            Found in src/applications/post-911-gib-status/components/EducationWizard.jsx - About 2 hrs to fix

                              Function FormSaveErrorMessage has 65 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                              function FormSaveErrorMessage(props) {
                                const { route, formConfig, user, form, location, showLoginModal } = props;
                              
                                const savedStatus = form?.savedStatus;
                                const appType = formConfig?.customText?.appType || APP_TYPE_DEFAULT;
                              Severity: Major
                              Found in src/platform/forms/components/review/FormSaveErrorMessage.jsx - About 2 hrs to fix

                                Function SubmitButtons has 65 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                export default function SubmitButtons(props) {
                                  const { onBack, onSubmit, submission, formConfig, formErrors = {} } = props;
                                
                                  const appType = formConfig?.customText?.appType || APP_TYPE_DEFAULT;
                                  const buttonText =
                                Severity: Major
                                Found in src/platform/forms-system/src/js/review/SubmitButtons.jsx - About 2 hrs to fix

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

                                  import { VA_FORM_IDS } from 'platform/forms/constants';
                                  
                                  import preSubmitInfo from 'platform/forms/preSubmitInfo';
                                  import FormFooter from 'platform/forms/components/FormFooter';
                                  import { externalServices as services } from 'platform/monitoring/DowntimeNotification';
                                  Severity: Minor
                                  Found in src/applications/appeals/995/config/form.js - About 2 hrs to fix
                                    Severity
                                    Category
                                    Status
                                    Source
                                    Language