Showing 3,724 of 12,675 total issues
Function NoRegistrationMessage
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export default function NoRegistrationMessage() {
return (
<FullWidthLayout>
<InfoAlert
status="error"
Function filteredAppointments
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
const filteredAppointments = appointments.filter(appointment => {
return req.query.statuses.some(status => {
if (appointment.attributes.status === status) {
// Automatically add appointments with these statuses to the collection
if (
Function generateClaimTitle
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export const generateClaimTitle = (claim, placement, tab) => {
// This will default to 'disability compensation'
const claimType = getClaimType(claim).toLowerCase();
const isRequestToAddOrRemoveDependent = addOrRemoveDependentClaimTypeCodes.includes(
claim?.attributes?.claimTypeCode,
Function preEligibilityChange
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
const preEligibilityChange = e => {
const { value } = e.target;
recordEvent({
event: 'gibct-form-change',
Function getTab
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
const getTab = tabName => {
const activeTab = tabName === mobileTab;
const tabClasses = classNames(
{
'active-results-tab': activeTab,
Function eligibilityAndFilters
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
const eligibilityAndFilters = cnt => {
const showTuitionAndFilters = cnt > 0 || usedFilters;
if (showTuitionAndFilters) {
return (
Function preEligibilityChange
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
const preEligibilityChange = (e, name, number) => {
const field = e.target.name;
const { value } = e.target;
if (field === 'giBillChapter' && value === '33a') {
Function renderOptions
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
const renderOptions = () => {
const displayOptions = Array.isArray(options) ? options : [];
return displayOptions.map((option, index) => {
const { checked, optionLabel, name, learnMore, dataTestId } = option;
Function handleInputFocusWithPotentialOverLap
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export const handleInputFocusWithPotentialOverLap = (
fieldId1,
fieldId2,
scrollableFieldId,
) => {
Function addressLabel
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export const addressLabel = address => {
// Destructure address object for easier access
const {
addressLine1,
addressLine2,
Function transformServiceHistoryEntryIntoTableRow
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export const transformServiceHistoryEntryIntoTableRow = entry => {
const formattedBeginDate = entry.beginDate
? moment(entry.beginDate).format('LL')
: '';
const formattedEndDate = entry.endDate
Function mockGetRefreshStatus
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export const mockGetRefreshStatus = () => {
switch (scenario) {
case 1: {
return mockStatusResponse(0, 80, 70, 70); // STALE
}
Function createBasicInitialState
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function createBasicInitialState(serviceHistory) {
return {
user: {
profile: {
veteranStatus: {
Function getLabsAndTestsList
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export const getLabsAndTestsList = (isCurrent = false) => async dispatch => {
dispatch({
type: Actions.LabsAndTests.UPDATE_LIST_STATE,
payload: Constants.loadStates.FETCHING,
});
Function dropdownContent
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
const dropdownContent = () => {
return (
<>
<p
className="vads-u-padding-bottom--1"
Function prefillPersonalInformation
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
const prefillPersonalInformation = data => {
const newData = _.omit(['personalInformation'], data);
const { personalInformation } = data;
if (personalInformation) {
Function content
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
const content = () => {
return (
<>
{page ? (
<PrintOnlyPage
Function getServiceAvailability
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export function getServiceAvailability() {
return dispatch => {
dispatch({
type: SET_SERVICE_AVAILABILITY,
serviceAvailability: SERVICE_AVAILABILITY_STATES.pending,
Function NavItemRow
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
Open
const NavItemRow = ({ depth, item, trackEvents }) => {
// Derive item properties.
const { expanded, hasChildren, href, id, isSelected, label } = item;
// Derive depth booleans.
- 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 getFormDOM
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
Open
export function getFormDOM(form) {
const formDOM = form?.container || findDOMNode(form);
if (!formDOM) {
throw new Error(
- 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"