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:
BluscreamandClaude Opus 5 committed 2026-09-18 12:56:12 +02:00
1 parent 32b47b075b
commit 3171595940
2 files changed
+9 -5

No files matched your search

+5 -3
View File
@@ -132,9 +132,11 @@ When talking to a rate-limited API (a chat platform, a store, a tracker):
installable package** with its own repo and version, consumed as a dependency.
- Keep persistent state in the framework's own config/storage system so it survives restarts;
do not invent a parallel JSON file beside it.
- File and function size limits from the general rules apply — Ruff's `PLR0915` covers
function length; put the file limit in a pytest case (see
[`coding-dev.md` §4](skills-public/coding-dev.md)).
- File and function size limits from the general rules apply. Ruff has **no line-based**
function-length rule — `PLR0915` (`too-many-statements`, default 50) and `C901`
(cyclomatic complexity) are the closest proxies and are worth enabling, but neither
measures lines. Put **both** the function-length and file-length limits in a pytest
case (see [`coding-dev.md` §4](skills-public/coding-dev.md)).
---
+4 -2
View File
@@ -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