-
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
Add lint writing documentation #3824
Conversation
This looks really good so far, thanks for doing this!! As an aside: We should probably build a longer version of the lint naming conventions, we have a bunch of our own (like |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good stuff! A few comments after reading through
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
First off, thanks for the great work, this document will be really useful!
Maybe also mention the #[clippy::author]
attribute.
In the future I would like a section "Advanced Lints", where some other useful things are mentioned and explained. I'm thinking of:
- Visitor
- LateLintPass example
- PreExpansionPass
- Constants
- MIR-Lints
- ???
Or we can add additional documentation files for this, to keep this one short (which is probably the better idea)
Thanks for the reviews so far! I added a small TODO list to the PR description. I will fix those and give it another read/try later today.
These are all good ideas! I hope having the documentation in it's own directory lowers the bar a tiny bit for new documentation. I found that working with the existing CONTRIBUTING.md was getting a bit unpleasant. |
I didn't have time to re-read the whole thing yet and try it out, but I think I addressed all the remaining issues, including the cleanup of |
Whaaat! This PR is awesome 😍 there's so much info I learned this last week as I got started, that you've neatly put together here. Thanks! This will surely help a lot of people 😊 |
This adds a new documentation page that explains how to write Clippy lints. It guides the reader through creating a `foo` function lint.
Co-Authored-By: phansch <[email protected]>
Co-Authored-By: phansch <[email protected]>
And adapt the wording a bit so that it fits in the overall guide.
This is now all included in `doc/adding_lints.md`
Have you seen this? Maybe it'd be nice to connect it with this PR :D |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just skimmed over the new document and I vote for merging this.
Going to go ahead and get this merged then, we can still improve it going forward ✨ @bors r+ |
📌 Commit 34685a5 has been approved by |
Add lint writing documentation [Rendered](https://github.com/phansch/rust-clippy/blob/adding_lints/doc/adding_lints.md) This adds a new documentation page that explains how to write Clippy lints. It guides the reader through creating a `foo` function lint. I plan to iterate a bit more on the prose of some sections, but I think the general structure is fine now, so I'm looking forward to feedback =) One thing I'm not sure about: I felt like this is too big for CONTRIBUTING.md so I put it into a new `doc/` directory. I can imagine having more documentation in the future, so we might even want to create a book using mdbook instead? Or should everything go into CONTRIBUTING.md? Further things left to do: - [x] Link from CONTRIBUTING.md - [x] Remove things covered in this guide from CONTRIBUTING.md - [x] Section about `clippy::author` attribute - [x] Run `remark-lint` on CI over the `doc` directory and fix things
☀️ Test successful - checks-travis, status-appveyor |
Rendered
This adds a new documentation page that explains how to write Clippy
lints. It guides the reader through creating a
foo
function lint.I plan to iterate a bit more on the prose of some sections, but I think the
general structure is fine now, so I'm looking forward to feedback =)
One thing I'm not sure about: I felt like this is too big for CONTRIBUTING.md
so I put it into a new
doc/
directory. I can imagine having moredocumentation in the future, so we might even want to create a book using
mdbook instead? Or should everything go into CONTRIBUTING.md?
Further things left to do:
clippy::author
attributeremark-lint
on CI over thedoc
directory and fix things