Add a buildifier fixer for Bazel files (#3499)

This fixer enables buildifier's formatting and "lint fix" modes.
Additional options can be provided via `bazel_buildifier_options`.

It also implements some basic logic for guessing the file's type.
buildifier itself usually does this based on the filenames provided on
the command line, but because we're piping our buffer via stdin, we need
to do this manually.
This commit is contained in:
Jon Parise
2021-02-21 04:35:26 -08:00
committed by GitHub
parent 2550f5d952
commit 90b9597d50
10 changed files with 119 additions and 0 deletions

28
doc/ale-bazel.txt Normal file
View File

@@ -0,0 +1,28 @@
===============================================================================
ALE Bazel Integration *ale-bazel-options*
===============================================================================
buildifier *ale-bazel-buildifier*
g:ale_bazel_buildifier_executable *g:ale_bazel_buildifier_executable*
*b:ale_bazel_buildifier_executable*
Type: |String|
Default: `'buildifier'`
See |ale-integrations-local-executables|
g:ale_bazel_buildifier_options *g:ale_bazel_buildifier_options*
*b:ale_bazel_buildifier_options*
Type: |String|
Default: `''`
This variable can be set to pass extra options to buildifier.
g:ale_bazel_buildifier_use_global *g:ale_bazel_buildifier_use_global*
*b:ale_bazel_buildifier_use_global*
Type: |Number|
Default: `get(g:, 'ale_use_global_executables', 0)`
See |ale-integrations-local-executables|