department-of-veterans-affairs/vets-website

View on GitHub

Showing 4,177 of 14,709 total issues

Function renderResultItems has 112 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  const renderResultItems = (searchQuery, apiResults) => {
    return apiResults?.map((result, index) => {
      let item;
      const showHealthConnectNumber = isHealthAndHealthConnect(result, query);

Severity: Major
Found in src/applications/facility-locator/components/ResultsList.jsx - About 4 hrs to fix

    Function guardianInformation has 112 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    export default function guardianInformation(schema, options) {
      // Use the defaults as necessary, but override with the options given
      const { fields, required } = {
        ...defaults(),
        ...options,
    Severity: Major
    Found in src/applications/edu-benefits/1995/pages/guardianInformation.jsx - About 4 hrs to fix

      Function getGroupedPreviousEnrollmentsDGIB has 112 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      export const getGroupedPreviousEnrollmentsDGIB = enrollment => {
        const {
          verificationBeginDate,
          verificationEndDate,
          verificationMethod,
      Severity: Major
      Found in src/applications/verify-your-enrollment/helpers.jsx - About 4 hrs to fix

        Function prefillTransformerV1 has 112 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        export function prefillTransformerV1(pages, formData, metadata, state) {
          const bankInformation = state.data?.bankInformation || {};
          const claimant = state.data?.formData?.data?.attributes?.claimant || {};
          const contactInfo = claimant?.contactInfo || {};
          const sponsors = state.data?.formData?.attributes?.sponsors;
        Severity: Major
        Found in src/applications/toe/helpers.jsx - About 4 hrs to fix

          Function FacilityPatientSatisfactionScoresWidget has 112 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          export function FacilityPatientSatisfactionScoresWidget(props) {
            if (props.loading || !Object.keys(props.facility).length) {
              return (
                <va-loading-indicator message="Loading facility patient satisfaction scores..." />
              );

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

              render() {
                const {
                  deriveResultsEndNumber,
                  deriveResultsStartNumber,
                  onPageSelect,
            Severity: Major
            Found in src/applications/yellow-ribbon/containers/SearchResults/index.jsx - About 4 hrs to fix

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

                render() {
                  const { idSchema, formContext, formData, uiSchema, schema } = this.props;
                  const id = idSchema.$id;
              
                  // wrap matching text in a <span> element

                Function Hub has 112 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                export const Hub = () => {
                  const { label, link } = useSignInServiceProvider();
                  const hasBadAddress = useSelector(hasBadAddressSelector);
                
                  useEffect(() => {
                Severity: Major
                Found in src/applications/personalization/profile/components/hub/Hub.jsx - About 4 hrs to fix

                  Function sharingCardContent has 112 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                    const sharingCardContent = () => {
                      if (statusError) {
                        if (['optin', 'optout'].includes(statusError.type)) {
                          const optInError = statusError.type === 'optin';
                          return (
                  Severity: Major
                  Found in src/applications/mhv-medical-records/containers/SettingsPage.jsx - About 4 hrs to fix

                    File address.js has 353 lines of code (exceeds 250 allowed). Consider refactoring.
                    Open

                    import get from 'platform/utilities/data/get';
                    import set from 'platform/utilities/data/set';
                    import unset from 'platform/utilities/data/unset';
                    import { createSelector } from 'reselect';
                    
                    

                      File AddressValidationModal.jsx has 352 lines of code (exceeds 250 allowed). Consider refactoring.
                      Open

                      import React from 'react';
                      import PropTypes from 'prop-types';
                      import { connect } from 'react-redux';
                      import { bindActionCreators } from 'redux';
                      import {

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

                          render() {
                            const { showWizard } = this.props;
                        
                            if (showWizard === undefined) return null;
                            return (
                        Severity: Major
                        Found in src/applications/edu-benefits/1990/containers/IntroductionPage.jsx - About 4 hrs to fix

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

                          export default function ReviewPage() {
                            const pageTitle = useSelector(state => getPageTitle(state, pageKey));
                          
                            const dispatch = useDispatch();
                            const {
                          Severity: Major
                          Found in src/applications/vaos/new-appointment/components/ReviewPage/index.jsx - About 4 hrs to fix

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

                              const content = () => {
                                if (labAndTestDetails) {
                                  return (
                                    <>
                                      <PrintHeader />

                              Function MedicationsList has 111 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                              const MedicationsList = props => {
                                const history = useHistory();
                                const {
                                  isFullList,
                                  rxList,

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

                                import sinon from 'sinon';
                                import { expect } from 'chai';
                                import { rest } from 'msw';
                                import { setupServer } from 'msw/node';
                                
                                

                                  Function paginatedThreads has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring.
                                  Open

                                  const paginatedThreads = (req, res) => {
                                    const { index } = req.params;
                                    const { pageSize, pageNumber, sortField, sortOrder } = req.query;
                                  
                                    const sortFunc = (a, b) => {
                                  Severity: Minor
                                  Found in src/platform/mhv/api/mocks/secure-messaging/threads/index.js - About 4 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 validateAddress has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring.
                                  Open

                                  export const validateAddress = (
                                    route,
                                    method,
                                    fieldName,
                                    inputAddress,
                                  Severity: Minor
                                  Found in src/platform/user/profile/vap-svc/actions/transactions.js - About 4 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 MissingFileOverview has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring.
                                  Open

                                  export default function MissingFileOverview({
                                    contentAfterButtons,
                                    data,
                                    goBack,
                                    goForward,

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

                                  const FileInput = props => {
                                    const {
                                      attachments,
                                      setAttachments,
                                      setAttachFileSuccess,

                                  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

                                  Severity
                                  Category
                                  Status
                                  Source
                                  Language