CI formatting pre-hook
Mike Blumenkrantz
michael.blumenkrantz at gmail.com
Tue Feb 20 18:18:41 UTC 2024
Hi,
In recent times, Mesa CI has grown the clang-format job which enforces
formatting in some parts of the tree.
I hate this job, and I think the majority of Mesa developers also hate this
job. This majority is, of course, excluding a small number of very vocal
enthusiasts, as seen in e.g.,
https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23719 (a response
to an admittedly unilateral action).
Why do I hate this formatting job, you might be asking. Let's look at a
test pipeline from a recent refactoring series:
https://gitlab.freedesktop.org/zmike/mesa/-/pipelines/1108274.
Oh no, clang-format failed.
https://gitlab.freedesktop.org/zmike/mesa/-/jobs/55270157
Out of 4 hunks it rejected, all the fails are nonsensical line wrapping
preferences that nobody cares about. In some cases, my changes didn't even
affect the rejected lines, and yet somehow I am now responsible for
"fixing" them. It's not the first time I've seen this sort of thing, and,
even if line wrapping heuristics improve, I'm sure it won't be the last
time this situation occurs.
These types of CI fails are a waste of both CI time and collective
developer effort. If people want to enforce code formatting across their
little part of the tree, that should be the responsibility of the reviewer.
To that end, I've created
https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27702 which
changes errors in clang-format jobs to warnings. If the job fails, the
pipeline can still succeed. I think this is a better balance between people
who want to opt-in to formatting checks for their parts of the tree and
people who absolutely don't: if a reviewer cares about formatting, they're
free to run a test pipeline and check the format job's results. If they
aren't happy with it, they can block the MR until changes are addressed.
This also provides some leeway where obviously stupid changes proposed by
the job (as above) can be ignored.
Thoughts?
Mike
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/mesa-dev/attachments/20240220/62c02977/attachment.htm>
More information about the mesa-dev
mailing list