Skip to content

Lint if package.repository is not inherited within a workspace #15870

@epage

Description

@epage

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]

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-new-lintArea: new lintS-needs-mentorStatus: Issue or feature is accepted, but needs a team member to commit to helping and reviewing.

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions