Skip to content

Commit a76db53

Browse files
committed
chore: add a pre-commit hook config.
This matches the Bazel recommendation from https://github.com/bazel-contrib/rules-template for configuring an optional, client-side automation for formatting BUILD/bzl files before sending a PR. It has been found to save a bunch of time for contributors who otherwise trip over the server-side CI check and have to do an extra iteration to get their PR green. I imagine Googlers are already relying on some Piper feature to do the equivalent when they work on this code, so they haven't noticed the deficiency.
1 parent 2d33f81 commit a76db53

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

.pre-commit-config.yaml

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# Optional local setup for a git pre-commit hook to automatically format/lint.
2+
# This avoids sending a red PR and having to find the buildifier output on the CI results page.
3+
# See https://pre-commit.com for more information on installing pre-commit.
4+
# See https://pre-commit.com/hooks.html for more hooks.
5+
6+
repos:
7+
# Check formatting and lint for starlark code
8+
- repo: https://github.com/keith/pre-commit-buildifier
9+
rev: 6.3.3
10+
hooks:
11+
- id: buildifier
12+
- id: buildifier-lint

0 commit comments

Comments
 (0)