chore: setup a buildifier pre-commit hook (#661)

Matches the one just landed in rules_apple: 61bc7c01ae
This commit is contained in:
Alex Eagle 2021-06-03 13:30:26 -07:00 committed by GitHub
parent eb72705d3d
commit 118c55d424
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 78 additions and 51 deletions

View File

@ -187,4 +187,5 @@ tasks:
buildifier:
version: latest
# keep this argument in sync with .pre-commit-config.yaml
warnings: "all"

13
.pre-commit-config.yaml Normal file
View File

@ -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/config.yaml
- --warnings=all
- id: buildifier-lint
args: *args

View File

@ -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

View File

@ -1,81 +1,81 @@
package(default_visibility = ['//visibility:public'])
package(default_visibility = ["//visibility:public"])
filegroup(
name = 'gcc',
name = "gcc",
srcs = [
'bin/arm-linux-gnueabihf-gcc',
"bin/arm-linux-gnueabihf-gcc",
],
)
filegroup(
name = 'ar',
name = "ar",
srcs = [
'bin/arm-linux-gnueabihf-ar',
"bin/arm-linux-gnueabihf-ar",
],
)
filegroup(
name = 'ld',
name = "ld",
srcs = [
'bin/arm-linux-gnueabihf-ld',
"bin/arm-linux-gnueabihf-ld",
],
)
filegroup(
name = 'nm',
name = "nm",
srcs = [
'bin/arm-linux-gnueabihf-nm',
"bin/arm-linux-gnueabihf-nm",
],
)
filegroup(
name = 'objcopy',
name = "objcopy",
srcs = [
'bin/arm-linux-gnueabihf-objcopy',
"bin/arm-linux-gnueabihf-objcopy",
],
)
filegroup(
name = 'objdump',
name = "objdump",
srcs = [
'bin/arm-linux-gnueabihf-objdump',
"bin/arm-linux-gnueabihf-objdump",
],
)
filegroup(
name = 'strip',
name = "strip",
srcs = [
'bin/arm-linux-gnueabihf-strip',
"bin/arm-linux-gnueabihf-strip",
],
)
filegroup(
name = 'as',
name = "as",
srcs = [
'bin/arm-linux-gnueabihf-as',
"bin/arm-linux-gnueabihf-as",
],
)
filegroup(
name = 'compiler_pieces',
name = "compiler_pieces",
srcs = glob([
'arm-linux-gnueabihf/**',
'libexec/**',
'lib/gcc/arm-linux-gnueabihf/**',
'include/**',
"arm-linux-gnueabihf/**",
"libexec/**",
"lib/gcc/arm-linux-gnueabihf/**",
"include/**",
]),
)
filegroup(
name = 'compiler_components',
name = "compiler_components",
srcs = [
':gcc',
':ar',
':ld',
':nm',
':objcopy',
':objdump',
':strip',
':as',
":ar",
":as",
":gcc",
":ld",
":nm",
":objcopy",
":objdump",
":strip",
],
)