Showing 4,177 of 14,709 total issues
File NoFormPage.jsx
has 437 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
import React, { useEffect, useState } from 'react';
import { useSelector } from 'react-redux';
import { apiRequest } from 'platform/utilities/api';
import { formatSSN } from 'platform/utilities/ui';
import { isLoggedIn } from '@department-of-veterans-affairs/platform-user/selectors';
Function AddressValidationRadio
has 162 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
const AddressValidationRadio = props => {
const { formData, setFormData } = props;
const [apiData, setApiData] = useState([]);
const [loading, isLoading] = useState(false);
Function submitAppointmentOrRequest
has 162 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export function submitAppointmentOrRequest(history) {
return async (dispatch, getState) => {
const state = getState();
const featureVAOSServiceVAAppointments = selectFeatureVAOSServiceVAAppointments(
state,
Function ChemHemDetails
has 162 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
const ChemHemDetails = props => {
const { record, fullState, runningUnitTest } = props;
const user = useSelector(state => state.user.profile);
const allowTxtDownloads = useSelector(
state =>
File constants.js
has 436 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
export const FETCH_STATUS = {
loading: 'loading',
notStarted: 'notStarted',
succeeded: 'succeeded',
failed: 'failed',
Function Error
has 161 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
const Error = () => {
const { t } = useTranslation();
const selectError = useMemo(makeSelectError, []);
const { error } = useSelector(selectError);
Function SearchForm
has a Cognitive Complexity of 42 (exceeds 5 allowed). Consider refactoring. Open
Open
const SearchForm = props => {
const { folder, keyword, resultsCount, query, threadCount } = props;
const mhvSecureMessagingFilterAccordion = useSelector(
state =>
state.featureToggles[
- 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 form.js
has 434 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
// platform imports
import environment from 'platform/utilities/environment';
import { VA_FORM_IDS } from 'platform/forms/constants';
import { externalServices } from 'platform/monitoring/DowntimeNotification';
import ezrSchema from 'vets-json-schema/dist/10-10EZR-schema.json';
File ReferralsAndRequests.unit.spec.js
has 434 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
import React from 'react';
import userEvent from '@testing-library/user-event';
import moment from 'moment';
import MockDate from 'mockdate';
import { mockFetch } from '@department-of-veterans-affairs/platform-testing/helpers';
Function NoFormPage
has 160 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export const NoFormPage = () => {
const [data, setData] = useState({});
const [loading, setLoading] = useState(true);
const loggedIn = useSelector(isLoggedIn);
Function render
has 160 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
render() {
const { supplies, order, eligibility } = this.props;
const currentDate = moment();
const apneaSupplies = supplies.filter(
supply => supply.productGroup === APNEA,
Function ThreadDetails
has 160 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
const ThreadDetails = props => {
const { threadId } = useParams();
const { testing } = props;
const dispatch = useDispatch();
const location = useLocation();
File form.js
has 433 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
import fullSchema from 'vets-json-schema/dist/686C-674-schema.json';
import environment from 'platform/utilities/environment';
import FormFooter from 'platform/forms/components/FormFooter';
import { externalServices } from 'platform/monitoring/DowntimeNotification';
import { VA_FORM_IDS } from 'platform/forms/constants';
File BackendAppointmentServiceAlert.unit.spec.js
has 433 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
import React from 'react';
import MockDate from 'mockdate';
import { expect } from 'chai';
import moment from 'moment';
import { waitFor } from '@testing-library/dom';
Function DebtDetails
has 159 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
const DebtDetails = () => {
const { selectedDebt, debts } = useSelector(
({ combinedPortal }) => combinedPortal.debtLetters,
);
const approvedLetterCodes = ['100', '101', '102', '109', '117', '123', '130'];
File addressPattern.jsx
has 431 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
/**
* Web component version of address
*/
import React from 'react';
import constants from 'vets-json-schema/dist/constants.json';
Function SearchResultsHeader
has 158 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export const SearchResultsHeader = props => {
const { searchResults, pagination, query } = props;
const {
inProgress,
context,
Function NearbyLocations
has 158 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
const NearbyLocations = props => {
const [originalCoordinates, setOriginalCoordinates] = useState([]);
const [nearbyVADistances, setNearbyVADistances] = useState(false);
const dispatch = useDispatch();
Function render
has 158 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
render() {
const { supplies, order, eligibility } = this.props;
const currentDate = moment();
const accessorySupplies = supplies.filter(
supply => supply.productGroup === ACCESSORY,
Function generateMedicationsContent
has 158 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export const generateMedicationsContent = record => {
let content;
if (record.type === medicationTypes.VA) {
content = {