From 37117701cef52c9c9bcd6f5cc712356258071a0d Mon Sep 17 00:00:00 2001 From: Dimitri Papadopoulos <3234522+DimitriPapadopoulos@users.noreply.github.com> Date: Thu, 7 Nov 2024 18:21:17 +0100 Subject: [PATCH] Reorganise ruff rules Use the same rule ordering as the ruff documentation: https://docs.astral.sh/ruff/rules/ --- pyproject.toml | 57 +++++++++++++++++++++++++------------------------- 1 file changed, 28 insertions(+), 29 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index b886ee78b6f..55c8d92bfdb 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -234,41 +234,40 @@ extend-exclude = [ ] [tool.ruff.lint] -# E402: module level import not at top of file -# E501: line too long - let the formatter worry about that -# E731: do not assign a lambda expression, use a def +extend-select = [ + "F", # Pyflakes + "E", # pycodestyle errors + "W", # pycodestyle warnings + "I", # isort + "UP", # pyupgrade + "B", # flake8-bugbear + "C4", # flake8-comprehensions + "PIE", # flake8-pie + "TID", # flake8-tidy-imports (absolute imports) + "PGH", # pygrep-hooks + "PERF", # Perflint + "RUF", +] extend-safe-fixes = [ - "TID252", # absolute imports + "TID252", # absolute imports ] ignore = [ - "C40", - "E402", - "E501", - "E731", - "UP007", - "PERF20", + "E402", # module level import not at top of file + "E501", # line too long - let the formatter worry about that + "E731", # do not assign a lambda expression, use a def + "UP007", # use X | Y for type annotations + "UP027", # deprecated + "C40", # unnecessary generator, comprehension, or literal "PIE790", # unnecessary pass statement - "RUF001", - "RUF002", - "RUF003", - "RUF005", - "RUF012", -] -extend-select = [ - "B", # flake8-bugbear - "C4", # flake8-comprehensions - "F", # Pyflakes - "E", # Pycodestyle - "W", - "TID", # flake8-tidy-imports (absolute imports) - "I", # isort - "PERF", # Perflint - "PIE", # flake8-pie - "PGH", # pygrep-hooks - "RUF", - "UP", # Pyupgrade + "PERF203", # try-except within a loop incurs performance overhead + "RUF001", # string contains ambiguous unicode character + "RUF002", # docstring contains ambiguous acute accent unicode character + "RUF003", # comment contains ambiguous no-break space unicode character + "RUF005", # consider upacking operator instead of concatenation + "RUF012", # mutable class attributes ] + [tool.ruff.lint.per-file-ignores] # don't enforce absolute imports "asv_bench/**" = ["TID252"]