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 content = {
    details: {
      header: 'Details',
      items: [
        {
src/applications/mhv-medical-records/util/pdfHelpers/notes.js on lines 10..49

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 144.

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

        profile: {
          email: 'vets.gov.user+75@gmail.com',
          firstName: 'MITCHELL',
          middleName: 'G',
          lastName: 'JENKINS',
src/applications/personalization/common/mocks/users/index.js on lines 291..316

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

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

export default function CrisisPanel() {
  return (
    <div
      id="modal-crisisline"
      className="va-overlay va-modal va-modal-large"
Severity: Major
Found in src/platform/site-wide/va-footer/components/CrisisPanel.jsx - About 5 hrs to fix

    Function mapStateToProps has 136 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    function mapStateToProps(state, ownProps) {
      const { formContext } = ownProps;
    
      const { form, askVA } = state;
      const formData = form.data;
    Severity: Major
    Found in src/applications/ask-va/containers/ReviewPage.jsx - About 5 hrs to fix

      Function default has 136 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      export default function(state = INITIAL_STATE, action) {
        const newState = {
          ...state,
          loadFromUrl: false, // set this to false anytime a user action happens
        };
      Severity: Major
      Found in src/applications/gi/reducers/search.js - About 5 hrs to fix

        Function Vitals has 136 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        const Vitals = () => {
          const dispatch = useDispatch();
          const updatedRecordList = useSelector(state => state.mr.vitals.updatedList);
          const listState = useSelector(state => state.mr.vitals.listState);
          const vitals = useSelector(state => state.mr.vitals.vitalsList);
        Severity: Major
        Found in src/applications/mhv-medical-records/containers/Vitals.jsx - About 5 hrs to fix

          Function ResultsList has a Cognitive Complexity of 36 (exceeds 5 allowed). Consider refactoring.
          Open

          export const ResultsList = ({
            facilityTypeName,
            inProgress,
            searchString,
            results,
          Severity: Minor
          Found in src/applications/facility-locator/components/ResultsList.jsx - About 5 hrs 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

          Function ZipCodePage has a Cognitive Complexity of 36 (exceeds 5 allowed). Consider refactoring.
          Open

          const ZipCodePage = ({
            editMode,
            pastMode,
            router,
            toggleEditMode,
          Severity: Minor
          Found in src/applications/income-limits/containers/ZipCodePage.jsx - About 5 hrs 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

          Function SearchPage has a Cognitive Complexity of 36 (exceeds 5 allowed). Consider refactoring.
          Open

          const SearchPage = props => {
            const searchResultTitleRef = useRef(null);
            const previousLocationInputString = useRef(
              props.currentQuery.locationInputString,
            );
          Severity: Minor
          Found in src/applications/representative-search/containers/SearchPage.jsx - About 5 hrs 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

          File ContactInfo.jsx has 392 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          import React, { useEffect, useState, useRef } from 'react';
          import { useSelector } from 'react-redux';
          import PropTypes from 'prop-types';
          import { Link } from 'react-router';
          import { Element } from 'react-scroll';

            Function prefillTransformerV3 has 135 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            export function prefillTransformerV3(pages, formData, metadata, state) {
              const bankInformation = state.data?.bankInformation || {};
              const claimant = state.data?.formData?.data?.attributes?.claimant || {};
              const exclusionPeriods = Array.isArray(state.data?.exclusionPeriods)
                ? state.data?.exclusionPeriods
            Severity: Major
            Found in src/applications/my-education-benefits/helpers.js - About 5 hrs to fix

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

                render() {
                  return (
                    <div className="schemaform-intro">
                      <FormTitle title="Apply for pre-need eligibility determination" />
                      <p>
              Severity: Major
              Found in src/applications/pre-need/components/IntroductionPage.jsx - About 5 hrs to fix

                Function TravelQuestion has 135 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                const TravelQuestion = props => {
                  const { router } = props;
                  const { t } = useTranslation();
                  const { jumpToPage, goToNextPage } = useFormRouting(router);
                  const selectVeteranData = useMemo(makeSelectVeteranData, []);
                Severity: Major
                Found in src/applications/check-in/day-of/pages/TravelReview.jsx - About 5 hrs to fix

                  Function Edit has 135 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  export const Edit = () => {
                    const dispatch = useDispatch();
                    const history = useHistory();
                    const query = useQuery();
                  
                  
                  Severity: Major
                  Found in src/applications/personalization/profile/components/edit/Edit.jsx - About 5 hrs to fix

                    Function AdmissionAndDischargeDetails has 135 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                    const AdmissionAndDischargeDetails = props => {
                      const { record, runningUnitTest } = props;
                      const user = useSelector(state => state.user.profile);
                      const allowTxtDownloads = useSelector(
                        state =>

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

                              it('renders correct subtitle when pre check in is complete', () => {
                                const getPreCheckinCompleteStub = () => {
                                  return { complete: true };
                                };
                                const useStorageStub = sinon
                      src/applications/check-in/components/pages/AppointmentDetails/AppointmentDetails.unit.spec.jsx on lines 277..296
                      src/applications/check-in/components/pages/AppointmentDetails/AppointmentDetails.unit.spec.jsx on lines 342..361
                      src/applications/check-in/components/pages/AppointmentDetails/AppointmentDetails.unit.spec.jsx on lines 476..495

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

                      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 validateEffectiveDate = (errors, dateString) => {
                        const effectiveDate = moment(dateString);
                        const minDate = moment().subtract(1, 'year');
                        const maxDate = moment().add(180, 'day');
                      
                      
                      Severity: Major
                      Found in src/applications/toe/utils/validation.js and 1 other location - About 5 hrs to fix
                      src/applications/my-education-benefits/utils/validation.js on lines 47..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 143.

                      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

                              it('renders correct subtitle when pre check in is complete', () => {
                                const getPreCheckinCompleteStub = () => {
                                  return { complete: true };
                                };
                                const useStorageStub = sinon
                      src/applications/check-in/components/pages/AppointmentDetails/AppointmentDetails.unit.spec.jsx on lines 277..296
                      src/applications/check-in/components/pages/AppointmentDetails/AppointmentDetails.unit.spec.jsx on lines 342..361
                      src/applications/check-in/components/pages/AppointmentDetails/AppointmentDetails.unit.spec.jsx on lines 431..450

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

                      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 validateEffectiveDate = (errors, dateString) => {
                        const effectiveDate = moment(dateString);
                        const minDate = moment().subtract(1, 'year');
                        const maxDate = moment().add(180, 'day');
                      
                      
                      Severity: Major
                      Found in src/applications/my-education-benefits/utils/validation.js and 1 other location - About 5 hrs to fix
                      src/applications/toe/utils/validation.js on lines 79..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 143.

                      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

                              it('renders review button when appointment is not upcoming and pre-check-in is not complete', () => {
                                const getPreCheckinCompleteStub = () => {
                                  return { complete: false };
                                };
                                const useStorageStub = sinon
                      src/applications/check-in/components/pages/AppointmentDetails/AppointmentDetails.unit.spec.jsx on lines 342..361
                      src/applications/check-in/components/pages/AppointmentDetails/AppointmentDetails.unit.spec.jsx on lines 431..450
                      src/applications/check-in/components/pages/AppointmentDetails/AppointmentDetails.unit.spec.jsx on lines 476..495

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

                      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