Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add new fmt plugins for build file formatting #16560

Merged
merged 17 commits into from
Aug 22, 2022
2 changes: 1 addition & 1 deletion docs/markdown/Releases/upgrade-tips.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ You do not need to land every upgrade into your organization—often, you will w
First, see if Pants can automatically fix any safe deprecations for you:

```bash
# You may want to use `--no-fmt` if your BUILD files are already formatted.
# To avoid unrelated formatting changes, you may want to use `--no-fmt`.
❯ ./pants update-build-files --no-fmt ::
```

Expand Down
4 changes: 1 addition & 3 deletions docs/markdown/Using Pants/concepts/targets.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,7 @@ Each target type has different _fields_, or individual metadata values. Run `./p

All target types have a `name` field, which is used to identify the target. Target names must be unique within a directory.

Use [`./pants tailor ::`](doc:initial-configuration#5-generate-build-files) to automate generating BUILD files.
You can autoformat build files by opting into one of the plugins under `pants.backend.build_files.fmt` and
running `./pants fmt **/BUILD` or `./pants fmt ::` (which formats everything).
You can autoformat `BUILD` files by enabling a `BUILD` file formatter by adding it to `[GLOBAL].backend_packages` in `pants.toml` (such as `pants.backend.build_files.fmt.black` [or others](https://www.pantsbuild.org/v2.13/docs/enabling-backends)). Then to format, run `./pants fmt '**/BUILD'` or `./pants fmt ::` (formats everything).
thejcannon marked this conversation as resolved.
Show resolved Hide resolved

Target addresses
================
Expand Down
4 changes: 4 additions & 0 deletions pants.toml
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,10 @@ ignore_adding_targets = [
"src/python/pants/backend/terraform:hcl2_parser0",
]

[update-build-files]
# We use `pants.backend.build_files.fmt.black`
fmt = false

[pex]
venv_use_symlinks = true

Expand Down