Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Unfortunately people will use --no-verify to bypass hooks.


I don't understand commit hooks - they're like binding a macro to the MS Word save button to make it conditional.


> like binding a macro to the MS Word save button to make it conditional

You have no idea how much I'd love that feature. Inasmuch as "save" is still a thing anyway. I don't miss explicit saves in IDEA, I see commit as the "real" save operation now, and I don't mind being able to hook that in an IDE-independent way.

I think the UX of git hooks has been sub-par for sure, but tools like the confusingly named pre-commit are helping there.


Because if you haven’t auto-formatted, lined, etc. then it’s a very easy way to do that so you don’t waste time watching CI fail for something stupid like trailing comma placement.

I don’t want to think about formatting, I just want everything to be consistent. A pre commit hook can run those tools for me, and if any changes occurred, it can add them to the commit.


There's a long set of steps to making a tool mandatory in a development environment, but the final step should always, always be, "And you will find yourself on a PIP if you refuse to use the mandatory tools."

If people want to die on a hill that is demonstrably causing problems for all of their coworkers then let em.


Oh how I wish engineering leadership would actually mandate certain things such as this.


They always pick the wrong things to mandate don't they.


Enforce on CI. Autofix in pre-commit hooks. Lefthook is fantastic for this.

Example config: https://github.com/anttiharju/vmatch/blob/9e64b0636601c236a5...


You can put hooks on the server side of git. It can do pretty much anything that CI/CD can.


That requires Github Enterprise (if using GH, of course), no?


Well it requires a server and 5 minutes of your time :) I guess you can always have it as a mirror for your GH repository. Gitlab has push mirroring, not sure about GH: https://docs.gitlab.com/user/project/repository/mirror/push/


Then they'll lose time for the same verifications to fail in the PR?




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: