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();
- Read upRead up
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:';
}
- Read upRead up
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,
- Read upRead up
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 {
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';
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,
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);
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, []);
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,
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';
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) {
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.
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'];
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';