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

export default savedData => {
  if (savedData.formData.otherHomelessHousing) {
    const formData = omit('otherHomelessHousing', savedData.formData);
    formData.otherHomelessHousing = savedData.formData.otherHomelessHousing.substring(
      0,
src/applications/disability-benefits/all-claims/migrations/05-truncate-otherAtRiskHousing.js on lines 5..18

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

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

      {!keys.length && (
        <div className="vads-u-background-color--gray-lightest vads-u-padding--2 vads-u-margin-y--3">
          <NoAppointments
            description="past appointments"
            showScheduleButton={showScheduleButton}
src/applications/vaos/appointment-list/components/UpcomingAppointmentsList.jsx on lines 131..145

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

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 DirectDeposit = ({ serviceDescription, primaryButtonHandler }) => {
  const content = {
    heading: `Go to your VA.gov profile to ${serviceDescription}`,
    alertText: (
      <p>
src/applications/static-pages/cta-widget/components/messages/UpgradeAccount.jsx on lines 5..17

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

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

      {!keys?.length && (
        <div className="vads-u-background-color--gray-lightest vads-u-padding--2 vads-u-margin-y--3">
          <NoAppointments
            description="upcoming appointments"
            showScheduleButton={showScheduleButton}
src/applications/vaos/appointment-list/components/PastAppointmentsList/index.jsx on lines 260..274

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

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 mask = value => {
  const number = (value || '').toString().slice(-4);
  return srSubstitute(
    `●●●–●●–${number}`,
    `ending with ${number.split('').join(' ')}`,
src/applications/simple-forms/form-upload/helpers/index.js on lines 57..63

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

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 default savedData => {
  if (savedData.formData.otherAtRiskHousing) {
    const formData = omit('otherAtRiskHousing', savedData.formData);
    formData.otherAtRiskHousing = savedData.formData.otherAtRiskHousing.substring(
      0,
src/applications/disability-benefits/all-claims/migrations/04-truncate-otherHomelessHousing.js on lines 5..18

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

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

        <Section heading="Preferred date and time">
          <ul className="usa-unstyled-list">
            {preferredDates.map((date, index) => (
              <li key={`${appointment.id}-option-${index}`}>{date}</li>
            ))}
Severity: Major
Found in src/applications/vaos/components/layout/VARequestLayout.jsx and 1 other location - About 2 hrs to fix
src/applications/vaos/components/layout/CCRequestLayout.jsx on lines 51..57

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

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 mask = value => {
  const number = (value || '').toString().slice(-4);
  return srSubstitute(
    `●●●–●●–${number}`,
    `ending with ${number.split('').join(' ')}`,
Severity: Major
Found in src/applications/simple-forms/form-upload/helpers/index.js and 1 other location - About 2 hrs to fix
src/applications/personalization/view-dependents/util/index.js on lines 43..49

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

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

import { apiRequest } from 'platform/utilities/api';
import environment from 'platform/utilities/environment';

import { toSnakeCase } from '../helpers';

Severity: Minor
Found in src/applications/my-education-benefits/actions/index.js - About 2 hrs to fix

    File toxicExposure.jsx has 279 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    import React from 'react';
    import { checkboxGroupSchema } from 'platform/forms-system/src/js/web-component-patterns';
    import {
      capitalizeEachWord,
      formSubtitle,

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

        render() {
          const {
            addressFromUser,
            addressValidationError,
            confirmedSuggestions,

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

          render() {
            const {
              analyticsSectionName,
              fieldName,
              isEditing,

          Function Balances has 67 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          const Balances = () => {
            // get balances from redux
            const { debtLetters, mcp } = useSelector(
              ({ combinedPortal }) => combinedPortal,
            );

            Function IntroductionProcessListV1 has 67 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            function IntroductionProcessListV1() {
              return (
                <div className="process schemaform-process">
                  <ol>
                    <li className="process-step list-one">

              Function submitForm has 67 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              const submitForm = (form, formConfig, submissionId) => {
                const formWithSubmissionId = {
                  ...form,
                  data: {
                    ...form.data,
              Severity: Major
              Found in src/applications/coronavirus-research/update/config/submitForm.js - About 2 hrs to fix

                Function navigateForward has 67 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                export const navigateForward = (
                  SHORT_NAME,
                  formResponses,
                  router,
                  editMode,
                Severity: Major
                Found in src/applications/discharge-wizard/utilities/page-navigation.js - About 2 hrs to fix

                  Function IntroductionPage has 67 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  const IntroductionPage = props => {
                    const { route } = props;
                    const { formConfig, pageList } = route;
                  
                    useEffect(
                  Severity: Major
                  Found in src/applications/ivc-champva/10-7959C/containers/IntroductionPage.jsx - About 2 hrs to fix

                    Function SearchQueryReducer has 67 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                    export const SearchQueryReducer = (state = INITIAL_STATE, action) => {
                      switch (action.type) {
                        case SEARCH_STARTED:
                          return {
                            ...state,
                    Severity: Major
                    Found in src/applications/representative-search/reducers/searchQuery.js - About 2 hrs to fix

                      Function WarningHeadline has 67 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                      const WarningHeadline = () => {
                        const { statusCode } = useSelector(selectEnrollmentStatus);
                      
                        // Declare enrollment status content dictionary
                        const contentDictionary = [

                        Function submit has 67 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                        const submit = form => {
                          const currentAddress = form.data['view:currentAddress'];
                          const itemQuantities = form.data?.order?.length;
                          const { order, permanentAddress, temporaryAddress, vetEmail } = form.data;
                          const useVeteranAddress = currentAddress === 'permanentAddress';
                        Severity: Major
                        Found in src/applications/disability-benefits/2346/config/form.js - About 2 hrs to fix
                          Severity
                          Category
                          Status
                          Source
                          Language