Skip to main content
Version: 2.0 (deprecated)

fmt


pants fmt [args]

Autoformat source code.

Backend: ``

Config section: [fmt]

Basic options

None

Advanced options

per_file_caching

--[no-]fmt-per-file-caching
PANTS_FMT_PER_FILE_CACHING
pants.toml
[fmt]
per_file_caching = <bool>
default: False

Rather than formatting all files in a single batch, format each file as a separate process. Why do this? You'll get many more cache hits. Why not do this? Formatters both have substantial startup overhead and are cheap to add one additional file to the run. On a cold cache, it is much faster to use --no-per-file-caching. We only recommend using --per-file-caching if you are using a remote cache or if you have benchmarked that this option will be faster than --no-per-file-caching for your use case.

Deprecated options

per_target_caching

--[no-]fmt-per-target-caching
PANTS_FMT_PER_TARGET_CACHING
pants.toml
[fmt]
per_target_caching = <bool>
default: False
Deprecated, will be removed in version: 2.1.0.dev0.
Use the renamed `--per-file-caching` option instead. If this option is set, Pants will now run per every file, rather than per target.

See --per-file-caching.