-
Notifications
You must be signed in to change notification settings - Fork 12
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 duplicate bevy dependencies lint #185
Conversation
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.
So far this looks good! I am interested in getting a span to Cargo.toml
/ Cargo.lock
, though I'm unsure if the compiler will know that file exists. Ping me when this is ready for a final review!
example of the lint message
|
One function you may find useful is |
nice catch! Thanks will add this. |
@DaAlbrecht The tests are failing, because Bevy needs additional system packages to be installed on Linux. I had the same issue in #222, so we can either merge that PR first and then merge main back in your branch or you can copy the CI-related changes here to fix this :) |
bevy_lint/tests/ui-cargo/duplicate_bevy_dependencies/fail/Cargo.stderr
Outdated
Show resolved
Hide resolved
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.
Overall, great stuff! I have quite a few minor nitpicks, but they aren't that important. The biggest changes I want are:
- Spawning
MetadataCommand
in the directory of the input file - When
cargo metadata
fails, emit a plain error diagnostic instead of usingspan_lint()
- Splitting up UI tests and Cargo UI tests into two different files.
- Switching
duplicate_bevy_dependencies
to thenursery
lint group for now.
Let me know if you need any further clarification on stuff! I can do some of the work as well, if you're busy :)
bevy_lint/tests/ui-cargo/duplicate_bevy_dependencies/fail/Cargo.toml
Outdated
Show resolved
Hide resolved
bevy_lint/tests/ui-cargo/duplicate_bevy_dependencies/fail/Cargo.toml
Outdated
Show resolved
Hide resolved
[workspace] | ||
|
||
[dependencies] | ||
bevy = { version = "0.14.2" } |
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.
Is there a reason you specify bevy = { version = "0.14.2" }
instead of bevy = "0.14.2"
? Should we test both formats, or was this just leftover from testing?
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.
This is intentional to check that not only bevy = "0.14.2"
works. But we should definitely check both variants. I would like to add more tests in general for this but was a bit scared it would blow up CI time.
But I will add some more tomorrow testing all the different variations.
bevy_lint/tests/ui.rs
Outdated
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.
Could you split the Cargo UI tests into a different file, ui_cargo.rs
? There's not enough overlap in my opinion to require these two be in the same file. (Not to mention, having two different "test files" means you can select which you want to run with cargo test --test ui
or cargo test --test ui_cargo
.)
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.
Hmm, I can do this but wouldn't this just end in a new test_utils
module that contains more or less the entire code from ui.rs
(base_config
, find_bevy_rlib
, ArtifactMessage
, ArtifactTarget
) as these are used in both?
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.
Being able to only run a subset is pretty nice i implemented this once how i think this could look like
Thank you so much for the review! |
Do you have a better idea of how we can test without needing to create so many packages? Also, let me know if you rather revert to fab055a |
I don't mind creating that many packages, as it's what many other popular crates use to test their Cargo integration. I'm more concerned with the increase CI time, though thankfully the cache should handle that. I'm going to merge this as-is, as I'm happy with the initial changes, then open a few follow-up PRs to do additional cleanup. :) |
Ugh I broke the Git history again (I really need to stop doing this). I'll open a new PR and merge that ;-; |
Copy of #185, since I borked the Git history for that PR. --------- Co-authored-by: DaAlbrecht <[email protected]> Co-authored-by: DAA <[email protected]>
A first draft of a quick lint to check if multiple versions of bevy are defined. #15
todos:
cargo metadata
to get information about the crate versions.Cargo.toml
)