zlacker

[parent] [thread] 5 comments
1. xyzzy_+(OP)[view] [source] 2026-02-03 18:03:30
Another commenter is currently down voted for something similar, but I'll share my controversial take anyways: I hate pre-commit hooks.

I loathe UX flows where you get turned around. If I try to make a commit, it's because that I what I intend to do. I don't want to receive surprise errors. It's just more magic, more implicit behavior. Give me explicit tooling.

If you want to use pre-commit hooks, great! You do you. But don't force them on me, as so many projects do these days.

replies(3): >>nitnel+R2 >>chucka+vu >>chippi+jd1
2. nitnel+R2[view] [source] 2026-02-03 18:13:48
>>xyzzy_+(OP)
Client-side pre-commit hooks are there to help you in the same way that type checking (or a powerful compiler) is there to help you avoid bugs. In particular with git, you can skip the hooks when committing.

Now, if the server enforces checks on push, that's a project policy that should be respected.

replies(1): >>sa46+Yp
◧◩
3. sa46+Yp[view] [source] [discussion] 2026-02-03 19:45:35
>>nitnel+R2
The problem is that pre-commit hooks are much slower with a much higher false-positive rate than type checking.

Pre-commit checks should be opt-in with CI as the gate. It's useful to be able to commit code in a failing state.

replies(1): >>chippi+3d1
4. chucka+vu[view] [source] 2026-02-03 20:04:57
>>xyzzy_+(OP)
I use exactly one such hook, and that's to add commit signoff because of a checklist-compliance item called DCO that fails all PRs unless they have the sign-off trailer added by `git commit -s`. I've long argued that we should be enforcing actual signed commits instead, but compliance has never been about doing the sensible thing.

It's as simple as a script with a cp command that I run after any clone of a repo that requires it; certainly doesn't require anything as elaborate as a hook manager.

◧◩◪
5. chippi+3d1[view] [source] [discussion] 2026-02-03 23:57:12
>>sa46+Yp
No one forces you to install the pre-commit hook on your local checkout so what you're suggesting is universally the case. You're perfectly free to just run it manually or let it fail in CI or use `--no-verify` when committing to skip the hook if you install it.
6. chippi+jd1[view] [source] 2026-02-03 23:58:22
>>xyzzy_+(OP)
But no one forces pre-commit hooks onto you? You can just not install the hook into git and run the tool manually instead.
[go to top]