From bd80bcbbfdf201e4fac134086d7ce0d532ee5384 Mon Sep 17 00:00:00 2001 From: Ryan Butler Date: Fri, 10 Apr 2020 21:52:03 -0400 Subject: [PATCH] Update bazel to match only extension or whole name The hook was originally matching all files in the repository as long as they had `BUILD` or `BUILD.bazel` in them. This meant that they actually overrode the `files` setting in the user's repository. This commit ensures that, for example, `BUILD.bazel` and `whatever/BUILD.bazel` match, but not `whateverBUILD.bazelasdf`. It also adds support for `whatever.BUILD` files. --- .pre-commit-hooks.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.pre-commit-hooks.yaml b/.pre-commit-hooks.yaml index c8d3ffe..8a3efa8 100644 --- a/.pre-commit-hooks.yaml +++ b/.pre-commit-hooks.yaml @@ -1,7 +1,7 @@ - id: bazel-buildifier name: 'bazel buildifier' entry: run-bazel-buildifier.sh - files: 'BUILD.bazel|BUILD' + files: '(^(BUILD\.bazel|BUILD)|/\2|\.BUILD)$' language: 'script' description: "Runs `buildifier`, requires bazel buildifier" - id: go-imports