department-of-veterans-affairs/vets-website

View on GitHub

Showing 12,808 of 12,808 total issues

Function arrayBuilderPages has a Cognitive Complexity of 34 (exceeds 5 allowed). Consider refactoring.
Open

export function arrayBuilderPages(options, pageBuilderCallback) {
  let introPath;
  let summaryPath;
  let hasItemsKey;
  const itemPages = [];

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 AppointmentMessage has a Cognitive Complexity of 34 (exceeds 5 allowed). Consider refactoring.
Open

const AppointmentMessage = props => {
  const { appointment, page } = props;
  const { t } = useTranslation();

  const defaultMessage = t(

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 CreditCardBill has a Cognitive Complexity of 34 (exceeds 5 allowed). Consider refactoring.
Open

const CreditCardBill = props => {
  const { data, goToPath, setFormData } = props;

  const { expenses } = data;
  const { creditCardBills = [] } = expenses;

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 EmploymentRecord has a Cognitive Complexity of 34 (exceeds 5 allowed). Consider refactoring.
Open

const EmploymentRecord = props => {
  const { data, goToPath, setFormData } = props;

  const editIndex = getJobIndex();

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 EmploymentRecord has a Cognitive Complexity of 34 (exceeds 5 allowed). Consider refactoring.
Open

const EmploymentRecord = props => {
  const { data, goToPath, setFormData } = props;

  const editIndex = getJobIndex();

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 covid19VaccineReducer has a Cognitive Complexity of 34 (exceeds 5 allowed). Consider refactoring.
Open

export default function covid19VaccineReducer(state = initialState, action) {
  switch (action.type) {
    case FORM_PAGE_OPENED: {
      const { newBooking } = state;
      const { data, schema } = setupFormData(
Severity: Minor
Found in src/applications/vaos/covid-19-vaccine/redux/reducer.js - 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 render has 127 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  render() {
    const { showWizard } = this.props;

    if (showWizard === undefined) return null;

Severity: Major
Found in src/applications/edu-benefits/1995/containers/IntroductionPage.jsx - About 5 hrs to fix

    Function getSignlePreviousEnrollments has 127 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    export const getSignlePreviousEnrollments = awards => {
      const myUUID = uuidv4();
      return (
        <div className="vye-top-border" key={myUUID}>
          {awards.transactDate &&
    Severity: Major
    Found in src/applications/verify-your-enrollment/helpers.jsx - About 5 hrs to fix

      Function DependentInformation has 127 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      const DependentInformation = props => {
        const { data, goToPath, setFormData } = props;
      
        const { dependents = [] } = data;
        const search = new URLSearchParams(window.location.search);
      Severity: Major
      Found in src/applications/hca/components/FormPages/DependentInformation.jsx - About 5 hrs to fix

        Function SearchControls has 127 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        const SearchControls = props => {
          const {
            onSubmit,
            locateUser,
            geolocationInProgress,
        Severity: Major
        Found in src/applications/ask-va/components/search/SearchControls.jsx - About 5 hrs to fix

          Function AlertBackgroundBox has 127 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          const AlertBackgroundBox = props => {
            const dispatch = useDispatch();
            const alertList = useSelector(state => state.sm.alerts?.alertList);
            const folder = useSelector(state => state.sm.folders?.folder);
            const [alertContent, setAlertContent] = useState('');

            Function resolveLandingPageLinks has 127 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            const resolveLandingPageLinks = (
              authdWithSSOe = false,
              featureToggles,
              unreadMessageAriaLabel,
              registered = false,
            Severity: Major
            Found in src/applications/mhv-landing-page/utilities/data/index.js - About 5 hrs to fix

              File ComboBox.jsx has 378 lines of code (exceeds 250 allowed). Consider refactoring.
              Open

              // Description: ComboBox component for the disability benefits form.
              import React from 'react';
              import PropTypes from 'prop-types';
              import { VaTextInput } from '@department-of-veterans-affairs/component-library/dist/react-bindings';
              import { fullStringSimilaritySearch } from 'platform/forms-system/src/js/utilities/addDisabilitiesStringSearch';

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

                  it('should not render new layout when feature flag is true and widget type is view_test_and_lab_results_page', () => {
                    const wrapper = shallow(
                      <CernerCallToAction
                        featureStaticLandingPage
                        widgetType={widgetTypes.VIEW_TEST_AND_LAB_RESULTS_PAGE}
                src/applications/static-pages/health-care-manage-benefits/components/CernerCallToAction/index.unit.spec.js on lines 60..79
                src/applications/static-pages/health-care-manage-benefits/components/CernerCallToAction/index.unit.spec.js on lines 104..125
                src/applications/static-pages/health-care-manage-benefits/components/CernerCallToAction/index.unit.spec.js on lines 127..148
                src/applications/static-pages/health-care-manage-benefits/components/CernerCallToAction/index.unit.spec.js on lines 150..171

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

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

                export const getCareSummariesAndNotesList = (
                  isCurrent = false,
                ) => async dispatch => {
                  dispatch({
                    type: Actions.CareSummariesAndNotes.UPDATE_LIST_STATE,
                src/applications/mhv-medical-records/actions/allergies.js on lines 8..24
                src/applications/mhv-medical-records/actions/conditions.js on lines 8..24
                src/applications/mhv-medical-records/actions/vaccines.js on lines 8..25
                src/applications/mhv-medical-records/actions/vitals.js on lines 8..24

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

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

                export const getVaccinesList = (isCurrent = false) => async dispatch => {
                  dispatch({
                    type: Actions.Vaccines.UPDATE_LIST_STATE,
                    payload: Constants.loadStates.FETCHING,
                  });
                Severity: Major
                Found in src/applications/mhv-medical-records/actions/vaccines.js and 4 other locations - About 5 hrs to fix
                src/applications/mhv-medical-records/actions/allergies.js on lines 8..24
                src/applications/mhv-medical-records/actions/careSummariesAndNotes.js on lines 8..26
                src/applications/mhv-medical-records/actions/conditions.js on lines 8..24
                src/applications/mhv-medical-records/actions/vitals.js on lines 8..24

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

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

                  it('should not render new layout when feature flag is true and widget type is secure_messaging_page', () => {
                    const wrapper = shallow(
                      <CernerCallToAction
                        featureStaticLandingPage
                        widgetType={widgetTypes.SECURE_MESSAGING_PAGE}
                src/applications/static-pages/health-care-manage-benefits/components/CernerCallToAction/index.unit.spec.js on lines 60..79
                src/applications/static-pages/health-care-manage-benefits/components/CernerCallToAction/index.unit.spec.js on lines 104..125
                src/applications/static-pages/health-care-manage-benefits/components/CernerCallToAction/index.unit.spec.js on lines 150..171
                src/applications/static-pages/health-care-manage-benefits/components/CernerCallToAction/index.unit.spec.js on lines 173..194

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

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

                export const getVitals = (isCurrent = false) => async dispatch => {
                  dispatch({
                    type: Actions.Vitals.UPDATE_LIST_STATE,
                    payload: Constants.loadStates.FETCHING,
                  });
                Severity: Major
                Found in src/applications/mhv-medical-records/actions/vitals.js and 4 other locations - About 5 hrs to fix
                src/applications/mhv-medical-records/actions/allergies.js on lines 8..24
                src/applications/mhv-medical-records/actions/careSummariesAndNotes.js on lines 8..26
                src/applications/mhv-medical-records/actions/conditions.js on lines 8..24
                src/applications/mhv-medical-records/actions/vaccines.js on lines 8..25

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

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

                export const getAllergiesList = (isCurrent = false) => async dispatch => {
                  dispatch({
                    type: Actions.Allergies.UPDATE_LIST_STATE,
                    payload: Constants.loadStates.FETCHING,
                  });
                Severity: Major
                Found in src/applications/mhv-medical-records/actions/allergies.js and 4 other locations - About 5 hrs to fix
                src/applications/mhv-medical-records/actions/careSummariesAndNotes.js on lines 8..26
                src/applications/mhv-medical-records/actions/conditions.js on lines 8..24
                src/applications/mhv-medical-records/actions/vaccines.js on lines 8..25
                src/applications/mhv-medical-records/actions/vitals.js on lines 8..24

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

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

                export const getConditionsList = (isCurrent = false) => async dispatch => {
                  dispatch({
                    type: Actions.Conditions.UPDATE_LIST_STATE,
                    payload: Constants.loadStates.FETCHING,
                  });
                Severity: Major
                Found in src/applications/mhv-medical-records/actions/conditions.js and 4 other locations - About 5 hrs to fix
                src/applications/mhv-medical-records/actions/allergies.js on lines 8..24
                src/applications/mhv-medical-records/actions/careSummariesAndNotes.js on lines 8..26
                src/applications/mhv-medical-records/actions/vaccines.js on lines 8..25
                src/applications/mhv-medical-records/actions/vitals.js on lines 8..24

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

                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