Build your Ruff rule config interactively - enhancement for Rules page #8951
oprypin
started this conversation in
Show and tell
Replies: 1 comment
-
I tried this Ruff shopping cart locally and it works well 😄 |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I made an enhancement to the Rules page of Ruff https://docs.astral.sh/ruff/rules/
Each rule gets a checkbox, or an entire category can be selected with a top-level checkbox.
After you're done "shopping" for rules that you want to enable, you can copy the resulting list directly into your Ruff config.
Even better, if after some time you're in a mood to pick out more new rules, you can paste your existing config into this textbox and continue to build it up by adding and removing rules.
Note that ignores are not supported here, but you're welcome to keep a small list of ignores separately. This is aimed at users who are very picky about rules but who also want to follow updates to Ruff.
Currently this is a userscript that you need to paste into the console, but I could actually contribute it to the main site if there's interest.
Script to paste into your console
A video of what it does:
Build.your.Ruff.rule.config.interactively.mp4
One immediate followup request I have is that, while "pycodestyle" rules are nicely separated into 2 sub-tables, the "pylint" rules sadly aren't. In my case I like to select the whole "PLC", "PLE" categories, but only some rules from "PLR", "PLW", but this is not viable to do with this userscript without having the separation.
Beta Was this translation helpful? Give feedback.
All reactions