cool-easter-32542
03/14/2023, 8:49 PM./pants help backends shows that pants.backend.build_files.fix.deprecations and pants.backend.build_files.fmt.black are NOT enabled by default. That surprised me because the update-build-files goal definitely uses black.
Describe the solution you'd like
In the help backends output:
Enabled backends are marked with `*`. To enable a backend add it to `[GLOBAL].backend_packages`.
Let's add another character, maybe -, to show that a backend is conditionally enabled.
The update-build-files goal will use a formatter backend without regard to the [GLOBAL].backend_packages setting. By default, it uses pants.backend.build_files.fmt.black and pants.backend.build_files.fix.deprecations.
The formatter can be switched from black to yapf or buildifier based on the `[update-build-files].formatter` setting.
Using fix.deprecations backend is controlled by the `[update-build-files].fix_safe_deprecations` setting (either True or False).
So, these goal-specific backends should get a - indicator to show that it is enabled, but only for that one special-purpose goal based on different settings.
Describe alternatives you've considered
Just remove the backends from the output? That would be confusing too, because the backends exist. Also, you can enable the pants.backend.build_files.fix.deprecations backend so that it ALSO runs during the fix goal, not just during update-build-files.
Additional context
current output
% ./pants help backends
Backends
--------
List with all known backends for Pants.
Enabled backends are marked with `*`. To enable a backend add it to `[GLOBAL].backend_packages`.
...
[ ] pants.backend.build_files.fix.deprecations [pants]
[ ] pants.backend.build_files.fmt.black [pants]
[ ] pants.backend.build_files.fmt.buildifier [pants]
[ ] pants.backend.build_files.fmt.yapf [pants]
...
[*] pants.backend.python [pants]
Support for Python.
See <https://www.pantsbuild.org/docs/python-backend>.
[ ] pants.backend.python.lint.autoflake [pants]
Autoformatter for removing unused Python imports.
See <https://github.com/myint/autoflake> for details.
[*] pants.backend.python.lint.bandit [pants]
Security linter for Python.
See <https://www.pantsbuild.org/docs/python-linters-and-formatters> and
<https://bandit.readthedocs.io/en/latest/>.
[*] pants.backend.python.lint.black [pants]
Autoformatter for Python.
See <https://www.pantsbuild.org/docs/python-linters-and-formatters> and
<https://black.readthedocs.io/en/stable/>.
...
proposed output
% ./pants help backends
Backends
--------
List with all known backends for Pants.
Enabled backends are marked with `*`. To enable a backend add it to `[GLOBAL].backend_packages`.
The `update-build-files` goal uses backends marked with `-` based on `[update-build-files]` settings.
...
[-] pants.backend.build_files.fix.deprecations [pants]
[-] pants.backend.build_files.fmt.black [pants]
[ ] pants.backend.build_files.fmt.buildifier [pants]
[ ] pants.backend.build_files.fmt.yapf [pants]
...
[*] pants.backend.python [pants]
Support for Python.
See <https://www.pantsbuild.org/docs/python-backend>.
[ ] pants.backend.python.lint.autoflake [pants]
Autoformatter for removing unused Python imports.
See <https://github.com/myint/autoflake> for details.
[*] pants.backend.python.lint.bandit [pants]
Security linter for Python.
See <https://www.pantsbuild.org/docs/python-linters-and-formatters> and
<https://bandit.readthedocs.io/en/latest/>.
[*] pants.backend.python.lint.black [pants]
Autoformatter for Python.
See <https://www.pantsbuild.org/docs/python-linters-and-formatters> and
<https://black.readthedocs.io/en/stable/>.
...
pantsbuild/pants