From 07dccd67d6c5062f65a81751c572dc193cc34484 Mon Sep 17 00:00:00 2001 From: "Commentator2.0" Date: Thu, 4 Dec 2025 14:21:07 +0100 Subject: [PATCH] treefmt/ruff: remove EM rules as they cause unnecessary work with no real upside As discussed in the F2 matrix channel, not being able to put the error message inside of the thrown exception just results in one assigning an additional variable to immediatly throw it. The original reason for these rules to exist are that the message isn't printed twice, though the line above the thrown exception is printed anyways in the stacktrace, so we still get the error message twice but now with additional work. Hence this commit removes the said rules Change-Id: I0b37c0b0861334703a5772c36353d31441f19dcd --- pyproject.toml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 3a931ec17..26279b7d1 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -66,7 +66,7 @@ task-tags = ["TODO", "FIXME", "XXX"] # disabled: ANN4: no any type; not enabled as we support anys in multiple places # A: builtin shadowing # C4: list and generator comprehensions -# EM: don't pass strings directly into exceptions, but use a variable; avoids duplicate printing of the message +# disabled: EM: don't pass strings directly into exceptions, but use a variable; avoids duplicate printing of the message # ISC: implicit string concatination # INP: require __init__.py in all packages # LOG: creation of logger objects @@ -143,7 +143,7 @@ task-tags = ["TODO", "FIXME", "XXX"] # PGH: things about pygrep, we don't use # FURB: covered by other rule sets # TRY: try and raise related things, not helpful as we only do testing -select = ["E4", "E7", "E9", "F", "ERA", "ASYNC", "ANN0", "ANN2", "A", "C4", "EM", "ISC", "INP", "LOG", "G", "PIE", "T20", "PT", "Q", "RSE", "RET", "SIM", "TID251", "TD", "ARG", "PTH", "N", "PERF", "PLC", "PLE", "UP", "RUF"] +select = ["E4", "E7", "E9", "F", "ERA", "ASYNC", "ANN0", "ANN2", "A", "C4", "ISC", "INP", "LOG", "G", "PIE", "T20", "PT", "Q", "RSE", "RET", "SIM", "TID251", "TD", "ARG", "PTH", "N", "PERF", "PLC", "PLE", "UP", "RUF"] ignore = ["ANN002", "ANN003", "TD001", "TD003", "PLE1", "RUF005"] [tool.ruff.lint.per-file-ignores]