facebook / buck2

Build system, successor to Buck
https://buck2.build/
Apache License 2.0
3.52k stars 215 forks source link

Formatting BUCK files #200

Open benbrittain opened 1 year ago

benbrittain commented 1 year ago

I'm currently using buildifier to do formatting for our project. That being said, if we do wind up actually migrating from bazel to buck2, it would be nice if we could unify our tooling entirely. Are there any plans to leverage the starlark parser within buck2 to provide a formatting option (something like buck2 fmt)?

If there isn't a plan to bundle a formatter, would a contribution like this be well received?

dtolnay commented 1 year ago

Buildifier works pretty well on BUCK files. find . -name BUCK | xargs -n1 buildifier -path=BUILD

benbrittain commented 1 year ago

We're using buildifier for formatting the BUCK files already, it works fine. That being said, having an obvious single point of entry is always a nice. Not a big deal, but potentially nice quality of life improvement.

ndmitchell commented 1 year ago

The plan would be to add a formatter to the https://github.com/facebookexperimental/starlark-rust library, and then expose it through buck2 starlark fmt or similar. Vaguely something we'd like to do, but someone writing a formatter is the first step.