-
Notifications
You must be signed in to change notification settings - Fork 2.9k
Description
What it does
A mistake I've made in the past and seen others make is to set the repository field to the URL of the git host's file browser for the specific crate.
This gets in the way of cloning the repo and is redundant with the information provided in .cargo_vcs_info.json but most people are likely not aware of this.
We can't validate the URL easily but we can encourage people to inherit the field which would encourage the right behavior.
We'd likely want to limit this lint to only explicit [workspace]s.
Advantage
Avoids bad repository links which prevent validating the publish or some patching workflows
Drawbacks
If this is a pedantic, allow by default lint, then there will be little advantage to this. Those who know to turn it on are likely those who won't do this. Maybe it could still help with new users in a large project.
A workspace that spans repos, like what cargo used to do with rust-lang/rust, would get false positives from this and would need to disable it.
Example
[workspace]
[package]
repository = "https://github.com/rust-lang/cargo/tree/master/crates/cargo-test-macro"Could be written as:
[workspace]
repository = "https://github.com/rust-lang/cargo"
[package]