department-of-veterans-affairs/vets-website

View on GitHub

Showing 4,177 of 14,709 total issues

Function addressUI has a Cognitive Complexity of 73 (exceeds 5 allowed). Consider refactoring.
Open

export function addressUI(options) {
  let cachedPath;
  let cityMaxLength = 100;

  const omit = key => options?.omit?.includes(key);

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

export const parseLabsAndTests = records => {
  return `
${txtLine}
1) Lab and test results

Severity: Minor
Found in src/applications/mhv-medical-records/util/txtHelpers/labsAndTests.js - 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

Function SettingsPage has 288 lines of code (exceeds 25 allowed). Consider refactoring.
Open

const SettingsPage = () => {
  const dispatch = useDispatch();

  const fullState = useSelector(state => state);
  const isSharing = useSelector(state => state.mr.sharing.isSharing);
Severity: Major
Found in src/applications/mhv-medical-records/containers/SettingsPage.jsx - About 1 day to fix

    File VideoLayoutAtlas.unit.spec.js has 646 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    import React from 'react';
    import { expect } from 'chai';
    import {
      createTestStore,
      renderWithStoreAndRouter,
    Severity: Major
    Found in src/applications/vaos/components/layout/VideoLayoutAtlas.unit.spec.js - About 1 day to fix

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

        render() {
          const { route, loggedIn, formId, isBDDForm, showWizard } = this.props;
          const { formConfig, pageList } = route;
          const pageTitle = `${getPageTitle(isBDDForm)} ${PAGE_TITLE_SUFFIX}`;
          const startText = getStartText(isBDDForm);

        File form.js has 644 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        import { merge, omit } from 'lodash';
        import get from 'platform/utilities/data/get';
        
        import fullSchema5490 from 'vets-json-schema/dist/22-5490-schema.json';
        import currentOrPastDateUI from 'platform/forms-system/src/js/definitions/currentOrPastDate';
        Severity: Major
        Found in src/applications/edu-benefits/5490/config/form.js - About 1 day to fix

          File index.js has 640 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          import React from 'react';
          import { CONTACTS } from '@department-of-veterans-affairs/component-library/contacts';
          import { VaTelephone } from '@department-of-veterans-affairs/component-library/dist/react-bindings';
          import { endDate } from '../../utils/helpers';
          
          

            Function InstallmentContract has 284 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            const InstallmentContract = props => {
              const { data, goToPath, setFormData } = props;
            
              const { installmentContracts = [] } = data;
            
            

              File index.unit.spec.js has 638 lines of code (exceeds 250 allowed). Consider refactoring.
              Open

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

                File formFlowHelper.js has 636 lines of code (exceeds 250 allowed). Consider refactoring.
                Open

                import _ from 'lodash';
                import {
                  CategoryEducation,
                  CHAPTER_2,
                  CHAPTER_3,
                Severity: Major
                Found in src/applications/ask-va/config/schema-helpers/formFlowHelper.js - About 1 day to fix

                  Function ReviewPage has 280 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  const ReviewPage = props => {
                    const [showAlert, setShowAlert] = useState(true);
                    const [isDisabled, setIsDisabled] = useState(false);
                    const dispatch = useDispatch();
                  
                  
                  Severity: Major
                  Found in src/applications/ask-va/containers/ReviewPage.jsx - About 1 day to fix

                    Function IntroductionPage has 278 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                    const IntroductionPage = props => {
                      const { route } = props;
                      const { formConfig, pageList } = route;
                      const { useToggleValue, TOGGLE_NAMES } = useFeatureToggle();
                    
                    
                    Severity: Major
                    Found in src/applications/pensions/components/IntroductionPage.jsx - About 1 day to fix

                      Function content has 278 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                        const content = () => {
                          if (prescription) {
                            const dispStatus = prescription.dispStatus?.toString();
                            return (
                              <>

                        File FacilitiesMap.jsx has 629 lines of code (exceeds 250 allowed). Consider refactoring.
                        Open

                        import React, { useEffect, useRef, useState } from 'react';
                        import { connect } from 'react-redux';
                        import appendQuery from 'append-query';
                        import mapboxgl from 'mapbox-gl';
                        import 'mapbox-gl/dist/mapbox-gl.css';
                        Severity: Major
                        Found in src/applications/facility-locator/containers/FacilitiesMap.jsx - About 1 day to fix

                          File index.unit.spec.js has 627 lines of code (exceeds 250 allowed). Consider refactoring.
                          Open

                          /* eslint-disable no-plusplus */
                          import React from 'react';
                          import { expect } from 'chai';
                          
                          import {

                            Function addressUISchema has 274 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                            export const addressUISchema = (
                              isMilitaryBaseAddress = false,
                              path,
                              callback,
                            ) => {
                            Severity: Major
                            Found in src/applications/disability-benefits/2346/schemas/address-schema.js - About 1 day to fix

                              Function FacilitiesMap has a Cognitive Complexity of 69 (exceeds 5 allowed). Consider refactoring.
                              Open

                              const FacilitiesMap = props => {
                                const [map, setMap] = useState(null);
                                const searchResultTitleRef = useRef(null);
                                const searchResultMessageRef = useRef();
                                const [isMobile, setIsMobile] = useState(window.innerWidth <= 481);
                              Severity: Minor
                              Found in src/applications/facility-locator/containers/FacilitiesMap.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

                              File form.jsx has 620 lines of code (exceeds 250 allowed). Consider refactoring.
                              Open

                              import React from 'react';
                              
                              import { merge } from 'lodash';
                              import get from 'platform/utilities/data/get';
                              
                              
                              Severity: Major
                              Found in src/applications/pre-need/config/form.jsx - About 1 day to fix

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

                                  render() {
                                    const {
                                      enableShortWorkflow,
                                      errorSchema,
                                      formContext,

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

                                    render() {
                                      const {
                                        enableShortWorkflow,
                                        errorSchema,
                                        formContext,
                                  Severity: Major
                                  Found in src/applications/lgy/coe/form/config/chapters/documents/FileField.jsx - About 1 day to fix
                                    Severity
                                    Category
                                    Status
                                    Source
                                    Language