department-of-veterans-affairs/vets-website

View on GitHub

Showing 3,724 of 12,675 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 ReviewCardField has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
Open

const ReviewCardField = ({
  uiSchema,
  schema,
  errorSchema,
  idSchema,

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

const AttachmentsList = props => {
  const {
    attachments,
    compose,
    draftSequence,
Severity: Minor
Found in src/applications/mhv-secure-messaging/components/AttachmentsList.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

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

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

import React, {
  useEffect,
  useRef,
  useState,
  useCallback,
Severity: Minor
Found in src/applications/gi/containers/ComparePage.jsx - About 3 hrs to fix

    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

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

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

        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 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 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 fieldEntries has 81 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                const fieldEntries = (key, uiSchema, data, schema, schemaFromState) => {
                  if (key.startsWith('view:') || key.startsWith('ui:')) return null;
                  if (schema.properties[key] === undefined || !uiSchema) return null;
                
                  const {

                  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

                    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

                      File RoutedSavableApp.jsx has 300 lines of code (exceeds 250 allowed). Consider refactoring.
                      Open

                      import React from 'react';
                      import PropTypes from 'prop-types';
                      import Scroll from 'react-scroll';
                      import { withRouter } from 'react-router';
                      import { connect } from 'react-redux';
                      Severity: Minor
                      Found in src/platform/forms/save-in-progress/RoutedSavableApp.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 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);

                              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/simple-forms/40-0247/components/FileField.jsx - About 3 hrs to fix

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

                                const ApplicationDownloadLink = () => {
                                  const [loading, isLoading] = useState(false);
                                  const [errors, setErrors] = useState([]);
                                
                                  // define local use variables
                                Severity: Major
                                Found in src/applications/caregivers/components/ApplicationDownloadLink.jsx - About 3 hrs to fix
                                  Severity
                                  Category
                                  Status
                                  Source
                                  Language