department-of-veterans-affairs/vets-website

View on GitHub

Showing 12,675 of 12,675 total issues

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

              <div
                className="usa-banner-content usa-grid usa-accordion-content vads-u-padding-x--1"
                id="gov-banner"
                aria-hidden="true"
              >
src/applications/accredited-representative-portal/components/common/Header/WiderThanMobileHeader/WiderThanMobileOfficialGovtWebsite.jsx on lines 39..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 201.

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

import session from '../mocks/v2/sessions';
import preCheckInData from '../mocks/v2/pre-check-in-data';
import checkInData from '../mocks/v2/check-in-data';
import btsss from '../mocks/v2/btsss';
import sharedData from '../mocks/v2/shared';
Severity: Major
Found in src/applications/check-in/api/local-mock-api/e2e/ApiInitializer.js - About 1 day to fix

    Function ConfirmationPageV2 has 207 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    export const ConfirmationPageV2 = () => {
      const alertRef = useRef(null);
    
      const form = useSelector(state => state.form || {});
      const profile = useSelector(state => selectProfile(state));
    Severity: Major
    Found in src/applications/appeals/10182/components/ConfirmationPageV2.jsx - About 1 day to fix

      Function generateData has a Cognitive Complexity of 53 (exceeds 5 allowed). Consider refactoring.
      Open

      const generateData = (type, formData) => {
        switch (type) {
          case 'claimant-information':
            return {
              'Claimant’s first name': formData?.claimantFullName?.first
      Severity: Minor
      Found in src/applications/burials-ez/components/NoFormPage.jsx - About 1 day to fix

      Cognitive Complexity

      Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

      A method's cognitive complexity is based on a few simple rules:

      • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
      • Code is considered more complex for each "break in the linear flow of the code"
      • Code is considered more complex when "flow breaking structures are nested"

      Further reading

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

      describe('View Test + Lab Results Page <UnauthContent>', () => {
        it('renders what we expect', () => {
          const wrapper = shallow(<UnauthContent />);
      
          const text = wrapper.text();
      src/applications/static-pages/health-care-manage-benefits/schedule-view-va-appointments-page/components/AuthContent/index.unit.spec.js on lines 8..33
      src/applications/static-pages/health-care-manage-benefits/secure-messaging-page/components/UnauthContent/index.unit.spec.js on lines 8..31
      src/applications/static-pages/health-care-manage-benefits/view-test-and-lab-results-page/components/AuthContent/index.unit.spec.js on lines 8..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 200.

      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 4 locations. Consider refactoring.
      Open

      describe('View Test + Lab Results Page <AuthContent>', () => {
        it('renders what we expect', () => {
          const wrapper = shallow(<AuthContent />);
          const text = wrapper.text();
          expect(text).to.include(
      src/applications/static-pages/health-care-manage-benefits/schedule-view-va-appointments-page/components/AuthContent/index.unit.spec.js on lines 8..33
      src/applications/static-pages/health-care-manage-benefits/secure-messaging-page/components/UnauthContent/index.unit.spec.js on lines 8..31
      src/applications/static-pages/health-care-manage-benefits/view-test-and-lab-results-page/components/UnauthContent/index.unit.spec.js on lines 8..29

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

      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 4 locations. Consider refactoring.
      Open

      describe('Secure Messaging Page <UnauthContent>', () => {
        it('renders what we expect', () => {
          const wrapper = shallow(<UnauthContent />);
      
          const text = wrapper.text();
      src/applications/static-pages/health-care-manage-benefits/schedule-view-va-appointments-page/components/AuthContent/index.unit.spec.js on lines 8..33
      src/applications/static-pages/health-care-manage-benefits/view-test-and-lab-results-page/components/AuthContent/index.unit.spec.js on lines 8..28
      src/applications/static-pages/health-care-manage-benefits/view-test-and-lab-results-page/components/UnauthContent/index.unit.spec.js on lines 8..29

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

      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 4 locations. Consider refactoring.
      Open

      describe('Scheduling Page <AuthContent>', () => {
        it('renders what we expect', () => {
          const wrapper = shallow(<AuthContent />);
      
          const text = wrapper.text();
      src/applications/static-pages/health-care-manage-benefits/secure-messaging-page/components/UnauthContent/index.unit.spec.js on lines 8..31
      src/applications/static-pages/health-care-manage-benefits/view-test-and-lab-results-page/components/AuthContent/index.unit.spec.js on lines 8..28
      src/applications/static-pages/health-care-manage-benefits/view-test-and-lab-results-page/components/UnauthContent/index.unit.spec.js on lines 8..29

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

      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 3 locations. Consider refactoring.
      Open

            {apiCallsComplete &&
              isLoggedIn &&
              isLOA3 === false && (
                <va-alert
                  close-btn-aria-label="Close notification"
      src/applications/survivor-dependent-education-benefit/22-5490/components/IntroductionLogin.jsx on lines 138..172
      src/applications/toe/components/IntroductionLogin.jsx on lines 144..178

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

      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 3 locations. Consider refactoring.
      Open

            {apiCallsComplete &&
              isLoggedIn &&
              isLOA3 === false && (
                <va-alert
                  close-btn-aria-label="Close notification"
      Severity: Major
      Found in src/applications/toe/components/IntroductionLogin.jsx and 2 other locations - About 1 day to fix
      src/applications/my-education-benefits/components/IntroductionLoginV2.jsx on lines 145..179
      src/applications/survivor-dependent-education-benefit/22-5490/components/IntroductionLogin.jsx on lines 138..172

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

      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 3 locations. Consider refactoring.
      Open

            {apiCallsComplete &&
              isLoggedIn &&
              isLOA3 === false && (
                <va-alert
                  close-btn-aria-label="Close notification"
      src/applications/my-education-benefits/components/IntroductionLoginV2.jsx on lines 145..179
      src/applications/toe/components/IntroductionLogin.jsx on lines 144..178

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

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

      import PropTypes from 'prop-types';
      import React from 'react';
      import classNames from 'classnames';
      import Scroll from 'react-scroll';
      import {
      Severity: Major
      Found in src/applications/pre-need-integration/components/DeceasedPersons.jsx - About 1 day to fix

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

        const MailOrFaxFilesContent = () => {
          return (
            <>
              <p>
                We can process your request more quickly if you upload your files here.
        src/applications/pre-need-integration/components/SupportingFilesCollapsibleList.jsx on lines 109..141

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

        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 MailOrFaxFilesContent = () => {
          return (
            <>
              <p>
                We can process your request more quickly if you upload your files here.
        src/applications/pre-need/components/SupportingFilesCollapsibleList.jsx on lines 70..102

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

        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 generateDetailsContent = async (doc, parent, data) => {
          const details = doc.struct('Sect', {
            title: 'Details',
          });
          parent.add(details);
        Severity: Major
        Found in src/platform/pdf/templates/blue_button_report.js and 1 other location - About 1 day to fix
        src/platform/pdf/templates/medical_records.js on lines 74..94

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

        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 generateDetailsContent = async (doc, parent, data, config) => {
          const details = doc.struct('Sect', {
            title: 'Details',
          });
          parent.add(details);
        Severity: Major
        Found in src/platform/pdf/templates/medical_records.js and 1 other location - About 1 day to fix
        src/platform/pdf/templates/blue_button_report.js on lines 300..320

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

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

        import React from 'react';
        import PropTypes from 'prop-types';
        import { connect } from 'react-redux';
        
        // platform level imports

          File debtDetailsCardContent.js has 508 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          import React from 'react';
          import { CONTACTS } from '@department-of-veterans-affairs/component-library/contacts';
          import { endDate } from '../../utils/helpers';
          
          const ContactDMC = () => (

            Function MyVAHealth has 204 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            export default function MyVAHealth() {
              const [{ loadingMessage, isLoading }, setLoadingMessage] = useState(
                defaultMessage,
              );
              const [showDeclineModal, setShowDeclineModal] = useState(false);
            Severity: Major
            Found in src/applications/terms-of-use/components/MyVAHealth.jsx - About 1 day to fix

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

                      {!haveBatteriesBeenOrderedInLastTwoYears &&
                        !areBatterySuppliesEligible && (
                          <va-alert status="info" visible>
                            <h3 slot="headline">
                              Your batteries aren’t available for online ordering
              src/applications/health-care-supply-reordering/components/Batteries.jsx on lines 81..107

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

              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

              Severity
              Category
              Status
              Source
              Language