Skip to content
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

Create website listing all the implemented lints and their info #819

Open
obi1kenobi opened this issue Jul 19, 2024 · 6 comments
Open

Create website listing all the implemented lints and their info #819

obi1kenobi opened this issue Jul 19, 2024 · 6 comments
Labels
C-enhancement Category: raise the bar on expectations E-help-wanted Call for participation: Help is requested to fix this issue. E-mentor Call for participation: Mentorship is available for this issue.

Comments

@obi1kenobi
Copy link
Owner

obi1kenobi commented Jul 19, 2024

Originally suggested here:
https://rust-lang.zulipchat.com/#narrow/stream/421156-gsoc/topic/Project.3A.20Adding.20lint.20configuration.20to.20cargo-semver-checks/near/452638414

Any plans for generating a webpage of lints like crates.io (example)? I know @Scott Schafer is looking into this for Cargo.

This is a good idea! We need to look into what it would take to set this up and keep it maintained.

@obi1kenobi obi1kenobi added C-enhancement Category: raise the bar on expectations E-help-wanted Call for participation: Help is requested to fix this issue. E-mentor Call for participation: Mentorship is available for this issue. labels Jul 19, 2024
@epage
Copy link
Collaborator

epage commented Jul 19, 2024

rustc and clippy generate their documentation and Cargo is looking to do the same. No one hand-maintains the webpage.

iirc clippy scrapes the code and generates it. Since Cargo isn't using a macro (yet?) for defining lints, I suggested to @Muscraft that we have a test or an xtask that calls into cargo-the-library to read the lints.

For you, the lints are data-driven so you can just load all of the files.

For generating, I think it would be good to see if a library could be made from clippy to accept a lint definition and generate it, so we all can share the same generator.

@obi1kenobi
Copy link
Owner Author

Sharing the generator would be ideal! It would be pretty easy to parse the lints' information and plumb that through to the generator to make the website.

@Muscraft
Copy link

Cargo's lint docs currently get generated by an xtask that reads fields from our Lint type. It works reasonably well currently, but examples (and their output) have to be manually updated. In the future, I plan on using Cargo's UI tests for examples. To ensure the docs get updated, the output gets checked in CI.

@obi1kenobi
Copy link
Owner Author

Thanks for the links, super useful!

@SuperSonicHub1
Copy link

A pragmatic suggestion: we could store lint documentation using doc comments. This would allow users to read lint docs offline using cargo doc, host them easily on docs.rs, and keep the documentation close to code.

@obi1kenobi
Copy link
Owner Author

I don't think that would work, @SuperSonicHub1. Our lints are data, not types or functions, so there's no Rust item to which to attach the doc comment for each lint.

In clippy, each lint has its own type. Here, we have one type for all lints, and we deserialize the lints themselves out of RON files into instances of that struct.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-enhancement Category: raise the bar on expectations E-help-wanted Call for participation: Help is requested to fix this issue. E-mentor Call for participation: Mentorship is available for this issue.
Projects
None yet
Development

No branches or pull requests

4 participants