fix(python): PLR0915 counts statements, not lines
Verified with `ruff rule PLR0915`: it is `too-many-statements` (default 50), not a line-length rule. Ruff has no line-based function-length rule at all. python.md now says so and points both limits at a pytest case; coding-dev.md gains the general distinction between a real length lint and a proxy. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
1 parent
32b47b075b
commit
3171595940
2 files changed
+9
-5
No files matched your search
+4
-2
@@ -147,8 +147,10 @@ depends on those.
|
||||
A limit nobody checks is a suggestion. Pick the **highest** applicable option:
|
||||
|
||||
1. **A linter rule**, where one exists — the function limit is usually covered natively
|
||||
(Clippy's `too_many_lines`, ESLint's `max-lines-per-function`, `golangci-lint`'s `funlen`,
|
||||
Ruff's `PLR0915`). A function that trips it wants extracting, not a suppression.
|
||||
(Clippy's `too_many_lines`, ESLint's `max-lines-per-function`, `golangci-lint`'s `funlen`).
|
||||
A function that trips it wants extracting, not a suppression. Note that some linters only
|
||||
offer *proxies* for length — Ruff's `PLR0915` counts statements, not lines — in which case
|
||||
enable the proxy and put the real limit in a test.
|
||||
2. **A test**, for anything the linter does not cover — file length almost always falls here.
|
||||
A test is the best home for it: it runs with the suite everyone already runs, it needs no
|
||||
extra tooling, it fails with a message naming the offending files, and it travels with the
|
||||
|
||||
Reference in new issue
Block a user