rust-clippy icon indicating copy to clipboard operation
rust-clippy copied to clipboard

Consider publishing `clippy_utils` as a crates.io crate for others to reuse

Open alice-i-cecile opened this issue 1 year ago • 8 comments

Description

Over at the bevy_cli project, we're implementing custom lints for Bevy, and bootstrapping off of Clippy's existing tools :) We'd love to publish this to crates.io so folks can cargo install bevy_cli, but can't do so easily due to clippy_utils only existing as a git dependency.

We don't particularly care about stability or the like: simply publishing whatever you have periodically would be enough.

Prompted by https://github.com/TheBevyFlock/bevy_cli/issues/150

alice-i-cecile avatar Oct 16 '24 18:10 alice-i-cecile

For the period, you could definitely match what Cargo does and publish for every stable release (as long as each release provides what nightly version they were pinned to at that time).

Publishing clippy_utils will also require clippy_config, but that's also reserved on https://crates.io.

Thanks for your consideration!

BD103 avatar Oct 16 '24 19:10 BD103

as long as each release provides what nightly version they were pinned to at that time

How would you recommend to best provide this information?

Publishing clippy_utils will also require clippy_config, but that's also reserved on https://crates.io.

Yeah, I made sure that those crates are squatted for us (with me and rust-lang-owner as owners) recently, in anticipation that such a request would come up at some point. I just thought it would be from the dylint maintainers. cc @smoelius

flip1995 avatar Oct 18 '24 12:10 flip1995

as long as each release provides what nightly version they were pinned to at that time

How would you recommend to best provide this information?

The channel field within rust-toolchain is enough! :)

If releases are to be automated, you can automatically extract this value using Taplo. I did something very similar in bevy_lint's CI.

BD103 avatar Oct 18 '24 13:10 BD103

Offtopic: shouldn't this be

toolchain: ${{ needs.extract-rust-version.outputs.toolchain }}

in your workflow file?


Extracting this in an automated way from the rust-toolchain file is easy. I'd probably just use a grep command though. My question is more: where should I put this information? Just in the README of clippy_utils/clippy_config?

flip1995 avatar Oct 18 '24 13:10 flip1995

Offtopic: shouldn't this be

toolchain: ${{ needs.extract-rust-version.outputs.toolchain }}

in your workflow file?

For a second I thought so too, but I rename it in the job outputs:

    outputs:
      channel: ${{ steps.toolchain.outputs.toolchain }}
      components: ${{ steps.toolchain.outputs.components }}

This is confusing, though, so I'll probably change it.

Extracting this in an automated way from the rust-toolchain file is easy. I'd probably just use a grep command though. My question is more: where should I put this information? Just in the README of clippy_utils/clippy_config?

If you use Github Releases, you could add it there. (Maybe also the CHANGELOG.md?)

BD103 avatar Oct 18 '24 13:10 BD103

CHANGELOG.md is just for stable and external releases for Clippy itself. Not for something like this. And I'd like to keep it that way.

If we would start using Github releases, I think we would need to copy the whole changelog there every time, so that it is a proper release. I'd rather avoid that.

So I guess, I will add it to the README of the crates, so that it also shows up on the crates.io page when publishing.

flip1995 avatar Oct 18 '24 13:10 flip1995

So I guess, I will add it to the README of the crates, so that it also shows up on the crates.io page when publishing.

If that's too much of a hassle, each release is tagged, so I can figure it out using the tagged commit.

BD103 avatar Oct 18 '24 14:10 BD103

Let's wait for the clippy meeting where we talk about this. And if we decide that we want to publish it, I'll think about what would work for me and other people involved in releases and would make it easy for you to find the toolchain.

flip1995 avatar Oct 18 '24 15:10 flip1995

We'd love to publish this to crates.io so folks can cargo install bevy_cli, but can't do so easily due to clippy_utils only existing as a git dependency.

Won't the user have to specify the toolchain on the command line, e.g.:

cargo +nightly-2024-10-03 install bevy_cli

Or am I missing something?

smoelius avatar Oct 29 '24 17:10 smoelius

Won't the user have to specify the toolchain on the command line, e.g.:

cargo +nightly-2024-10-03 install bevy_cli

Or am I missing something?

You're right, but I still prefer it to --git https://github.com/ TheBevyFlock/bevy_cli --tag lint-v0.1.0 bevy_lint! It's shorter and I trust it more, since unlike tags versions published to crates.io cannot be modified.

BD103 avatar Oct 30 '24 11:10 BD103

https://crates.io/crates/clippy_utils

#13700 will close this issue.

flip1995 avatar Nov 28 '24 18:11 flip1995

Thank you so much! :D

BD103 avatar Nov 29 '24 14:11 BD103