From f4da21e2043c1baec052be6f44206bd3c31eb96f Mon Sep 17 00:00:00 2001 From: Guillaume Lambert Date: Thu, 17 Jun 2021 10:20:59 +0200 Subject: [PATCH] Fix: bandit pre-commit hook exclude regex The 'exclude' field in pre-commit hook is a regex, not a glob, as it is advertised by pre-commit runtime warnings. "tests/*" matches "tests", "tests/" or "tests//...///" but also any file or folder, not necessarily at the root of the project, that contains "tests" in its name. The right regex to ignore the tests folder at project root is "^test/" Signed-off-by: Guillaume Lambert Change-Id: I12d8c7e2205085ef1fb2fdf267d059112729d705 --- .pre-commit-config.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index ca5cf7fbb4..e15b6fde97 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -46,7 +46,7 @@ repos: hooks: - id: bandit # Bandit does not need to run on test code - exclude: tests/* + exclude: ^tests/ - repo: https://github.com/pycqa/pydocstyle rev: 5.0.2 -- 2.36.6