Showing 4,231 of 14,884 total issues
Function render
has 73 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
render() {
const {
addressValidationType,
suggestedAddresses,
addressFromUser,
Function render
has 73 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
render() {
// loading state for terms content is handled by parent component
const { terms } = this.props;
if (!terms.termsContent) {
Function submit
has 73 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
const submit = form => {
const currentAddress = form.data['view:currentAddress'];
const itemQuantities = form.data?.order?.length;
const { order, permanentAddress, temporaryAddress, vetEmail } = form.data;
for (const address of [permanentAddress, temporaryAddress]) {
Function WiderThanMobileOfficialGovtWebsite
has 73 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
const WiderThanMobileOfficialGovtWebsite = () => {
const [isExpanded, setIsExpanded] = useState(false);
const toggleExpansion = () => {
setIsExpanded(!isExpanded);
Function render
has 73 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
render() {
return (
<div className="schemaform-intro">
<FormTitle title="Apply for a Specially Adapted Housing Grant or Special Home Adaptation Grant" />
<p>
Function activeDutyNote
has 73 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
const activeDutyNote = () => {
if (
eighteenOrOver(formData.relativeDateOfBirth) &&
(!hasServed || (hasServed && allServicePeriodsHaveEndDate))
) {
Function createDirectDepositPage
has 73 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export default function createDirectDepositPage(schema) {
const { bankAccountChangeUpdate, bankAccount } = schema.definitions;
return {
title: 'Direct deposit',
Function facilityReducer
has 73 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export function facilityReducer(state = initialState, action) {
switch (action.type) {
case FETCH_FACILITY_STARTED:
return { ...state, data: {}, loading: true, error: false };
case FETCH_FACILITY_SUCCESS:
Function WiderThanMobileOfficialGovtWebsite
has 73 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
const WiderThanMobileOfficialGovtWebsite = () => {
const [isExpanded, setIsExpanded] = useState(false);
const toggleExpansion = () => {
setIsExpanded(!isExpanded);
Function isLocationOfResidenceRequired
has 73 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export const isLocationOfResidenceRequired = data => {
const {
contactPreference,
relationshipToVeteran,
selectCategory,
Function CustomResolutionOptionReview
has 73 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
const CustomResolutionOptionReview = props => {
const formData = useSelector(state => state.form.data);
const { selectedDebtsAndCopays = [] } = formData;
const currentDebt = selectedDebtsAndCopays[props.pagePerItemIndex];
Function fetchConfirmedAppointmentDetails
has 73 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export function fetchConfirmedAppointmentDetails(id, type) {
return async (dispatch, getState) => {
try {
const state = getState();
const featureVAOSServiceVAAppointments = selectFeatureVAOSServiceVAAppointments(
Function GiBillBreadcrumbs
has 73 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
const GiBillBreadcrumbs = () => {
const ProgramsTypeMatch = useRouteMatch(
'/institution/:facilityCode/:programType',
);
const profileMatch = useRouteMatch('/institution/:facilityCode');
Function onChangeEvent
has 73 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
const onChangeEvent = option => {
// title may be a React component
const title = options.title?.props?.children || options.title || '';
// this check isn't ideal since the message may exist and the question
// may be dynamically toggled between being required or not
Function getCompareCalculatorState
has 73 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export const getCompareCalculatorState = (
calculator,
institution,
constants,
) => {
Function ConnectedDevicesContainer
has 73 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export const ConnectedDevicesContainer = () => {
const [hasLoaded, setHasLoaded] = useState(false);
const [connectionAvailable, setConnectionAvailable] = useState(false);
const [connectedDevices, setConnectedDevices] = useState([]);
const [successAlert, setSuccessAlert] = useState(false);
Function removeDependents
has 73 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export function removeDependents(state = initialState, action) {
// schema, uiSchema, and formData are already extracted based on index (stateKey) here.
if (action.type === FORM_DATA_UPDATED) {
const {
data: newFormData,
Function makeUserObject
has 73 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export function makeUserObject(options = {}) {
const services = options.services || ['vet360'];
let claims = {
ch33_bank_accounts: true,
communication_preferences: true,
Function LabsAndTests
has 73 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
const LabsAndTests = () => {
const dispatch = useDispatch();
const updatedRecordList = useSelector(
state => state.mr.labsAndTests.updatedList,
);
Function ReviewFieldTemplate
has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring. Open
Open
export default function ReviewFieldTemplate(props) {
const { children, uiSchema, schema, formContext } = props;
const label = uiSchema['ui:title'] || props.label;
const description = uiSchema['ui:description'];
const textDescription = typeof description === 'string' ? description : null;
- 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"