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

        boardAppealPage: {
          depends: formData =>
            formData.statementType === STATEMENT_TYPES.DECISION_REVIEW &&
            isEligibleForDecisionReview(formData.decisionDate) &&
            formData.decisionReviewType === DECISION_REVIEW_TYPES.BVA_REQUEST,
Severity: Major
Found in src/applications/simple-forms/21-4138/config/form.js and 1 other location - About 2 hrs to fix
src/applications/simple-forms/21-4138/config/form.js on lines 199..210

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

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

Cypress.Commands.add('selectVaButtonPairSecondary', field => {
  const selector = `va-button-pair${field ? `[name="${field}"]` : ''}`;
  cy.get(selector)
    .shadow()
    .find('va-button[secondary], va-button[back]')
src/platform/testing/e2e/cypress/support/commands/webComponents.js on lines 4..11

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

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 {
    address,
    canScheduleAtChosenFacility,
    cernerSiteIds,
    childFacilitiesStatus,
src/applications/edu-benefits/feedback-tool/components/SchoolSelectField.jsx on lines 192..211

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

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

  moment.tz.setDefault = function(name) {
    if (major < 2 || (major === 2 && minor < 9)) {
      logError(
        'Moment Timezone setDefault() requires Moment.js >= 2.9.0. You are using Moment.js ' +
          moment.version +
Severity: Major
Found in src/applications/personalization/dashboard/lib/moment-tz.js and 1 other location - About 2 hrs to fix
src/applications/vaos/lib/moment-tz.js on lines 604..610

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

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 form.js has 287 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import environment from '@department-of-veterans-affairs/platform-utilities/environment';
import footerContent from 'platform/forms/components/FormFooter';
import getHelp from '../../shared/components/GetFormHelp';

import manifest from '../manifest.json';
Severity: Minor
Found in src/applications/simple-forms/20-10206/config/form.js - About 2 hrs to fix

    File householdIncomeChapter.js has 287 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    import {
      benefits,
      additionalIncomeValues,
      spouseBenefits,
      spouseBenefitRecords,

      Function expandAllEnrollments has 72 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

            const expandAllEnrollments = () => {
              /*
                make sure the begin date and end date are in the same month,
                if not then expand the enrollment period for each month
                between the begin and end dates of the enrollment

        Function DeactivatedMHVIds has 72 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        const DeactivatedMHVIds = () => {
          const content = {
            heading: 'Your My HealtheVet account is inactive',
            alertText: (
              <div>

          Function DependencyVerificationModal has 72 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          const DependencyVerificationModal = props => {
            const nodeToWatch = document.getElementsByTagName('body')[0];
            const [otherModal, setOtherModal] = useState(null);
          
            const openModal = () => {

            Function Wrapper has 72 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            const Wrapper = props => {
              const {
                children,
                pageTitle,
                titleOverride,
            Severity: Major
            Found in src/applications/check-in/components/layout/Wrapper.jsx - About 2 hrs to fix

              Function renderLocationInputField has 72 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                const renderLocationInputField = () => {
                  return (
                    <div>
                      <div id="location-input-field">
                        <label
              Severity: Major
              Found in src/applications/ask-va/components/search/SearchControls.jsx - About 2 hrs to fix

                Function inquiriesGridView has 72 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                  const inquiriesGridView = category => {
                    const filteredInquiries = filterAndSortInquiries(category);
                    const indexOfLastItem = currentPage * itemsPerPage;
                    const indexOfFirstItem = indexOfLastItem - itemsPerPage;
                    const currentInquiries = filteredInquiries.slice(
                Severity: Major
                Found in src/applications/ask-va/containers/DashboardCards.jsx - About 2 hrs to fix

                  Function FacilityList has 72 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  const FacilityList = props => {
                    const { facilities, onChange, query, value, error } = props;
                    const reviewMode = props?.formContext?.reviewMode || false;
                    const submitted = props?.formContext?.submitted || false;
                  
                  
                  Severity: Major
                  Found in src/applications/caregivers/components/FormFields/FacilityList.jsx - About 2 hrs to fix

                    Function Appeals has 72 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                    const Appeals = () => {
                      useEffect(() => {
                        recordEvent({
                          event: 'howToWizard-alert-displayed',
                          'reason-for-alert':
                    Severity: Major
                    Found in src/applications/financial-status-report/wizard/pages/Appeals.jsx - About 2 hrs to fix

                      Function transformFormToCCRequest has 72 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                      export function transformFormToCCRequest(state) {
                        const data = getFormData(state);
                        const provider = data.communityCareProvider;
                        let preferredProviders = [];
                      
                      

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

                          render() {
                            const crumbs = [
                              {
                                href: `../status`,
                                label: 'Status details',
                        Severity: Major
                        Found in src/applications/claims-status/containers/ClaimEstimationPage.jsx - About 2 hrs to fix

                          Function renderCalendar has 72 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                            const renderCalendar = () => {
                              if (!displayedInputs.calendar) return null;
                          
                              const dependentDropdowns = (
                                <div>
                          Severity: Major
                          Found in src/applications/gi/components/profile/CalculateYourBenefitsForm.jsx - About 2 hrs to fix

                            Function LabsAndTests has 72 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                            const LabsAndTests = () => {
                              const dispatch = useDispatch();
                              const updatedRecordList = useSelector(
                                state => state.mr.labsAndTests.updatedList,
                              );
                            Severity: Major
                            Found in src/applications/mhv-medical-records/containers/LabsAndTests.jsx - About 2 hrs to fix

                              Function buildVAPrescriptionTXT has 72 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                              export const buildVAPrescriptionTXT = prescription => {
                                const refillHistory = [...(prescription?.rxRfRecords || [])];
                                const originalFill = createOriginalFillRecord(prescription);
                                refillHistory.push(originalFill);
                              
                              
                              Severity: Major
                              Found in src/applications/mhv-medications/util/txtConfigs.js - About 2 hrs to fix

                                File VAPServiceProfileField.jsx has 286 lines of code (exceeds 250 allowed). Consider refactoring.
                                Open

                                import React from 'react';
                                import PropTypes from 'prop-types';
                                import { connect } from 'react-redux';
                                import { focusElement } from 'platform/utilities/ui';
                                
                                
                                  Severity
                                  Category
                                  Status
                                  Source
                                  Language