department-of-veterans-affairs/vets-website

View on GitHub

Showing 12,821 of 12,821 total issues

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

    case STATUS_TYPES.merged:
      contents.title = 'Your appeal was merged';
      contents.description = (
        <div>
          <p>
src/applications/claims-status/utils/appeals-v2-helpers.jsx on lines 601..617

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

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 fullNamePage = {
  uiSchema: {
    ...arrayBuilderItemFirstPageTitleUI({
      title: 'Add a dependent child',
      nounSingular: options.nounSingular,
src/applications/pensions/config/chapters/02-military-history/otherNamesPages.js on lines 66..81

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

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 { getByTestId } = render(
          <CheckInProvider>
            <ValidateDisplay
              validateHandler={validateHandler}
              setDobError={setDobError}
src/applications/check-in/components/pages/validate/ValidateDisplay.unit.spec.jsx on lines 134..143

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

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 validateZipcode = (content, zipcode) => {
  const processedZipcode = (zipcode || '').trim();
  if (!processedZipcode) {
    return content.missingZipError(true);
  }
src/platform/forms-system/src/js/utilities/data/profile.js on lines 322..331

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

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

          {!this.props.hideUnauthedStartLink && (
            <p>
              <Link
                onClick={this.handleClick}
                to={this.getStartPage}
Severity: Major
Found in src/platform/forms/save-in-progress/SaveInProgressIntro.jsx and 1 other location - About 2 hrs to fix
src/platform/forms/save-in-progress/SaveInProgressIntro.jsx on lines 286..298

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

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 breadcrumbList = [
  { href: '/', label: 'Home' },
  {
    href: `/family-and-caregiver-benefits`,
    label: `Family and caregiver benefits`,
Severity: Major
Found in src/applications/ivc-champva/10-7959C/containers/App.jsx and 1 other location - About 2 hrs to fix
src/applications/ivc-champva/10-10D/containers/App.jsx on lines 14..28

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

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

      <button
        type="submit"
        className="search-button vads-u-margin-right--1 vads-u-margin-top--1 vads-u-font-size--base vads-u-padding-left--1p5"
        onClick={onInputSubmit}
        onKeyDown={handleButtonShift}
Severity: Major
Found in src/applications/proxy-rewrite/partials/search.jsx and 1 other location - About 2 hrs to fix
src/applications/proxy-rewrite/partials/search.jsx on lines 77..99

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

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

import constants from 'vets-json-schema/dist/constants.json';

export const militaryBranches = [
  'Air Force',
  'Army',
Severity: Minor
Found in src/platform/forms/address/data/labels.js - About 2 hrs to fix

    File SmApi.js has 272 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    import environment from '@department-of-veterans-affairs/platform-utilities/environment';
    import { apiRequest } from '@department-of-veterans-affairs/platform-utilities/exports';
    import { DefaultFolders, threadSortingOptions } from '../util/constants';
    
    const apiBasePath = `${environment.API_URL}/my_health/v1`;
    Severity: Minor
    Found in src/applications/mhv-secure-messaging/api/SmApi.js - About 2 hrs to fix

      File VAFacilityPageV2.jsx has 272 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      import React, { useEffect } from 'react';
      import { shallowEqual, useDispatch, useSelector } from 'react-redux';
      import { useHistory } from 'react-router-dom';
      import SchemaForm from 'platform/forms-system/src/js/components/SchemaForm';
      import { usePrevious } from 'platform/utilities/react-hooks';

        Function isValidForm has 63 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        export function isValidForm(form, pageList, isTesting = false) {
          const pageListMap = new Map();
          pageList.forEach(page => pageListMap.set(page.pageKey, page));
          const validPages = Object.keys(form.pages).filter(pageKey =>
            isActivePage(find(pageList, { pageKey }), form.data),
        Severity: Major
        Found in src/platform/forms-system/src/js/validation.js - About 2 hrs to fix

          Function reduceErrors has 63 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            errors.reduce((processedErrors, error) => {
              let errorIndex = null; // save key (index) of array items with __error
              const findErrors = (name, err) => {
                if (err && typeof err === 'object') {
                  // process the last type of error message which provides an `__errors`
          Severity: Major
          Found in src/platform/forms-system/src/js/utilities/data/reduceErrors.js - About 2 hrs to fix

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

              render() {
                return (
                  <div>
                    <h2 className="confirmation-page-title">
                      Thank you for signing up for our coronavirus research volunteer list

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

                render() {
                  return (
                    <div>
                      <h2 className="confirmation-page-title">
                        Thank you for signing up for our coronavirus research volunteer list

                Function listItems has 63 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                  const listItems = dependents.map((item, index) => {
                    const { fullName, dependentRelation } = item;
                    const dependentName = normalizeFullName(fullName);
                    const modalDescription = replaceStrValues(
                      content['household-dependent-modal-remove-description'],
                Severity: Major
                Found in src/applications/ezr/components/FormFields/DependentList.jsx - About 2 hrs to fix

                  Function validateAddress has 63 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  export const validateAddress = (formData, fullName) => async (
                    dispatch,
                    getState,
                  ) => {
                    dispatch({ type: ADDRESS_VALIDATION_START });
                  Severity: Major
                  Found in src/applications/verify-your-enrollment/actions/index.js - About 2 hrs to fix

                    Function listItems has 63 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                      const listItems = dependents.map((item, index) => {
                        const { fullName, dependentRelation } = item;
                        const dependentName = normalizeFullName(fullName);
                        const modalDescription = replaceStrValues(
                          content['household-dependent-modal-remove-description'],

                      Function Demographics has 63 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                      const Demographics = props => {
                        const dispatch = useDispatch();
                        const selectVeteranData = useMemo(makeSelectVeteranData, []);
                        const { t } = useTranslation();
                        const { demographics } = useSelector(selectVeteranData);
                      Severity: Major
                      Found in src/applications/check-in/day-of/pages/Demographics.jsx - About 2 hrs to fix

                        Function questionStatus has 63 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                          const questionStatus = () => {
                            if (hasError) {
                              return (
                                <>
                                  <p>
                        Severity: Major
                        Found in src/applications/ask-va/containers/IntroductionPage.jsx - About 2 hrs to fix

                          Function updateFormData has 63 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                            const updateFormData = e => {
                              e.preventDefault();
                              if (isEditing) {
                                // find the one we are editing in the employeeRecords array
                                const updatedRecords = employmentRecords.map((item, arrayIndex) => {
                            Severity
                            Category
                            Status
                            Source
                            Language