From: Guillaume Lambert Date: Thu, 27 May 2021 19:46:58 +0000 (+0200) Subject: Fix: bandit pre-commit hook exclude regex X-Git-Tag: v0.7.0~5 X-Git-Url: https://gerrit.linuxfoundation.org/infra/gitweb?a=commitdiff_plain;h=c0ce4e5654573e4b523401f43a20acaef6a6d9b1;p=releng%2Fdocs-conf.git 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 --- 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