From d31dba40293401d2a51b50fd8803fa6c9f4613d2 Mon Sep 17 00:00:00 2001 From: Markus Hilger Date: Sun, 9 Aug 2026 14:16:38 +0200 Subject: [PATCH] Enforce the rules the tree is now clean under Adds the checks whose findings were cleared in the two preceding commits (F401, F541, E701, E711, E712, E713, PLC0414) plus three that were already at zero and cost nothing to lock in: E401, B015 and B023. B905 is deliberately left out even though it also reads as clean: it only reports on py310+, and satisfying it would mean adding a keyword the oldest interpreters this tree runs on cannot parse. --- ruff.toml | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/ruff.toml b/ruff.toml index 5c19ab7d..bf49679c 100644 --- a/ruff.toml +++ b/ruff.toml @@ -58,14 +58,30 @@ select = [ # function, break/continue outside a loop, except clause not last "F81", # redefinition of an unused name (shadowed def/class) "F82", # undefined name, undefined name in __all__, use before assignment + "F401", # unused import "F402", # import shadowed by a loop variable + "F541", # f-string with no placeholders + "E401", # several imports on one line + "E701", # several statements on one line + "E711", # comparison to None with == rather than is + "E712", # comparison to True/False with == rather than truthiness + "E713", # `not x in y` rather than `x not in y` + "PLC0414", # import alias that renames nothing "PLE", # pylint errors: bad string format, invalid returns, ... "T100", # forgotten pdb/breakpoint call "W6", # invalid escape sequence in a non-raw string, and any future # deprecated-construct warning pycodestyle adds + "B015", # comparison whose result is discarded "B020", # loop control variable overrides the iterable it iterates + "B023", # closure captures a loop variable, so every closure sees the + # last value rather than the one from its iteration "B035", # dict comprehension with a static key ] +# Deliberately not selected, though currently at zero: B905 (zip without an +# explicit strict=). It only reports on py310+, so it reads as clean here, and +# "fixing" it would mean adding a keyword the oldest supported interpreters +# cannot parse. + # No ignores and no per-file exemptions: every rule selected above is expected # to stay at zero on its own.