Showing 4,177 of 14,709 total issues
File stateList.js
has 313 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
const stateList = [
{
key: 'AL',
label: 'Alabama',
value: 'AL',
File RequestedAppointmentsListGroup.unit.spec.js
has 313 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
import React from 'react';
import moment from 'moment';
import MockDate from 'mockdate';
import { mockFetch } from '@department-of-veterans-affairs/platform-testing/helpers';
import { expect } from 'chai';
DEFAULT_ARRAY_BUILDER_TEXT
has 29 functions (exceeds 20 allowed). Consider refactoring. Open
Open
export const DEFAULT_ARRAY_BUILDER_TEXT = {
alertItemUpdated: props => {
const itemName = props.getItemName(props.itemData, props.index);
return itemName
? `${itemName}’s information has been updated`
File form.js
has 312 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
import environment from '@department-of-veterans-affairs/platform-utilities/environment';
import { cloneDeep } from 'lodash';
import { externalServices } from 'platform/monitoring/DowntimeNotification';
import {
Function mockPrescription
has 87 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function mockPrescription(n = 0, attrs = {}) {
// Generate some refillable, some not
const isRefillable = n % 3 === 0;
const refillRemaining = isRefillable ? Math.ceil(Math.log(n + 1)) : 0;
const {
Function OverviewPage
has 87 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
const OverviewPage = () => {
const { debtLetters, mcp } = useSelector(
({ combinedPortal }) => combinedPortal,
);
const {
Function Index
has 87 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
const Index = props => {
const { router } = props;
const { t } = useTranslation();
const { jumpToPage } = useFormRouting(router);
Function formConfig
has 87 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
const formConfig = (pathname = null) => {
const { title, subTitle, formNumber } = getFormContent(pathname);
return {
rootUrl: manifest.rootUrl,
Function AppealsV2StatusPage
has 87 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export default function AppealsV2StatusPage() {
const [appeal, fullName] = useOutletContext();
const {
events,
alerts,
Function labsAndTestsReducer
has 87 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export const labsAndTestsReducer = (state = initialState, action) => {
switch (action.type) {
case Actions.LabsAndTests.GET: {
if ('phrDetails' in action.response) {
// Special case to handle radiology.
Function DebtLettersDownload
has 86 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
const DebtLettersDownload = () => {
const { debtLinks, isError, isVBMSError, hasDependentDebts } = useSelector(
({ combinedPortal }) => combinedPortal.debtLetters,
);
Function ConfirmationPage
has 86 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export function ConfirmationPage(props) {
const { form } = props;
const { submission, data } = form;
const submitDate = new Date(submission?.timestamp);
Function transformForSubmit
has 86 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export default function transformForSubmit(formConfig, form) {
const transformedData = JSON.parse(
formsSystemTransformForSubmit(formConfig, form),
);
File index.js
has 310 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
import { apiRequest } from '@department-of-veterans-affairs/platform-utilities/api';
import environment from '@department-of-veterans-affairs/platform-utilities/environment';
import {
isVerificationEndDateValid,
removeCommas,
Function isPostalCodeRequired
has 86 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export const isPostalCodeRequired = data => {
const {
contactPreference,
relationshipToVeteran,
selectCategory,
Function ScheduleReferral
has 86 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export default function ScheduleReferral(props) {
const { currentReferral } = props;
const location = useLocation();
const dispatch = useDispatch();
useEffect(
File index.js
has 310 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
const allFolders = {
data: [
{
attributes: {
count: 3,
File DownloadReportPage.jsx
has 310 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
import React, { useCallback, useEffect, useState, useMemo } from 'react';
import { useDispatch, useSelector } from 'react-redux';
import PropTypes from 'prop-types';
import {
updatePageTitle,
Function subscribeComponentAnalyticsEvents
has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring. Open
Open
export function subscribeComponentAnalyticsEvents(
e,
recordEvent = _recordEvent,
) {
// Is it a component we are tracking?
- 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 checkValidSchema
has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring. Open
Open
export function checkValidSchema(schema, errors = [], path = ['root']) {
if (typeof schema.type !== 'string') {
errors.push(`Missing type in ${path.join('.')} schema.`);
}
- 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"