From 5d3335f2145269409b0c0b782757163c13842f20 Mon Sep 17 00:00:00 2001 From: Ryan Butler Date: Fri, 10 Apr 2020 21:52:03 -0400 Subject: [PATCH 1/3] 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 | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.pre-commit-hooks.yaml b/.pre-commit-hooks.yaml index ffa114c..fde9ed1 100644 --- a/.pre-commit-hooks.yaml +++ b/.pre-commit-hooks.yaml @@ -2,7 +2,7 @@ name: bazel buildifier description: Runs `buildifier`, requires buildifier binary entry: buildifier - files: 'BUILD.bazel|BUILD|WORKSPACE' + files: '(^(BUILD\.bazel|BUILD)|/\2|\.BUILD)$' language: system - id: do-not-submit @@ -11,3 +11,4 @@ entry: check_do_not_submit.py language: script files: '.*' + From d6993141952ab28567c8e4236341c310b3cb3699 Mon Sep 17 00:00:00 2001 From: Ryan Butler Date: Sat, 11 Apr 2020 05:02:53 -0400 Subject: [PATCH 2/3] Update .pre-commit-hooks.yaml --- .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 fde9ed1..ce971ef 100644 --- a/.pre-commit-hooks.yaml +++ b/.pre-commit-hooks.yaml @@ -2,7 +2,7 @@ name: bazel buildifier description: Runs `buildifier`, requires buildifier binary entry: buildifier - files: '(^(BUILD\.bazel|BUILD)|/\2|\.BUILD)$' + files: '(^(|.*/)(BUILD\.bazel|BUILD)|\.BUILD)$' language: system - id: do-not-submit From bc207faff77977781b4736f5ee379aa00900d24e Mon Sep 17 00:00:00 2001 From: Ryan Butler Date: Sat, 11 Apr 2020 18:19:41 -0400 Subject: [PATCH 3/3] Update .pre-commit-hooks.yaml --- .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 ce971ef..3429004 100644 --- a/.pre-commit-hooks.yaml +++ b/.pre-commit-hooks.yaml @@ -2,7 +2,7 @@ name: bazel buildifier description: Runs `buildifier`, requires buildifier binary entry: buildifier - files: '(^(|.*/)(BUILD\.bazel|BUILD)|\.BUILD)$' + files: '^(.*/)?(BUILD\.bazel|BUILD)$|\.BUILD$' language: system - id: do-not-submit