Is there a way to make `update-build-files` run on...
# general
l
Is there a way to make
update-build-files
run only on BUILD files which have changed? In pre-commit and CI I would like to avoid checking every file if we can.
💯 1
h
Getting it to work with
--changed-since
is semi-blocked by this proposal https://docs.google.com/document/d/1WWQM-X6kHoSCKwItqf61NiKFWNSlpnTC5QNu3ul9RDk/edit#heading=h.1h4j0d5mazhu which is the change I most want to make in 2022
l
thanks! I will follow that
e
Related question: is
update-build-files
the only way to get our build files formatted? Can/should
fmt
apply to build files? It seems like "update the syntax of all build files for the latest version of pants" is a deeper and broader task than "format recently update BUILD files"
w
@eager-dress-66405: yea: see https://github.com/pantsbuild/pants/issues/13504 for some more discussion there.
e
I see. So in the same way
fmt
currently runs both types of formatters (black and pyupgrade), but the later might get split into a
fix
goal in a later version,
update-build-files
is the only currently available way to format
BUILD
files be it for indentation or new pants syntax? +1 for making the
fmt
be able to run lightweight formatting (e.g. black) on `BUILD`files.
h
Yeah,
update-build-files
is currently the only way to do it The first step I want to do is unify
tailor
and
update-build-files
. I realized it's not very valuable for them to be separate. My dream is that you can run
./pants --changed-since=HEAD update-pants-config
(fusion of both) and it will make sure all your Pants config is in tip-top shape. Any missing targets are added, deprecations are fixed, BUILD files are pretty
w
hm. i’m still thinking that the formatting and fixing aspects should be split semantically, rather than by which files they operate on
and in that regard, you would have
fix
and
fmt
, with: •
fix
making semantic changes to BUILD files, pants config, python files, scala files, etc, etc •
fmt
making formatting changes to all of the above.
🙌 1