cool-easter-32542
07/16/2023, 7:08 PMpre-commit hook. We've had discussions on Slack about eliminating the hook altogether, but I'd like to propose an alternate suggestion which I've been using to great success recently.
Avoid pre-commit hooks like the plague, but enforce pre-push hooks like... umm... the plague?
The idea is that, no one should care what happens on a developer's machine on each commit - some people commit often, some people frequently - whatever. No one should be punished by waiting for a script to run based on them liking to commit often.
However, once that code needs to go to a shared location (e.g. Github), it should already be formatted, linted, tested (via changed-since) as expected to avoid burning any slow Github CI cycles on code that will 100% fail CI when pushed (e.g. extra newline or something).
Even though we don't pay for GH CI - we should still be good citizens about not using unnecessary resources if not necessary.
I will say on a private project, enforcing pre-push in lieu of pre-commit reduced useless CI by about 10% and basically no one complains about it slowing down their dev cycles anymore.
pantsbuild/pants