From 36ede4eb05c508b727e41a0f43cc3c88c7a94633 Mon Sep 17 00:00:00 2001 From: Wolfgang Müller Date: Fri, 15 Nov 2024 15:52:00 +0100 Subject: backend/lint: Do not shadow certain builtins This commit enables ruff's flake8-builtin linter that emits warnings when builtin functions are shadowed. This is useful for builtins like "dict", "list", or "str" which we use often. Given the nature of this program we historically rely a lot on the usage of "id", "hash", and "filter" as variable names which also shadow Python builtins. For now let's ignore those, we have not used any of them in our code and the impact to the codebase would be considerable. This might be revisited in the future. --- pyproject.toml | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'pyproject.toml') diff --git a/pyproject.toml b/pyproject.toml index f4ff147..2a3dec1 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -49,6 +49,7 @@ select = [ "W", # pycodestyle "I", # isort "UP", # pyupgrade + "A", # flake8-builtin "B", # flake8-bugbear "SIM", # flake8-simplify "FURB" # refurb @@ -56,6 +57,9 @@ select = [ ignore = ["B007", "SIM102", "SIM108"] +[tool.ruff.lint.flake8-builtins] +builtins-ignorelist = ["copyright", "filter", "hash", "id", "input"] + [tool.pytest.ini_options] pythonpath = ["src"] -- cgit v1.2.3-2-gb3c3