Suggest inheriting repository fields in explicit workspaces - #17541
Draft
darkraider01 wants to merge 3 commits into
Draft
darkraider01 wants to merge 3 commits into
darkraider01 wants to merge 3 commits into
Conversation
darkraider01
commented
Sep 30, 2026
|
|
||
| pub static LINT: &Lint = &Lint { | ||
| name: "repository_not_inherited", | ||
| primary_group: &PEDANTIC, |
Contributor
Author
There was a problem hiding this comment.
I chose pedantic for now because members can intentionally use different repositories. I’d appreciate guidance on whether this should warn by default
| } | ||
| primary = primary.element(Level::NOTE.message(LINT.emitted_source(level.level, level.source))); | ||
|
|
||
| let help = if workspace |
Contributor
Author
There was a problem hiding this comment.
This also fires when the workspace has no repository value yet. The help suggests defining one first, so the trigger stays based on the direct package declaration.
This branch has not been deployed
This file contains hidden or 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
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.
A workspace member can accidentally set
package.repositoryto a URL for that crate’s page in a file browser. This addscargo::repository_not_inheritedto flag directly set repository fields in explicit workspaces and suggest inheritance where it applies.The lint does not inspect or compare URLs. It is pedantic and allow by default for now because some workspaces intentionally span multiple repositories. I’d especially welcome feedback on that default level.
The commits first record the existing behavior, then add the lint and tests for inherited fields, implicit workspaces, and packages outside the workspace. The final commit updates the generated lint reference.
Related: rust-lang/cargo#15870.