department-of-veterans-affairs/vets-website

View on GitHub

Showing 3,724 of 12,675 total issues

File covidResearchUISchema.js has 632 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import React from 'react';

import { validateBooleanGroup } from 'platform/forms-system/src/js/validation';
import currentOrPastMonthYearUI from 'platform/forms-system/src/js/definitions/currentOrPastMonthYear';
import MonthYearUI from 'platform/forms-system/src/js/definitions/monthYear';

    Function IntroductionPage has 276 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

      File index.jsx has 626 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      import React from 'react';
      import moment from 'moment';
      import { differenceInYears } from 'date-fns';
      import * as options from 'platform/static-data/options-for-select';
      import {
      Severity: Major
      Found in src/applications/discharge-wizard/helpers/index.jsx - About 1 day to fix

        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 [isMobile, setIsMobile] = useState(window.innerWidth <= 481);
            const [isSearching, setIsSearching] = useState(false);
          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,
            Severity: Major
            Found in src/applications/lgy/coe/form/config/chapters/documents/FileField.jsx - About 1 day to fix

              File index.jsx has 617 lines of code (exceeds 250 allowed). Consider refactoring.
              Open

              import React from 'react';
              import { APP_URLS, LAST_YEAR } from '../../utils/constants';
              
              /** CHAPTER 1: Veteran Information */
              export const BirthInfoDescription = (
              Severity: Major
              Found in src/applications/hca/components/FormDescriptions/index.jsx - About 1 day to fix

                Function AttachmentsList has 269 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                const AttachmentsList = props => {
                  const {
                    attachments,
                    compose,
                    draftSequence,
                Severity: Major
                Found in src/applications/mhv-secure-messaging/components/AttachmentsList.jsx - About 1 day to fix

                  File FileField.jsx has 613 lines of code (exceeds 250 allowed). Consider refactoring.
                  Open

                  /* eslint-disable jsx-a11y/no-noninteractive-element-to-interactive-role */
                  import PropTypes from 'prop-types';
                  import React, { useEffect, useState, useRef } from 'react';
                  import { connect } from 'react-redux';
                  import classNames from 'classnames';
                  Severity: Major
                  Found in src/platform/forms-system/src/js/fields/FileField.jsx - About 1 day to fix

                    File FacilitiesMap.jsx has 613 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

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

                        render() {
                          const {
                            uiSchema,
                            errorSchema,
                            idSchema,
                      Severity: Major
                      Found in src/applications/pre-need-integration/components/DeceasedPersons.jsx - About 1 day to fix

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

                        import { useEffect, useRef } from 'react';
                        import moment from 'moment';
                        import { intersection, matches, merge, uniq } from 'lodash';
                        import shouldUpdate from 'recompose/shouldUpdate';
                        import { deepEquals } from '@department-of-veterans-affairs/react-jsonschema-form/lib/utils';
                        Severity: Major
                        Found in src/platform/forms-system/src/js/helpers.js - About 1 day to fix

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

                          import React from 'react';
                          
                          import fullSchemaPreNeed from 'vets-json-schema/dist/40-10007-INTEGRATION-schema.json';
                          
                          import environment from 'platform/utilities/environment';
                          Severity: Major
                          Found in src/applications/pre-need-integration/config/form.jsx - About 1 day to fix

                            File constants.js has 603 lines of code (exceeds 250 allowed). Consider refactoring.
                            Open

                            import React from 'react';
                            import { useSelector } from 'react-redux';
                            import { VA_FORM_IDS } from 'platform/forms/constants';
                            
                            export const PrimaryActionLink = ({ href = '/', children, onClick = null }) => (
                            Severity: Major
                            Found in src/applications/simple-forms/21-4138/config/constants.js - About 1 day to fix

                              Function prefillTransformer has a Cognitive Complexity of 66 (exceeds 5 allowed). Consider refactoring.
                              Open

                              export function prefillTransformer(pages, formData, metadata) {
                                const prefillPersonalInformation = data => {
                                  const newData = _.omit(['personalInformation'], data);
                                  const { personalInformation } = data;
                              
                              
                              Severity: Minor
                              Found in src/applications/representative-appoint/prefill-transformer.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

                              File local-vapsvc.js has 600 lines of code (exceeds 250 allowed). Consider refactoring.
                              Open

                              import { uniqueId } from 'lodash';
                              import * as VAP_SERVICE from '../constants';
                              
                              export function isVAProfileServiceConfigured() {
                                return (
                              Severity: Major
                              Found in src/platform/user/profile/vap-svc/util/local-vapsvc.js - About 1 day to fix

                                Function SettingsPage has 260 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

                                  Function render has 259 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);

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

                                    const IntroductionPage = props => {
                                      const { route } = props;
                                      // WIP: need to keep unit-tests passing with these new selector-hooks
                                      const userLoggedIn = useSelector(state => isLoggedIn(state));
                                      const userIdVerified = useSelector(state => isLOA3(state));
                                      Severity
                                      Category
                                      Status
                                      Source
                                      Language