-
Notifications
You must be signed in to change notification settings - Fork 185
[internal]: Adopting/following more ruff complexity rules #2376
Copy link
Copy link
Closed
Labels
Description
Related
- Commitment to keep package size down #1942 (comment)
- https://discord.com/channels/1235257048170762310/1272835922924273694/1355268679083753594
- 4f02f06
Description
All of the rules I'm linking have clear examples demonstrating why you'd use them.
The general theme they share is producing smaller and more generic functions/methods/classes.
The bad news is these aren't auto-fixes, but intended as a warning when you've written something that may be difficult for others to follow.
The good news is we can gradually introduce them via per-file-ignores.
See altair/pyproject.toml for an example of enabling a rule group for a single module.
Rules
Note
Feel free to add to these if you find any others
Adopt the following ignored rules:
- https://docs.astral.sh/ruff/rules/complex-structure/
- https://docs.astral.sh/ruff/rules/too-many-return-statements/
- https://docs.astral.sh/ruff/rules/too-many-branches/
https://docs.astral.sh/ruff/rules/superfluous-else-return/- Doesn't play nicely with coverage
Possibly adopt these preview rules:
- https://docs.astral.sh/ruff/rules/too-many-locals/
- https://docs.astral.sh/ruff/rules/too-many-boolean-expressions/
- https://docs.astral.sh/ruff/rules/too-many-nested-blocks/
More strictly follow rules we frequently # noqa: ...
Reactions are currently unavailable