department-of-veterans-affairs/vets-website

View on GitHub

Showing 3,723 of 12,673 total issues

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

import React from 'react';
import moment from 'moment';
import { DATE_TIMESTAMP, formFields } from './constants';
import { getSchemaCountryCode } from './utils/form-submit-transform';

Severity: Major
Found in src/applications/my-education-benefits/helpers.js - About 1 day to fix

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

    export const addressUISchema = (
      isMilitaryBaseAddress = false,
      path,
      callback,
    ) => {

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

      export const addressUISchema = (
        isMilitaryBaseAddress = false,
        path,
        callback,
      ) => {

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

        export default function ReviewPage(props) {
          const state = useFormikContext();
          const location = useLocation();
        
          useLayoutEffect(() => scrollToSection(location), [location]);
        Severity: Major
        Found in src/applications/burial-poc-v6/pages/ReviewPage.jsx - About 1 day to fix

          Function getAlertContent has 349 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          export function getAlertContent(alert, appealIsActive) {
            const { type, details } = alert;
          
            switch (type) {
              case ALERT_TYPES.form9Needed: {
          Severity: Major
          Found in src/applications/claims-status/utils/appeals-v2-helpers.jsx - About 1 day to fix

            Function returnAddressUI has 346 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              return (function returnAddressUI() {
                return {
                  [MILITARY_BASE_PATH]: {
                    'ui:title': `${checkBoxTitleState} receive mail outside of the United States on a U.S. military base.`,
                    'ui:options': {

              Function returnAddressUI has 346 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                return (function returnAddressUI() {
                  return {
                    [MILITARY_BASE_PATH]: {
                      'ui:title': `${checkBoxTitleState} receive mail outside of the United States on a U.S. military base.`,
                      'ui:options': {

                File selectors.js has 742 lines of code (exceeds 250 allowed). Consider refactoring.
                Open

                import { createSelector } from 'reselect';
                import { selectIsCernerOnlyPatient } from 'platform/user/cerner-dsot/selectors';
                import moment from 'moment';
                import { selectCernerFacilityIds } from 'platform/site-wide/drupal-static-data/source-files/vamc-ehr/selectors';
                import { lowerCase } from 'lodash';
                Severity: Major
                Found in src/applications/vaos/appointment-list/redux/selectors.js - About 1 day to fix

                  File SearchApp.jsx has 733 lines of code (exceeds 250 allowed). Consider refactoring.
                  Open

                  import React from 'react';
                  import PropTypes from 'prop-types';
                  import { withRouter } from 'react-router';
                  import { connect } from 'react-redux';
                  import { getDay, getHours, setHours, setMinutes, setSeconds } from 'date-fns';
                  Severity: Major
                  Found in src/applications/search/containers/SearchApp.jsx - About 1 day to fix

                    File AppointmentDetails.unit.spec.jsx has 727 lines of code (exceeds 250 allowed). Consider refactoring.
                    Open

                    /* eslint-disable camelcase */
                    import React from 'react';
                    import sinon from 'sinon';
                    import { expect } from 'chai';
                    import { render } from '@testing-library/react';

                      Function CustomPage has 335 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                        function CustomPage(props) {
                          const {
                            index: updateItemIndex,
                            nounSingular: updatedNounSingular,
                          } = getUpdatedItemFromPath();

                        Function parseLabsAndTests has a Cognitive Complexity of 83 (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 SearchControls has 331 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                        const SearchControls = props => {
                          const {
                            currentQuery,
                            onChange,
                            onSubmit,
                        Severity: Major
                        Found in src/applications/facility-locator/components/SearchControls.jsx - About 1 day to fix

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

                          const IntroductionPage = props => {
                            const { route, toggleLoginModal, loggedIn } = props;
                            const { formConfig, pageList, pathname, formData } = route;
                            const [inquiryData, setInquiryData] = useState(false);
                            const [searchReferenceNumber, setSearchReferenceNumber] = useState('');
                          Severity: Major
                          Found in src/applications/ask-va/containers/IntroductionPage.jsx - About 1 day to fix

                            Function StatusDropdown has 323 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                            const StatusDropdown = props => {
                              const { status } = props;
                            
                              const content = () => {
                                switch (status) {
                            Severity: Major
                            Found in src/applications/mhv-medications/components/shared/StatusDropdown.jsx - About 1 day to fix

                              File polyfill-timezone-data.js has 704 lines of code (exceeds 250 allowed). Consider refactoring.
                              Open

                              /**
                               * Everything in here is copied from @formatjs/intl-datetimeformat (add-all-tz
                               * and locale-data/en) and pared down as small as possible (in theory).
                               */
                              
                              
                              Severity: Major
                              Found in src/platform/polyfills/polyfill-timezone-data.js - About 1 day to fix

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

                                import React from 'react';
                                import * as Sentry from '@sentry/browser';
                                
                                import { recordEvent } from '@department-of-veterans-affairs/platform-monitoring/exports';
                                import { apiRequest } from '@department-of-veterans-affairs/platform-utilities/exports';
                                Severity: Major
                                Found in src/applications/claims-status/actions/index.js - About 1 day to fix

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

                                  import fullSchema from 'vets-json-schema/dist/21-526EZ-ALLCLAIMS-schema.json';
                                  
                                  import environment from '@department-of-veterans-affairs/platform-utilities/environment';
                                  
                                  import FormFooter from '@department-of-veterans-affairs/platform-forms/FormFooter';
                                  Severity: Major
                                  Found in src/applications/disability-benefits/all-claims/config/form.js - About 1 day to fix

                                    Function VitalDetails has 319 lines of code (exceeds 25 allowed). Consider refactoring.
                                    Open

                                    const VitalDetails = props => {
                                      const { runningUnitTest } = props;
                                      const records = useSelector(state => state.mr.vitals.vitalDetails);
                                      const vitalsList = useSelector(state => state.mr.vitals.vitalsList);
                                      const user = useSelector(state => state.user.profile);
                                    Severity: Major
                                    Found in src/applications/mhv-medical-records/containers/VitalDetails.jsx - About 1 day to fix

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

                                        const content = () => {
                                          switch (status) {
                                            case dispStatusObj.active: {
                                              const dropdownContent = () => {
                                                return (
                                      Severity: Major
                                      Found in src/applications/mhv-medications/components/shared/StatusDropdown.jsx - About 1 day to fix
                                        Severity
                                        Category
                                        Status
                                        Source
                                        Language