-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
[Roadmap] Configuration file for lints #6625
Comments
I wondered if it is somehow possible to declare a (proc?) macro in an extern crate that expands to a bunch of allow/deny directives and can be imported into crates where you want the warnings. |
I've been a couple of days taking a look to this and I was also thinking about post something in the IRLO and arrive to an RFC which we could start to work towards. Do you need some help on Drafting the RFC and implementing the stuff? I would be happy to help 😃 |
Help on drafting the RFC would be nice. I don't think another forum post will help much. Every discussion on this topic let to the same conclusion: this needs an RFC. |
Should we setup a hackmd or something similar? Or What do you have in mind? |
Yeah, I think a hackmd would be nice. I started one here and filled out summary and motivation. You have to sign in to hackmd.io in order to edit it. You can use your GH account for that. (I just want some low barrier of entrance to protect us from spammers). One thing that is important is, that it is clear, that the draft should not set the syntax of the configuration in stone. Also it is an open question if it should be an extra file or included in |
Absolutely! Will start later on today then! 😃 Thanks @flip1995 ! |
Added:
Will complete the sections by the end of the weekend. Feel free to ask or comment anything! 😃 |
Thanks! I may put some time into this the next few days as well. |
This is one of our top Clippy feature requests from us at Embark, we have a standard set of an increasing amount of Clippy (and a few Rust) lints that we enable by default across 50+ crates in 10+ repos. See EmbarkStudios/rust-ecosystem#59 for the set of lints and our process. This is currently done through a code snippet that add to every Here is how the our "lint configuration" looks like right now: https://github.com/EmbarkStudios/rust-ecosystem/blob/main/lints.rs. |
Hey that's helpful. Thanks for reporting it. I've been really busy the last month but I plan to get back to this and ship at least the RFC so that the discussions can start to take place. And this example will be a good one to have. |
arti is doing something very similar to Embark, using a python script to find and replace compiler flags. There's got to be a better way... |
There has been a better way for a while, see EmbarkStudios/rust-ecosystem#22 (comment) (and following). |
That's a start, but I'm not sure it's a complete solution, at least not in arti's case. Would also need to be possible to selectively overwrite the compiler flags for specific crates (and the command-line flags will overwrite inline flags, right?). Is that supported? |
I'm not sure. When you add a Worst case you would have to employ hacks like a |
Yes this works, we enable the lints for the full repository and all crates by default in So it is the closest we've found to a solution before having a proper one with this issue. There are two major issues though with this solution:
So still having proper support for specifying Clippy & Rust & Rustdoc lints in a single file in an official manner in a single file for the repository is still one of our top requests. But glad we do have this workaround for now at least. |
The main issue linked here was addressed in the manifest-lint? https://github.com/rust-lang/rfcs/blob/master/text/3389-manifest-lint.md Perhaps the way forward is to use the exact configuration in the (side note, I think clippy should gain a |
Does the |
I had no clue that existed, thanks for the hint! I don’t see it mentioned anywhere but here https://doc.rust-lang.org/nightly/clippy/development/adding_lints.html, I suppose I can send a docs PR if it’s intended to be better known |
It's here as well but yeah there should be a short section for it, rather than quickly mentioning it |
Perhaps some inspiration can be taken from cargo-cranky, whose whole existence is only needed because the issue at hand is not yet resolved. |
This is currently properly implemented in So I think this can be closed |
This is something that comes up every now and then: a reusable configuration
file, where lint levels can be defined. Discussions about this often lead to
nothing specific or to "we need an RFC for this". And this is exactly what needs
to be done. Get together with the cargo team and write an RFC and implement such
a configuration file somehow and somewhere.
Steps to completion:
The text was updated successfully, but these errors were encountered: