-
Notifications
You must be signed in to change notification settings - Fork 193
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Don't use assert
outside of tests
#1533
Comments
Yeah I read this relatively recently and realised the same, that we're using these functionally all over the place. It's a hassle to update though, as we do escalation of exceptions as a fairly common pattern. So replacing with I have thought that it could be nice to create a file with a set of dedicated nf-core specific exceptions that we use. This would be nice for any packages that want to use nf-core code as they could then handle them specifically. But again, a fair amount of code for very little gain in the practical sense, so has been in my "low priority" box for a while. |
if
instead of assert
outside of testsassert
outside of tests
|
Yeah, or writing some custom exception types like I did for the sync code here. That's probably my favourite approach. Especially if we make some general ones which other specific ones can be based on - then we can catch the general ones up at CLI level easily. Another example of a project I was involved in where we did this more extensively is here: https://github.com/ScilifelabDataCentre/dds_cli/blob/dev/dds_cli/exceptions.py |
Closed by #1685 |
Description of feature
The problem with assert is that it is not executed if python is invoked with optimizations. This means that the code behaves differently and this is probably not desired.
Use
git grep assert nf_core
to find where the problem lies.See this stackoverflow answer for explanations and also this biopython issues for an example of a codebase that followed the suggestion and more info.
The text was updated successfully, but these errors were encountered: