3 ms·
Pre commit hooks that fail are trash, just absolutely the worst thing you can do to ruin your team's good practices of committing often & keeping flow high. An
by rektide 4y ago
Pre commit hooks that fail are trash, just absolutely the worst thing you can do to ruin your team's good practices of committing often & keeping flow high.
Any check that take more than 6 seconds can also go jump off a cliff as car as I'm concerned.
But I do greatly value fast fixing & feedback. Run format! (and don't print out unchanged things!) Run lint! Maybe run tests, if they're fast.
One of the constraints becomes that you are trying to make quick actionable easy to view data, and the output can become too long. We had some outside teams come in & deploy centralized & more updated lint & testing, and alas there's just multiple pages of yellow jest configuration warning as it starts, and it's just so much harder to quickly check status. These hooks need to be quick to read, as well as run. All of the hooks should run if they can, not stop on first problem.
Ideally the ci/CD system is a good fast way to see test results. Devs shouldn't even have to think about it, just commit & off board the running. I hear Facebook has very interesting systems where devs aren't even having to make commits for this, which sounds epic. Alas many ci/CD systems are doubly slow, which sucks: slow to start, slow execution speed, and most damming low caching, so they have to do a lot of from-scratch bring up that just takes a really long time versus what local dev has. Systems like nx in JS land are starting to change this more systematically, rather than being a lot of custom ci/CD tweaking.
Informational, not prescriptive! Use the tools to accelerate & guide. Right now we're all learning but tool heavy setups are for sure the way.
- hakre 4y agoAnd not to forget: - Pre-Commit hooks that fail to handle partial stages. - Running CI as far away as possible to enlarge feedback time. - Non-incremental builds.
- soulofmischief 4y agoOne reason I love using yarn to cache my packages in JS-land. npm needs to catch up. Huge gains in deployment times.
- nine_k 4y agoPre-commit hooks that can't fail are not very useful :) That is, they are not preventing you from committing something patently incorrect. But pre-commit hooks should fail fast.