-
Notifications
You must be signed in to change notification settings - Fork 8
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
Add lint: panicking_query_methods
and panicking_world_methods
#95
Conversation
There's a little list of panicking APIs in bevyengine/bevy#14275 FYI :) |
I'm going to modify this to also check for panicking |
panicking_query_methods
panicking_query_methods
and panicking_world_methods
Ok, I believe this is now ready for review again. It now supports linting against |
I merged #106 directly into this, so that will need to be merged before this can. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Mostly some doc nits, but nothing blocking
As per @alice-i-cecile's request! Closes #58.
This adds the
bevy::panicking_query_methods
lint, which searches for usage of panicking methods likeQuery::single()
. It is currentlyAllow
-by-default, so you need to explicitly opt-in to use it. (In the project it's under the Restriction category.)This lint checks both
Query
andQueryState
. I will write a lint for resources in another PR. :)Testing
Wow, I'm so glad you asked! (You asked how to test this lint, right?)
I used the following example when testing. Paste it into
bevy_lint/examples/lint_test.rs
, runcd bevy_lint
, then runcargo build && cargo run -- --example lint_test
.The warnings should look like this:
Fiddle around with it and try to break it! Good luck, though. Unless you use #94, this is the most foolproof lint I've written so far! >:D