@bazel/buildifier
Advanced tools
Comparing version 3.5.0 to 4.0.0
{ | ||
"name": "@bazel/buildifier", | ||
"description": "A tool for formatting bazel BUILD and .bzl files", | ||
"version": "3.5.0", | ||
"version": "4.0.0", | ||
"license": "Apache-2.0", | ||
@@ -6,0 +6,0 @@ "bin": { |
@@ -29,23 +29,30 @@ # Buildifier | ||
Buildifier automatically detects the file type (either BUILD or .bzl) by its filename. If you | ||
Buildifier supports the following file types: `BUILD`, `WORKSPACE`, `.bzl`, and | ||
default, the latter is reserved for Starlark files buildifier doesn't know about | ||
(e.g. configuration files for third-party projects that use Starlark). The | ||
formatting rules for WORKSPACE files are the same as for BUILD files (both are | ||
declarative and have stricter formatting rules), and default files are formatted | ||
similarly to .bzl files, allowing more flexibility. Different linter warnings | ||
may be limited to any subset of these file types, e.g. a certain warning may be | ||
only relevant to Bazel files (i.e. `BUILD`, `WORKSPACE`, and `.bzl`) or to | ||
non-WORKSPACE files. | ||
$ buildifier $(find . -type f \( -iname BUILD -or -iname BUILD.bazel \)) | ||
Buildifier automatically detects the file type by its filename, taking into | ||
account optional prefixes and suffixes, e.g. `BUILD`, `BUILD.oss`, or | ||
`BUILD.bazel` will be detected as BUILD files, and `build_defs.bzl.oss` is a | ||
.bzl file. Files with unknown names (e.g. `foo.bar`) or files passed via stdin | ||
will be treated as default file type. To override the automatic file type | ||
detection use the `--type` flag explicitly: | ||
Files with unknown names (e.g. `foo.bar`) will be formatted as .bzl files because the format for | ||
.bzl files is more flexible and less harmful. | ||
You can use Buildifier as a filter by invoking it with no arguments. In that mode it reads from | ||
standard input and writes the reformatted version to standard output. In this case it won't be | ||
able to see its name to choose the correct formatting rules, and for compatibility reasons it | ||
will use the BUILD format in such situations. This may be changed in the future, and to enforce | ||
a special format explicitly use the `--type` flag: | ||
$ cat foo.bar | buildifier --type=build | ||
$ cat foo.baz | buildifier --type=bzl | ||
$ cat foo.bar | buildifier --type=bzl | ||
$ cat foo.bar | buildifier --type=workspace | ||
$ cat foo.bar | buildifier --type=default | ||
## Linter | ||
Buildifier has an integrated linter that can point out and in some cases automatically fix various | ||
issues. To use it launch one of the following commands to show and to fix the issues | ||
correspondingly: | ||
Buildifier has an integrated linter that can point out and in some cases | ||
automatically fix various issues. To use it launch one of the following commands | ||
to show and to fix the issues correspondingly (note that some issues cannot be | ||
fixed automatically): | ||
@@ -55,17 +62,19 @@ buildifier --lint=warn path/to/file | ||
By default the linter searches for all known issues except the following: | ||
By default, the linter searches for all known issues relevant for the given | ||
file type except those that are marked with | ||
"[Disabled by default](../WARNINGS.md)" in the documentation. | ||
* [out-of-order-load](../WARNINGS.md#out-of-order-load) | ||
* [unsorted-dict-items](../WARNINGS.md#unsorted-dict-items) | ||
You can specify the categories using the `--warnings` flag either by providing | ||
the categories explicitly: | ||
You can specify the categories using the `--warnings` flag either by providing the categories | ||
explicitly: | ||
buildifier --lint=warn --warnings=positional-args,duplicated-name | ||
or by modifying the default warnings set: | ||
or by modifying the default warnings set by using `+` or `-` modifiers before | ||
each warning category: | ||
buildifier --lint=warn --warnings=-positional-args,+unsorted-dict-items | ||
It's also possible to provide `--warnings=all` to use all supported warnings categories. | ||
It's also possible to provide `--warnings=all` to use all supported warnings | ||
categories (they will still be limited to relevant warnings for the given file | ||
type). | ||
@@ -85,6 +94,6 @@ See also the [full list](../WARNINGS.md) or the supported warnings. | ||
name = "io_bazel_rules_go", | ||
sha256 = "9fb16af4d4836c8222142e54c9efa0bb5fc562ffc893ce2abeac3e25daead144", | ||
sha256 = "d1ffd055969c8f8d431e2d439813e42326961d0942bdf734d2c95dc30c369566", | ||
urls = [ | ||
"https://storage.googleapis.com/bazel-mirror/github.com/bazelbuild/rules_go/releases/download/0.19.0/rules_go-0.19.0.tar.gz", | ||
"https://github.com/bazelbuild/rules_go/releases/download/0.19.0/rules_go-0.19.0.tar.gz", | ||
"https://mirror.bazel.build/github.com/bazelbuild/rules_go/releases/download/v0.24.5/rules_go-v0.24.5.tar.gz", | ||
"https://github.com/bazelbuild/rules_go/releases/download/v0.24.5/rules_go-v0.24.5.tar.gz", | ||
], | ||
@@ -101,6 +110,6 @@ ) | ||
name = "bazel_gazelle", | ||
sha256 = "be9296bfd64882e3c08e3283c58fcb461fa6dd3c171764fcc4cf322f60615a9b", | ||
sha256 = "b85f48fa105c4403326e9525ad2b2cc437babaa6e15a3fc0b1dbab0ab064bc7c", | ||
urls = [ | ||
"https://storage.googleapis.com/bazel-mirror/github.com/bazelbuild/bazel-gazelle/releases/download/0.18.1/bazel-gazelle-0.18.1.tar.gz", | ||
"https://github.com/bazelbuild/bazel-gazelle/releases/download/0.18.1/bazel-gazelle-0.18.1.tar.gz", | ||
"https://mirror.bazel.build/github.com/bazelbuild/bazel-gazelle/releases/download/v0.22.2/bazel-gazelle-v0.22.2.tar.gz", | ||
"https://github.com/bazelbuild/bazel-gazelle/releases/download/v0.22.2/bazel-gazelle-v0.22.2.tar.gz", | ||
], | ||
@@ -111,2 +120,4 @@ ) | ||
# If you use WORKSPACE.bazel, use the following line instead of the bare gazelle_dependencies(): | ||
# gazelle_dependencies(go_repository_default_config = "@//:WORKSPACE.bazel") | ||
gazelle_dependencies() | ||
@@ -113,0 +124,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Native code
Supply chain riskContains native code (e.g., compiled binaries or shared libraries). Including native code can obscure malicious behavior.
Found 2 instances in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
22312905
211
4