I have two git pre-commit hooks enabled in pre-commit-config.yml:
When (1) updates code formatting, it fails, but (2) still runs. Then (1) and (2) must be run again, doubling the time it takes to run the commit. I'd rather run (1) and run (2) only if (1) passes. Is that possible using pre-commit, and if so, how would I do it? I've plumbed the depths fo the documentation but so far I've been unable to find anything useful.
I would not recommend having slow checks in pre-commit, you're likely to have your developers disable / ignore it / context switch
that said, there's an option specifically designed for this, the fail_fast option
it's a top level option so you'd set it like this:
fail_fast: true
repos:
# ...
disclaimer: I created pre-commit
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With