Skip to content

Commit

Permalink
Add buildifier pre-commit hook and instructions (#1879)
Browse files Browse the repository at this point in the history
  • Loading branch information
alexeagle authored Jun 4, 2021
1 parent 1c9c022 commit e005f17
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 0 deletions.
1 change: 1 addition & 0 deletions .bazelci/presubmit.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
---
buildifier:
version: 4.0.1
# Keep this argument in sync with .pre-commit-config.yml
warnings: "-function-docstring-args,-print,-provider-params,-unnamed-macro"
bazel: 4.0.0
tasks:
Expand Down
13 changes: 13 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# See CONTRIBUTING.md for instructions.
# See https://pre-commit.com for more information
# See https://pre-commit.com/hooks.html for more hooks
repos:
- repo: https://github.com/keith/pre-commit-buildifier
rev: 4.0.1.1
hooks:
- id: buildifier
args: &args
# Keep this argument in sync with .bazelci/presubmit.yml
- --warnings=-function-docstring-args,-print,-provider-params,-unnamed-macro
- id: buildifier-lint
args: *args
13 changes: 13 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,19 @@
We'd love to accept your patches and contributions to this project. There are
just a few small guidelines you need to follow.

## Formatting

Starlark files should be formatted by buildifier.
We suggest using a pre-commit hook to automate this.
First [install pre-commit](https://pre-commit.com/#installation),
then run

```shell
pre-commit install
```

Otherwise the Buildkite CI will yell at you about formatting/linting violations.

## Contributor License Agreement

Contributions to this project must be accompanied by a Contributor License
Expand Down

0 comments on commit e005f17

Please sign in to comment.