department-of-veterans-affairs/vets-website

View on GitHub

Showing 14,709 of 14,709 total issues

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

export const getMissingInfo = ({ data, keys, content, requiredKeys = [] }) => {
  const missingInfo = [];
  // If both home & mobile selected, make only one phone required
  const phones = [keys.homePhone, '|', keys.mobilePhone];
  const eitherPhone =
src/applications/_mock-form-ae-design-patterns/utils/data/task-blue/profile.js on lines 350..390
src/applications/_mock-form-ae-design-patterns/utils/data/task-gray/profile.js on lines 362..403
src/platform/forms-system/src/js/utilities/data/profile.js on lines 362..402

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

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 VAFacilityPageV2.unit.spec.js has 1180 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import React from 'react';
import userEvent from '@testing-library/user-event';
import { expect } from 'chai';

// eslint-disable-next-line import/no-unresolved

    Function getStatusContents has 602 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    export function getStatusContents(appeal, name = {}) {
      const { status, aoj, programArea } = appeal.attributes;
      const appealType = appeal.type;
      const statusType = status.type || status;
      const details = status.details || {};
    Severity: Major
    Found in src/applications/claims-status/utils/appeals-v2-helpers.jsx - About 3 days to fix

      File helpers.js has 1161 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      import React from 'react';
      import { merge } from 'lodash';
      import get from 'platform/utilities/data/get';
      import omit from 'platform/utilities/data/omit';
      import * as Sentry from '@sentry/browser';
      Severity: Major
      Found in src/applications/pre-need-integration/utils/helpers.js - About 2 days to fix

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

        const BenefitType = ({ data = {}, error, setPageData }) => {
          useEffect(() => {
            setTimeout(() => {
              focusElement('#main h2');
            });
        Severity: Major
        Found in src/applications/appeals/testing/sc/subtask/pages/start.jsx and 1 other location - About 2 days to fix
        src/applications/appeals/995/subtask/pages/start.jsx on lines 48..123

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

        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

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

        const BenefitType = ({ data = {}, error, setPageData }) => {
          useEffect(() => {
            setTimeout(() => {
              focusElement('#main h2');
            });
        Severity: Major
        Found in src/applications/appeals/995/subtask/pages/start.jsx and 1 other location - About 2 days to fix
        src/applications/appeals/testing/sc/subtask/pages/start.jsx on lines 48..123

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

        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 CalculateYourBenefitsForm.jsx has 1146 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        import PropTypes from 'prop-types';
        import React, { useState } from 'react';
        import _ from 'lodash';
        import classNames from 'classnames';
        
        
        Severity: Major
        Found in src/applications/gi/components/profile/CalculateYourBenefitsForm.jsx - About 2 days to fix

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

          export const serviceLabels = {
            AC: 'U.S. Army Air Corps',
            AF: 'U.S. Air Force',
            AR: 'U.S. Army',
            CG: 'U.S. Coast Guard',
          Severity: Major
          Found in src/applications/pre-need/utils/labels.js and 1 other location - About 2 days to fix
          src/applications/pre-need-integration/utils/labels.js on lines 1..100

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

          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

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

          export const serviceLabels = {
            AC: 'U.S. Army Air Corps',
            AF: 'U.S. Air Force',
            AR: 'U.S. Army',
            CG: 'U.S. Coast Guard',
          Severity: Major
          Found in src/applications/pre-need-integration/utils/labels.js and 1 other location - About 2 days to fix
          src/applications/pre-need/utils/labels.js on lines 1..100

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

          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

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

          const Footer = () => {
            return (
              <footer data-testid="arp-footer" className="footer arp-footer">
                <div className="footer-inner">
                  <div className="usa-grid usa-grid-full footer-banner vads-u-padding-top--2">
          src/applications/accredited-representative-portal/accreditation/21a/components/common/Footer/Footer.jsx on lines 4..75

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

          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

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

          const Footer = () => {
            return (
              <footer data-testid="arp-footer" className="footer arp-footer">
                <div className="footer-inner">
                  <div className="usa-grid usa-grid-full footer-banner vads-u-padding-top--2">
          src/applications/accredited-representative-portal/components/common/Footer/Footer.jsx on lines 4..75

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

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

          /* istanbul ignore file */
          //! moment-timezone.js
          //! version : 0.5.25
          //! Copyright (c) JS Foundation and other contributors
          //! license : MIT
          Severity: Major
          Found in src/applications/personalization/dashboard/lib/moment-tz.js - About 2 days to fix

            File helpers.jsx has 1124 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            /* eslint-disable no-nested-ternary */
            /* eslint-disable react/jsx-key */ // keys are defined, error being thrown in eslint even when key is defined
            import React from 'react';
            import ADDRESS_DATA from 'platform/forms/address/data';
            import { v4 as uuidv4 } from 'uuid';
            Severity: Major
            Found in src/applications/verify-your-enrollment/helpers.jsx - About 2 days to fix

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

              const mapStateToProps = state => {
                const { featureToggles } = state;
                const selectedAddress = state.form?.data['view:currentAddress'];
                const shippingAddress = state.form?.data[selectedAddress];
                const { fullName, vetEmail, order, supplies } = state.form?.data;
              src/applications/disability-benefits/2346/containers/ConfirmationPage.jsx on lines 315..374

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

              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

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

              const mapStateToProps = state => {
                const { featureToggles } = state;
                const selectedAddress = state.form?.data['view:currentAddress'];
                const shippingAddress = state.form?.data[selectedAddress];
                const { fullName, vetEmail, order, supplies } = state.form?.data;
              src/applications/health-care-supply-reordering/containers/ConfirmationPage.jsx on lines 315..374

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

              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

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

                  {
                    id: 'c3e3e32701e23fdf389c06eae00fcb24',
                    type: 'va_appointments',
                    attributes: {
                      startDate: formatISO(addDays(Date.now(), 35)),
              src/applications/personalization/dashboard/utils/mocks/appointments/MOCK_VA_APPOINTMENTS.js on lines 5..120

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

              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

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

                  {
                    id: 'c3e3e32701e23fdf389c06eae00fcb24',
                    type: 'va_appointments',
                    attributes: {
                      startDate: formatISO(addDays(Date.now(), 35)),
              src/applications/personalization/dashboard/utils/mocks/appointments/MOCK_VA_APPOINTMENTS_OVER_30_DAYS.js on lines 5..120

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

              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

                Zone.prototype = {
                  _set: function(unpacked) {
                    this.name = unpacked.name;
                    this.abbrs = unpacked.abbrs;
                    this.untils = unpacked.untils;
              Severity: Major
              Found in src/applications/personalization/dashboard/lib/moment-tz.js and 1 other location - About 2 days to fix
              src/applications/vaos/lib/moment-tz.js on lines 149..208

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

              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

                  Zone.prototype = {
                      _set : function (unpacked) {
                          this.name       = unpacked.name;
                          this.abbrs      = unpacked.abbrs;
                          this.untils     = unpacked.untils;
              Severity: Major
              Found in src/applications/vaos/lib/moment-tz.js and 1 other location - About 2 days to fix
              src/applications/personalization/dashboard/lib/moment-tz.js on lines 156..218

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

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

              export function getStatusContents(appeal, name = {}) {
                const { status, aoj, programArea } = appeal.attributes;
                const appealType = appeal.type;
                const statusType = status.type || status;
                const details = status.details || {};
              Severity: Major
              Found in src/applications/personalization/dashboard/utils/getStatusContents.jsx - About 2 days to fix
                Severity
                Category
                Status
                Source
                Language