nice-park-16693
03/16/2023, 8:57 AMblack
as an example -- I would like to be able to run black
with the same config and versions through pre-commit as I do when I execute pants fmt
so that the results are consistent, but I don't want to config these in two places. So far I've tried:
• just run black
via pre-commit, ignoring pants. This is fairly trivial but it needs me to write a version number in .pre-commit-config.yaml
as well as in pants.toml
, and that's slightly annoying because those can get out of sync
• change pre-commit to run plz fmt
instead of using the black
plugin directly. This avoids the need to duplicate config, but it has the downside that now pre-commit doesn't format build files or things that pants doesn't "know about", like stuff under 3rdparty/
.
Any pointers from someone who has trodden this path before? Same question applies to lint and check.ripe-scooter-10665
03/16/2023, 9:09 AMbroad-processor-92400
03/16/2023, 10:36 AMpants tailor update-build-files fmt lint check ::
. I imagine this could be invoked from a pre commit hook.
I think it’s possible to have BUILD files defining targets in 3rdparty
too.
Another option for them might be having the normal pre commit plug-in run on only the non-pants directories (and, even if the configs are different, at least each file has a single source of truth, either pants or pre-commit$.refined-addition-53644
03/16/2023, 12:25 PM