department-of-veterans-affairs/vets-website

View on GitHub

Showing 4,177 of 14,709 total issues

Function navigateForward has a Cognitive Complexity of 50 (exceeds 5 allowed). Consider refactoring.
Open

export const navigateForward = (
  SHORT_NAME,
  formResponses,
  router,
  editMode,
Severity: Minor
Found in src/applications/discharge-wizard/utilities/page-navigation.js - About 7 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

File V3BasePage.jsx has 487 lines of code (exceeds 250 allowed). Consider refactoring.
Open

/**
 * This page is for testing the compatibility of running v3 components without Formation styling.
 */

import React, { useState } from 'react';
Severity: Minor
Found in src/applications/ds-v3-playground/pages/V3BasePage.jsx - About 7 hrs to fix

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

      render() {
        const {
          formIds,
          profile,
          login,
    Severity: Major
    Found in src/platform/forms/save-in-progress/ApplicationStatus.jsx - About 7 hrs to fix

      Function schoolSearch has 192 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      export default function schoolSearch(state = initialState, action) {
        switch (action.type) {
          case INSTITUTION_SELECTED: {
            const {
              address1,
      Severity: Major
      Found in src/applications/edu-benefits/feedback-tool/reducers/schoolSelect.js - About 7 hrs to fix

        File SaveInProgressIntro.jsx has 486 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        import React from 'react';
        import { connect } from 'react-redux';
        import { Link } from 'react-router';
        import PropTypes from 'prop-types';
        import { fromUnixTime, isBefore } from 'date-fns';

          File SchoolSelectField.jsx has 484 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          import React from 'react';
          import PropTypes from 'prop-types';
          import _ from 'lodash';
          import classNames from 'classnames';
          import {

            Function Error has 190 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            const Error = () => {
              const { t } = useTranslation();
              const selectError = useMemo(makeSelectError, []);
              const { error } = useSelector(selectError);
            
            
            Severity: Major
            Found in src/applications/check-in/day-of/pages/Error.jsx - About 7 hrs to fix

              Function SpousePayrollDeductionInputList has 190 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              const SpousePayrollDeductionInputList = props => {
                const { goToPath, goBack, setFormData } = props;
              
                const editIndex = getJobIndex();
              
              

                File SaveInProgressIntro.jsx has 483 lines of code (exceeds 250 allowed). Consider refactoring.
                Open

                import React from 'react';
                import { connect } from 'react-redux';
                import { Link } from 'react-router';
                import PropTypes from 'prop-types';
                import { fromUnixTime, isBefore } from 'date-fns';

                  Function FilterBeforeResults has a Cognitive Complexity of 49 (exceeds 5 allowed). Consider refactoring.
                  Open

                  export function FilterBeforeResults({
                    dispatchFilterChange,
                    dispatchError,
                    filters,
                    modalClose,
                  Severity: Minor
                  Found in src/applications/gi/containers/search/FilterBeforeResults.jsx - About 7 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

                  File SaveInProgressIntro.jsx has 482 lines of code (exceeds 250 allowed). Consider refactoring.
                  Open

                  import React from 'react';
                  import { connect } from 'react-redux';
                  import { Link } from 'react-router';
                  import PropTypes from 'prop-types';
                  import { fromUnixTime, isBefore } from 'date-fns';

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

                      render() {
                        const { onCTALinkClick } = this;
                        const {
                          ehrDataByVhaId,
                          cernerFacilities,

                      Function SmBreadcrumbs has 189 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                      const SmBreadcrumbs = () => {
                        const dispatch = useDispatch();
                        const location = useLocation();
                        const history = useHistory();
                        const activeFolder = useSelector(state => state.sm.folders.folder);

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

                        import { getAppUrl } from '../utilities/registry-helpers';
                        
                        export const VA_FORM_IDS = Object.freeze({
                          FEEDBACK_TOOL: 'FEEDBACK-TOOL',
                          FORM_0873: '0873',
                        Severity: Minor
                        Found in src/platform/forms/constants.js - About 7 hrs to fix

                          Function DevPanel has 188 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                          const DevPanel = () => {
                            const [processes, setProcesses] = useState({});
                            const [output, setOutput] = useState({});
                            const eventSourcesRef = useRef({});
                          
                          

                            File ReviewPage.jsx has 480 lines of code (exceeds 250 allowed). Consider refactoring.
                            Open

                            import {
                              VaAccordion,
                              VaAccordionItem,
                              VaAlert,
                            } from '@department-of-veterans-affairs/component-library/dist/react-bindings';
                            Severity: Minor
                            Found in src/applications/ask-va/containers/ReviewPage.jsx - About 7 hrs to fix

                              Function PayrollDeductionInputList has 188 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                              const PayrollDeductionInputList = props => {
                                const { goToPath, goBack, setFormData } = props;
                              
                                const editIndex = getJobIndex();
                              
                              

                                Function NationalExamsList has 188 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                const NationalExamsList = () => {
                                  const dispatch = useDispatch();
                                  const [currentPage, setCurrentPage] = useState(1);
                                  const itemsPerPage = 5;
                                  const { loading, error, nationalExams } = useSelector(
                                Severity: Major
                                Found in src/applications/gi/containers/NationalExamsList.jsx - About 7 hrs to fix

                                  File SaveInProgressIntro.jsx has 479 lines of code (exceeds 250 allowed). Consider refactoring.
                                  Open

                                  import React from 'react';
                                  import { connect } from 'react-redux';
                                  import { Link } from 'react-router';
                                  import PropTypes from 'prop-types';
                                  import { fromUnixTime, isBefore } from 'date-fns';
                                  Severity: Minor
                                  Found in src/platform/forms/save-in-progress/SaveInProgressIntro.jsx - About 7 hrs to fix

                                    Function template has 187 lines of code (exceeds 25 allowed). Consider refactoring.
                                    Open

                                    const template = (props, title, content, submissionMessage, messageType) => {
                                      const { fullName, disabilities, submittedAt, isSubmittingBDD } = props;
                                      const { first, last, middle, suffix } = fullName;
                                      // This is easier than passing down props and checking if the form type
                                      const pageTitle = document.title.includes('Benefits')
                                      Severity
                                      Category
                                      Status
                                      Source
                                      Language