department-of-veterans-affairs/vets-website

View on GitHub

Showing 12,810 of 12,810 total issues

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

        {statementsByUniqueFacility.map(copay => (
          <va-checkbox
            checked={selectedDebtsAndCopays?.some(
              currCopay => currCopay.selectedDebtId === copay.id,
            )}
src/applications/financial-status-report/components/debtsAndCopays/AvailableDebtsAndCopays.jsx on lines 182..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 112.

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-grid-col padding-bottom-2">
            <VaButton
              onClick={openModalV3}
              text="Click here to open V3 modal"
              uswds
Severity: Major
Found in src/applications/ds-v3-playground/pages/V3BasePage.jsx and 1 other location - About 3 hrs to fix
src/applications/ds-playground/pages/V1V3Page.jsx on lines 441..459

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

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

export function UnderReview(response, name) {
  return (
    <>
      <div>
        <va-alert
Severity: Major
Found in src/applications/fry-dea/components/ConfirmationResponses.jsx - About 3 hrs to fix

    Function createAppointments has 96 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    const createAppointments = (
      token = defaultUUID,
      demographicsNeedsUpdate = false,
      demographicsConfirmedAt = null,
      nextOfKinNeedsUpdate = false,
    Severity: Major
    Found in src/applications/check-in/api/local-mock-api/mocks/v2/shared/get.js - About 3 hrs to fix

      Function StepComponent has 96 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      const StepComponent = props => {
        const { step, clickHandler } = props;
        const data = orientationSteps[step];
        let content;
      
      
      Severity: Major
      Found in src/applications/vre/28-1900/orientation/StepComponent.jsx - About 3 hrs to fix

        Function adaptPayload has 96 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        const adaptPayload = formData => {
          const payload = {};
          const {
            fullName: { firstName: first, lastName: last },
            date,

          Function PathologyDetails has 96 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          const PathologyDetails = props => {
            const { record, fullState, runningUnitTest } = props;
            const user = useSelector(state => state.user.profile);
            const allowTxtDownloads = useSelector(
              state =>

            Function NonVaPrescription has 96 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            const NonVaPrescription = prescription => {
              const content = () => {
                const status = prescription?.dispStatus?.toString();
                return (
                  <div className="medication-details-div vads-u-border-top--1px vads-u-border-color--gray-lighter vads-u-margin-top--3 medium-screen:vads-u-margin-top--4 vads-u-margin-bottom--3">

              Function ReviewPage has 95 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              const ReviewPage = props => {
                const [privacyCheckbox, setPrivacyCheckbox] = useState(false);
                const [submitted, setSubmitted] = useState(false);
              
                const { chapterTitles, getChapterPagesFromChapterIndex } = setupPages();
              Severity: Major
              Found in src/applications/appeals/testing/nod-new/components/ReviewPage2.jsx - About 3 hrs to fix

                Function BurialIntroduction has 95 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                export default function BurialIntroduction(props) {
                  return (
                    <>
                      <Page {...props}>
                        <div className="schemaform-intro">
                Severity: Major
                Found in src/applications/burial-poc-v6/pages/BurialIntroduction.jsx - About 3 hrs to fix

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

                    render() {
                      const { submission, data } = this.props.form;
                      const { response } = submission;
                      const name = data.claimantFullName;
                  
                  
                  Severity: Major
                  Found in src/applications/edu-benefits/0993/containers/ConfirmationPage.jsx - About 3 hrs to fix

                    Function prefillTransformer has 95 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                    export function prefillTransformer(pages, formData, metadata, state) {
                      const bankInformation = state.data?.bankInformation || {};
                      const claimant = state.data?.formData?.data?.attributes?.claimant || {};
                      const contactInfo = claimant?.contactInfo || {};
                      const stateUser = state.user;

                      File TravelPayStatusApp.jsx has 325 lines of code (exceeds 250 allowed). Consider refactoring.
                      Open

                      import React, { useState, useEffect, useCallback, useRef } from 'react';
                      import { useDispatch, useSelector } from 'react-redux';
                      import {
                        isProfileLoading,
                        isLoggedIn,
                      Severity: Minor
                      Found in src/applications/travel-pay/containers/TravelPayStatusApp.jsx - About 3 hrs to fix

                        Function HomeAcreageValueInput has 95 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                        const HomeAcreageValueInput = props => {
                          const {
                            goBack,
                            goForward,
                            onReviewPage = false,
                        Severity: Major
                        Found in src/applications/pensions/components/HomeAcreageValueInput.jsx - About 3 hrs to fix

                          File IntroductionPage.jsx has 325 lines of code (exceeds 250 allowed). Consider refactoring.
                          Open

                          import React from 'react';
                          import { connect } from 'react-redux';
                          import PropTypes from 'prop-types';
                          import { CONTACTS } from '@department-of-veterans-affairs/component-library/contacts';
                          
                          

                            File SearchBenefits.jsx has 325 lines of code (exceeds 250 allowed). Consider refactoring.
                            Open

                            import React, { useState } from 'react';
                            import { useFeatureToggle } from 'platform/utilities/feature-toggles';
                            import EbenefitsLink from 'platform/site-wide/ebenefits/containers/EbenefitsLink';
                            import recordEvent from 'platform/monitoring/record-event';
                            import PropTypes from 'prop-types';
                            Severity: Minor
                            Found in src/applications/gi/components/SearchBenefits.jsx - About 3 hrs to fix

                              Function default has 95 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                              export default function(state = INITIAL_STATE, action) {
                                switch (action.type) {
                                  case ADD_COMPARE_INSTITUTION:
                                    if (state.selected.length < 3) {
                                      return {
                              Severity: Major
                              Found in src/applications/gi/reducers/compare.js - About 3 hrs to fix

                                Function CopyAddressModal has 95 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                const CopyAddressModal = props => {
                                  const {
                                    mailingAddress = null,
                                    homeAddress,
                                    transaction,

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

                                  import commonDefinitions from 'vets-json-schema/dist/definitions.json';
                                  import environment from '@department-of-veterans-affairs/platform-utilities/environment';
                                  import profileContactInfo from 'platform/forms-system/src/js/definitions/profileContactInfo';
                                  import configService from '../utilities/configService';
                                  import manifest from '../manifest.json';
                                  Severity: Minor
                                  Found in src/applications/representative-appoint/config/form.js - About 3 hrs to fix

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

                                      onPropertyChange(name) {
                                        return value => {
                                          const formData = Object.keys(this.props.formData || {}).length
                                            ? this.props.formData
                                            : getDefaultFormState(
                                    src/applications/health-care-supply-reordering/components/ReviewCardField.jsx on lines 131..142
                                    src/platform/forms-system/src/js/components/ReviewCardField.jsx on lines 80..91
                                    src/platform/forms-system/src/js/fields/ObjectField.jsx on lines 100..111
                                    src/platform/forms-system/src/js/review/ObjectField.jsx on lines 56..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 111.

                                    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