Avoid pre-commit hooks

Pre-commit hooks sound like a good place to check your code because you get feedback earlier. But at the same time they break your workflow and do more harm than good.

You can't commit and continue your work, because commit isn't "finished". And it doesn't make sense to switch to another task as pre-commit checks will end soon. Processes in pre-commit hooks are usually long enough to be noticeable and short enough to not allow do anything in parallel. So, you have to sit and watch how your code is "committing".

What to use instead: IDE + checks on CI server is a perfect combo. You see warnings and errors while you editing code and can fix it, you get more checks asynchronously and have a chance to fix it later.


Created: 2022-10-23