-
-
Notifications
You must be signed in to change notification settings - Fork 2
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
Rules documentation improvements #248
Conversation
For generating rules pages, I've looked at https://www.sphinx-doc.org/en/master/man/sphinx-autogen.html and https://www.sphinx-doc.org/en/master/usage/extensions/autosummary.html#directive-autosummary and considered making visitors classes with the extra documentation in their docstrings. But I think that's going to cause issues - primarily in having large limitations on the formatting of the resulting rules subpages. The page would essentially be the documentation of a single class, with code examples etc etc in the docstring. The easiest would be manually writing the subpages, and that's probably what I'll start with for the sake of exploring layout etc etc, but this will be error-prone/cumbersome/hard to maintain. I'm thinking something like:
thoughts? |
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.
Let's start by just writing all the subpages by hand; I think that the complexity of generating stuff probably isn't worth it at the moment (given some classes implement multiple rules, etc).
Separate glossary page sounds great to me, as does matching Ruff's structure for the docs of each rule. That might be a bit much to put into one PR though; I'd be keen to merge this in small pieces if we can - e.g. rearrange docs in this one, then follow-ups to add the _info and _examples sections, and then consider tests or automation.
One thing we should do ASAP is prominently link from the github readme and the pypi page directly to the rules page in our docs.
The main downside is having to write, and keep in sync,
But yeah the smart thing is probably to start doing it manually, although I kind of dread doing so 30 times over. But I guess we don't have to smash out detailed rules pages for all rules pages at the same time, can start with a couple and leave the rest with long blurbs.
Sounds good. Will see if I clean up this one and write follow-up PRs, and/or split out smaller PRs from it.
We additionally made a release with #244 but none with #245 or later, so PyPI still runs with the old README page. |
Co-authored-by: Zac Hatfield-Dodds <[email protected]>
Ended up going the clean-up-this-one-and-then-do-followup-PRs:
|
@augustelalande @charliermarsh in this PR I've started adding human-friendly rule names (see #236), in large part inspired by you guys. So I thought I'd compare with the names you'd assigned in astral-sh/ruff#10416 (We're also planning on mostly copying your setup of having subpages for each rule with a longer description, examples, etc; when that's done you can probably straight-up copy-paste those sections from us to your docs.) General observations:
(due to where I've copy-pasted from their rule names are formatted in camel case, but treat them as they're words-separated-by-dashes)
our name is much better here, they should probably conform.
I think
"unneeded-sleep" sounds like the sleep isn't necessary and can be removed, but that's far from the case.
lol
I very much ran out of energy trying to come up with better names, so might go with the ruff ones unless we can come up with a more descriptive difference between the rules.
Idk about
great minds think alike |
Personally I'm fine with your proposed names, so I'll update my PR with whatever you finalize on here. *except blocking-process-call-1,2,3 😉 |
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.
non-blocking comments, looks great overall 🙏
The I added
Other than the checkpoint glossary entry I think I'm happy with this PR now. |
rewrote the checkpoint glossary entry after discussions in gitter, so this is ready for final review & merge |
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.
Pushed some formatting tweaks and slight rewording for the checkpoint entry - let's go!
Various rules doc improvements:
WIP tasks
* ruff copies over error message instead of having a custom blurb: https://docs.astral.sh/ruff/rules/ - that might be good to do to reduce the number of places that documentation is written. Will also need to define the human-friendly rule name in the code anyway, so this whole table should probably be generated one way or another....
--disable
etc #236. I did not want to do big rules doc makeover without also incorporating this.yield-in-nursery-or-cancelscope
oryield-in-taskgroup-or-cancelscope
oryield-in-nursery-or-taskgroup-or-cancelscope
. (and should it bescope
, orcancelscope
, orcancelscope-or-timeout
, or justtimeout
, etc.). Can be fixed with glossary etc when reading docs, but we're also considering people stumbling upon these names innoqa
statements or in configs.hoverxref
additional tasks I have not started on:
I might split out some stuff (e.g. intersphinx) into separate PRs.