From c0ce4e5654573e4b523401f43a20acaef6a6d9b1 Mon Sep 17 00:00:00 2001 From: Guillaume Lambert Date: Thu, 27 May 2021 21:46:58 +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: I74e22bff98c78a7d0dbabac81fdda7b07ed50d4f --- .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 318d59c..dff752e 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -35,7 +35,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.16.6