Showing 55 of 191 total issues
Avoid too many return
statements within this function. Open
Open
return ResponseErrorInternal("Error while updating the existing service");
Avoid too many return
statements within this function. Open
Open
return ResponseErrorValidation(
"Unable to decode CreatedMessageEvent",
readableReport(createdMessageEventOrError.value)
);
Avoid too many return
statements within this function. Open
Open
return ResponseErrorQuery(
"Error while creating Message",
errorOrMessage.value
);
Avoid too many return
statements within this function. Open
Open
return ResponseSuccessJson(returnedMessage);
Avoid too many return
statements within this function. Open
Open
return right<RuntimeError, NotificationEvent>(emailNotificationEvent);
Avoid too many return
statements within this function. Open
Open
return left<RuntimeError, OutputBindings>(
TransientError("Cannot update message pending status")
);
Avoid too many return
statements within this function. Open
Open
return left<RuntimeError, NotificationEvent>(error);
Avoid too many return
statements within this function. Open
Open
return ResponseSuccessJson(
retrievedServiceToPublic(maybeUpdatedService.value)
);
Avoid too many return
statements within this function. Open
Open
return left<RuntimeError, OutputBindings>(
TransientError("Cannot store message content")
);
Avoid too many return
statements within this function. Open
Open
return ResponseErrorInternal(
`Error retrieving NotificationStatus: ${
errorOrNotificationStatuses.value.name
}|${errorOrNotificationStatuses.value.message}`
);
Avoid too many return
statements within this function. Open
Open
return left<RuntimeError, OutputBindings>(
TransientError(
`Cannot save sender service id: ${errorOrSenderService.value.body}`
)
);
Avoid too many return
statements within this function. Open
Open
return right<RuntimeError, OutputBindings>(
withoutUndefinedValues(outputBindings)
);
Avoid too many return
statements within this function. Open
Open
return ResponseErrorQuery(
"Error while updating the existing service",
errorOrMaybeUpdatedService.value
);
Avoid too many return
statements within this function. Open
Open
return ResponseErrorInternal(
`Error retrieving MessageStatus: ${
errorOrMaybeMessageStatus.value.code
}|${errorOrMaybeMessageStatus.value.body}`
);
Function handleNotification
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
Open
export async function handleNotification(
lAppInsightsClient: TelemetryClient,
lNotificationModel: NotificationModel,
webhookNotificationEvent: NotificationEvent
): Promise<Either<RuntimeError, NotificationEvent>> {
- 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"