Skip to content

Commit 4363f82

Browse files
committed
chore: update pre-commit settings
Now matches rules_apple bazelbuild/rules_apple@61bc7c0 so we can be consistent for all rulesets
1 parent e3cdcba commit 4363f82

File tree

2 files changed

+22
-19
lines changed

2 files changed

+22
-19
lines changed

.pre-commit-config.yaml

+9-19
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,13 @@
1+
# See CONTRIBUTING.md for instructions.
12
# See https://pre-commit.com for more information
23
# See https://pre-commit.com/hooks.html for more hooks
34
repos:
4-
- repo: local
5+
- repo: https://github.com/keith/pre-commit-buildifier
6+
rev: 4.0.1.1
57
hooks:
6-
7-
- id: bazel-format
8-
name: bazel format
9-
description: Auto-formats starlark code
10-
entry: buildifier --lint=off --mode=fix
11-
files: '^(.*/)?(BUILD\.bazel|BUILD|WORKSPACE)$|\.BUILD$|\.bzl$'
12-
# Ideally we'd exclude third_party, but the CI enforcement doesn't support it, see
13-
# https://github.com/bazelbuild/continuous-integration/issues/1162
14-
# exclude: '^third_party/'
15-
language: system
16-
17-
- id: bazel-lint
18-
name: bazel lint
19-
description: Checks for code style violations in starlark code
20-
# Keep this list in sync with .bazelci/presubmit.yml
21-
entry: buildifier --lint=warn --mode=fix -v --warnings=attr-cfg,attr-license,attr-non-empty,attr-output-default,attr-single-file,confusing-name,constant-glob,ctx-actions,ctx-args,depset-iteration,depset-union,dict-concatenation,duplicated-name,filetype,function-docstring,git-repository,http-archive,integer-division,load,load-on-top,module-docstring,name-conventions,native-build,native-package,out-of-order-load,output-group,package-name,package-on-top,positional-args,redefined-variable,repository-name,return-value,same-origin-load,string-iteration,unreachable,unsorted-dict-items,unused-variable
22-
files: '^(.*/)?(BUILD\.bazel|BUILD|WORKSPACE)$|\.BUILD$|\.bzl$'
23-
language: system
8+
- id: buildifier
9+
args: &args
10+
# Keep this argument in sync with .bazelci/presubmit.yml
11+
- --warnings=attr-cfg,attr-license,attr-non-empty,attr-output-default,attr-single-file,confusing-name,constant-glob,ctx-actions,ctx-args,depset-iteration,depset-union,dict-concatenation,duplicated-name,filetype,function-docstring,git-repository,http-archive,integer-division,load,load-on-top,module-docstring,name-conventions,native-build,native-package,out-of-order-load,output-group,package-name,package-on-top,positional-args,redefined-variable,repository-name,return-value,same-origin-load,string-iteration,unreachable,unsorted-dict-items,unused-variable
12+
- id: buildifier-lint
13+
args: *args

CONTRIBUTING.md

+13
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,18 @@
11
Want to contribute? Great! First, read this page (including the small print at the end).
22

3+
## Formatting
4+
5+
Starlark files should be formatted by buildifier.
6+
We suggest using a pre-commit hook to automate this.
7+
First [install pre-commit](https://pre-commit.com/#installation),
8+
then run
9+
10+
```shell
11+
pre-commit install
12+
```
13+
14+
Otherwise the Buildkite CI will yell at you about formatting/linting violations.
15+
316
### Before you contribute
417

518
**Before we can use your code, you must sign the

0 commit comments

Comments
 (0)