CodeFaster

CodeFaster

Share this post

CodeFaster
CodeFaster
Don't put autofixers in precommit

Don't put autofixers in precommit

Tyler Adams's avatar
Tyler Adams
Dec 03, 2021
∙ Paid
2

Share this post

CodeFaster
CodeFaster
Don't put autofixers in precommit
2
Share

Autofixers in precommit are stupid because they break a fundamental rule of version control: “What you get out of it must be what you put into it” (as coined by Linus). I’ll push this idea in a new direction and say if you use an autofixer in precommit, the VCS (Version Control System), by definition changes what you put into it.

If you ever feel you should use an autofixer in precommit:

1 - Lie down until the feeling passes.

2 - Add a checker to premerge checks.

The 2nd point is key. Autofixers are great and you should use them. Code in trunk should maintain the property that autofixers are a no-op on them. If not, the code is not ready to be merged to trunk. But you have to make sure what you get out of VCS is exactly what you put into it. So, don’t add the autofixer in precommit.

This post is for paid subscribers

Already a paid subscriber? Sign in
© 2025 Tyler Adams
Privacy ∙ Terms ∙ Collection notice
Start writingGet the app
Substack is the home for great culture

Share