department-of-veterans-affairs/vets-website

View on GitHub

Showing 4,231 of 14,884 total issues

Function SpousePayrollDeductionInputList has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
Open

const SpousePayrollDeductionInputList = props => {
  const { goToPath, goBack, setFormData } = props;

  const editIndex = getJobIndex();

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

export function formatDescription(description, location = '') {
  if (!description || !description.text) {
    return 'DESCRIPTION:';
  }

Severity: Minor
Found in src/applications/vaos/utils/calendar.js - About 3 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 handleSort has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
Open

export const handleSort = (
  id,
  sortedPrograms,
  yellowRibbonColumns,
  setSortConfig,
Severity: Minor
Found in src/applications/gi/components/profile/YellowRibbonTable.jsx - About 3 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 index.jsx has 302 lines of code (exceeds 250 allowed). Consider refactoring.
Open

/* eslint-disable react/sort-prop-types */
/* eslint-disable react/static-property-placement */
// Dependencies.
import React, { Component } from 'react';
import {
Severity: Minor
Found in src/applications/yellow-ribbon/containers/SearchResults/index.jsx - About 3 hrs to fix

    File Profile.jsx has 302 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    import React, { Component } from 'react';
    import PropTypes from 'prop-types';
    import { connect } from 'react-redux';
    import { BrowserRouter, Route, Switch, Redirect } from 'react-router-dom';
    import { LastLocationProvider } from 'react-router-last-location';
    Severity: Minor
    Found in src/applications/personalization/profile/components/Profile.jsx - About 3 hrs to fix

      Function FileFieldCustom has 81 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      export function FileFieldCustom(props) {
        const updateButton = (
          // eslint-disable-next-line @department-of-veterans-affairs/prefer-button-component
          <button type="submit" onClick={props.updatePage}>
            Update page

        Function renderResultsSection has 81 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          const renderResultsSection = () => {
            const {
              currentQuery,
              searchResults,
              pagination,
        Severity: Major
        Found in src/applications/representative-search/containers/SearchPage.jsx - About 3 hrs to fix

          Function usePostTravelOnlyClaim has 81 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          const usePostTravelOnlyClaim = props => {
            const { router } = props;
            const { jumpToPage } = useFormRouting(router);
            const [isLoading, setIsLoading] = useState(false);
            const [isComplete, setIsComplete] = useState(false);
          Severity: Major
          Found in src/applications/check-in/hooks/usePostTravelOnlyClaim.jsx - About 3 hrs to fix

            Function useFormRouting has 81 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            const useFormRouting = (router = {}) => {
              const selectForm = useMemo(makeSelectForm, []);
              const { pages, data } = useSelector(selectForm);
            
              const selectApp = useMemo(makeSelectApp, []);
            Severity: Major
            Found in src/applications/check-in/hooks/useFormRouting.jsx - About 3 hrs to fix

              Function FileUpload has 81 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              const FileUpload = props => {
                const {
                  acceptFileTypes = '.pdf,.jpeg,.png,.jpg',
                  buttonText = 'Upload file',
                  error,
              Severity: Major
              Found in src/applications/ask-va/components/FileUpload.jsx - About 3 hrs to fix

                File actions.js has 301 lines of code (exceeds 250 allowed). Consider refactoring.
                Open

                import * as Sentry from '@sentry/browser';
                
                import recordEvent from '../../monitoring/record-event';
                import { logOut } from '../../user/authentication/actions';
                import { apiRequest } from '../../utilities/api';
                Severity: Minor
                Found in src/platform/forms/save-in-progress/actions.js - About 3 hrs to fix

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

                  import React from 'react';
                  import { expect } from 'chai';
                  import { renderWithStoreAndRouter } from '~/platform/testing/unit/react-testing-library-helpers';
                  import AppointmentCardIcon from './AppointmentCardIcon';
                  
                  

                    Function OfficialGovtWebsite has 80 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                    export const OfficialGovtWebsite = () => {
                      const [expanded, setExpanded] = useState(false);
                    
                      const onToggle = () => {
                        if (expanded) {
                    Severity: Major
                    Found in src/platform/site-wide/header/components/OfficialGovtWebsite/index.js - About 3 hrs to fix

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

                        render() {
                          const { route } = this.props;
                          const { formConfig, pageList } = route;
                      
                          return (

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

                          render() {
                            if (
                              // Prevent RUM from running on local/CI environments.
                              environment.BASE_URL.indexOf('localhost') < 0 &&
                              // Prevent re-initializing the SDK.
                        Severity: Major
                        Found in src/applications/health-care-supply-reordering/containers/App.jsx - About 3 hrs to fix

                          Function AdditionalConsiderationTemplate has 80 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                          function AdditionalConsiderationTemplate(page, formField, options = {}) {
                            const { title, additionalInfo } = page;
                            const additionalInfoViewName = `view:${page.name}AdditionalInfo`;
                            const displayTypeMapping = {
                              [formFields.federallySponsoredAcademy]: 'Academy',

                            Function priorServiceStatement has 80 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                              const priorServiceStatement = () => {
                                const onDD214LinkClick = () => {
                                  router.push(ROUTES.DD214);
                                };
                            
                            

                              Function onAddFile has 80 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                                const onAddFile = async (event, index = null, password) => {
                                  if (event.target?.files?.length) {
                                    const currentFile = event.target.files[0];
                                    const allFiles = props.formData || [];
                                    const addUiOptions = props.uiSchema['ui:options'];
                              Severity: Major
                              Found in src/applications/pre-need/components/FileField.jsx - About 3 hrs to fix

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

                                  render() {
                                    const { form } = this.props;
                                    const { submission, data } = form;
                                
                                    const submitDate = new Date(submission?.timestamp);

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

                                  import React from 'react';
                                  import footerContent from '@department-of-veterans-affairs/platform-forms/FormFooter';
                                  import { externalServices } from 'platform/monitoring/DowntimeNotification';
                                  import environment from '@department-of-veterans-affairs/platform-utilities/environment';
                                  
                                  
                                  Severity: Minor
                                  Found in src/applications/simple-forms/21-0972/config/form.js - About 3 hrs to fix
                                    Severity
                                    Category
                                    Status
                                    Source
                                    Language