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

    const highLightMatchingText = query => {
      if (value.length > 2) {
        return query
          .split(caseInsensitiveMatch)
          .map(
Severity: Major
Found in src/platform/forms-system/src/js/fields/AutosuggestField.jsx and 1 other location - About 2 hrs to fix
src/applications/pre-need-integration/components/AutosugggestField.jsx on lines 218..234

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

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 onFailure = respOrError => {
    if (respOrError instanceof Response && respOrError.status === 429) {
      const error = new Error('vets_throttled_error_burial');
      error.extra = parseInt(respOrError.headers.get('x-ratelimit-reset'), 10);

Severity: Major
Found in src/applications/burials-ez/utils/helpers.jsx and 1 other location - About 2 hrs to fix
src/applications/pensions/config/submit.js on lines 55..66

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

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

      {
        id: '333333',
        type: 'claim',
        attributes: {
          claimDate: '2023-10-18',
src/applications/personalization/dashboard/mocks/claims/index.js on lines 28..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 91.

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 async function fetchBookedAppointment({ id, avs = true }) {
  try {
    const appointment = await getAppointment(id, avs);
    return transformVAOSAppointment(appointment);
  } catch (e) {
Severity: Major
Found in src/applications/vaos/services/appointment/index.js and 1 other location - About 2 hrs to fix
src/applications/vaos/services/location/index.js on lines 39..51

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

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 houseAssistanceContent = (
  <va-accordion-item bordered uswds>
    <h4 slot="headline">Adapted housing assistance</h4>
    <p>
      To apply for an adapted housing grant, you’ll need to fill out an
src/applications/disability-benefits/all-claims/content/ancillaryFormsWizardSummary.jsx on lines 58..76

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

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

        <option
          value={
            location.pathname === Paths.DRAFTS
              ? threadSortingOptions.DRAFT_DATE_DESCENDING.value
              : threadSortingOptions.SENT_DATE_DESCENDING.value
src/applications/mhv-secure-messaging/components/ThreadList/ThreadListSort.jsx on lines 52..62

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

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

      {
        id: '266374',
        type: 'claim',
        attributes: {
          claimDate: '2013-10-18',
src/applications/personalization/dashboard/mocks/claims/index.js on lines 9..27

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

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

      <AlertMessage
        content={
          <>
            <h3 className="usa-alert-heading">
              Need help preparing your application?
src/applications/discharge-wizard/components/gpSteps/StepOne.jsx on lines 174..201

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

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-l-col--12 small-screen:vads-l-col--6 vads-u-margin--1">
              <VaMemorableDate
                name="v3MemorableDate"
                label="V3 Memorable date"
                hint="This is a hint"
Severity: Major
Found in src/applications/ds-playground/pages/V1V3Page.jsx and 1 other location - About 2 hrs to fix
src/applications/ds-v3-playground/pages/V3BasePage.jsx on lines 224..234

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

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

        <option
          value={
            location.pathname === Paths.DRAFTS
              ? threadSortingOptions.DRAFT_DATE_ASCENDING.value
              : threadSortingOptions.SENT_DATE_ASCENDING.value
src/applications/mhv-secure-messaging/components/ThreadList/ThreadListSort.jsx on lines 40..50

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

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

function Column(props) {
  const { children, classNames = '', role, testId } = props;

  return (
    <div className={`${classNames} columns`} role={role} data-testid={testId}>
Severity: Major
Found in src/platform/forms/components/common/grid/Column.jsx and 1 other location - About 2 hrs to fix
src/platform/forms/components/common/grid/Row.jsx on lines 10..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 91.

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

function setupJSDom() {
  // Prevent warnings from displaying
  /* eslint-disable no-console */
  if (process.env.LOG_LEVEL === 'debug') {
    console.error = (error, reactError) => {
Severity: Major
Found in src/platform/testing/unit/mocha-setup.js - About 2 hrs to fix

    Function VaCheckboxGroupField has 69 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    export default function VaCheckboxGroupField(props) {
      const checkboxes = getCheckboxData(props.childrenProps);
    
      const onGroupChange = event => {
        const checkboxKey = event.target.dataset.key;

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

        render() {
          const {
            uiSchema,
            errorSchema,
            idSchema,
      Severity: Major
      Found in src/platform/forms-system/src/js/review/ReadOnlyArrayField.jsx - About 2 hrs to fix

        Function setHiddenFields has 69 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        export function setHiddenFields(schema, uiSchema, formData, path = []) {
          if (!uiSchema) {
            return schema;
          }
        
        
        Severity: Major
        Found in src/platform/forms-system/src/js/state/helpers.js - About 2 hrs to fix

          Function formatOperatingHours has 69 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          export const formatOperatingHours = operatingHours => {
            if (!operatingHours) return operatingHours;
            // Remove all whitespace and sanitize dashes.
            const sanitizedOperatingHours = operatingHours
              .replace(/ /g, '')
          Severity: Major
          Found in src/applications/facility-locator/utils/helpers.jsx - About 2 hrs to fix

            Function RegisterFailed has 69 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            const RegisterFailed = () => {
              const content = {
                heading: 'We couldn’t create a MyHealtheVet account for you',
                alertText: (
                  <>

              Function getTravelMessage has 69 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                const getTravelMessage = () => {
                  if (
                    form.data['travel-question'] === 'no' ||
                    !isTravelReimbursementEnabled
                  ) {
              Severity: Major
              Found in src/applications/check-in/day-of/pages/Error.jsx - About 2 hrs to fix

                Function DraftSavedInfo has 69 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                const DraftSavedInfo = props => {
                  const { messageId, drafts } = props;
                
                  const threadDetails = useSelector(state => state.sm.threadDetails);
                
                

                  Function fetchResultsThunk has 69 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  export const fetchResultsThunk = (options = {}) => async dispatch => {
                    // Derive options properties.
                    const city = options?.city || null;
                    const contributionAmount = options?.contributionAmount || null;
                    const hideFetchingState = options?.hideFetchingState;
                  Severity: Major
                  Found in src/applications/yellow-ribbon/actions/index.js - About 2 hrs to fix
                    Severity
                    Category
                    Status
                    Source
                    Language