-
Notifications
You must be signed in to change notification settings - Fork 9
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 missing_reflect
lint
#137
Closed
Closed
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
BD103
added
A-Linter
Related to the linter and custom lints
C-Feature
Make something new possible
S-Blocked
This cannot move forward until something else changes
labels
Oct 12, 2024
BD103
removed
the
S-Blocked
This cannot move forward until something else changes
label
Oct 14, 2024
I may recreate this branch, there's a lot of commits already and I want to refactor the entire lint. |
BD103
added a commit
that referenced
this pull request
Oct 15, 2024
Closes #54. See #137 for past attempt. This adds a lint that lets users require all components, resources, and events derive `Reflect`. `Reflect` is often used by tools such as `bevy-inspector-egui` to view the state of the world while the game is running, but these tools are far less useful if they do not have access to reflection data. This lint is off by default, and intended to be used to require `Reflect` for types within specific modules. For example: ```rust #[deny(bevy::missing_reflect)] mod components { use bevy::prelude::*; #[derive(Component)] struct MyComponent; } ``` Developers are free to require it throughout the entire crate, however. ```rust #![deny(bevy::missing_reflect)] ``` This lint gives lots of information when it is raised, such as where the offending trait was implemented and how to fix it: ![image](https://github.com/user-attachments/assets/e0c33639-d81d-44e6-b7da-433b9f61a61d) Thanks to `clippy_utils`'s [`suggest_item_with_attr()`](https://doc.rust-lang.org/nightly/nightly-rustc/clippy_utils/sugg/trait.DiagExt.html#tymethod.suggest_item_with_attr), the suggestion is machine applicable. This means that `cargo fix` can automatically fix this lint, making migrating a code base super easy.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Closes #54, but blocked by #125 and #128 since I added UI tests.