-
Notifications
You must be signed in to change notification settings - Fork 30
Open
Labels
Description
Is there an existing such new check request for this?
- I have searched the existing issues
Explain
ebegin and eend should be paired, and eend is used to communicate failure. Using x || die in-between those means eend will never get a chance to do its job.
We may want to add an exception for multiple statements/commands between ebegin and eend as it's possible there's something critical which means we need to stop, but the main point of the ebegin and eend is to communicate the status of something else within the block.
Examples
mate.eclass as of e8d558865045b27fdced4c336e705325db6a4768 in ::gentoo has:
# @FUNCTION: ematedocize
# @DESCRIPTION:
# A wrapper around mate-doc-common
ematedocize() {
ebegin "Running mate-doc-common --copy"
mate-doc-common --copy || die # <-- bad because of "|| die"
eend $? # <-- arguably bad because of missing "|| die"
}
If mate-doc-common --copy fails, then eend $? will never be reached.
Instead, something like this should be written:
# @FUNCTION: ematedocize
# @DESCRIPTION:
# A wrapper around mate-doc-common
ematedocize() {
ebegin "Running mate-doc-common --copy"
mate-doc-common --copy
eend $? || die
}
Output message
UselessEbeginEend
Documentation
Error handling within ebegin and eend is unusual (TODO: improve this).
Result level
style