Everytine I’ve seen a pre-commit hook in my job, it was something that should have been in integration pipeline.
You should not run linter, test or any static analysis tool in a pre-commit (I’m looking at you husky 😡). Why ? Because:
It takes time. A commit should be instantaneous.
It may change the content of the commit or of the repos without explicite action of the developer.
The developper’s branch is the developper’s mess. He don’t have to respect any convention, any quality gate or any workflow on its branch. Quality gates should happen only when integrating into trunk.
I always commit and push on Friday afternoon before leaving as “WIP”, in case my computer crash during week end. I don’t want to address issues of a WIP job. I just want to backup my work.
I may commit several time per minute, and do a rebase latter. I don’t want to spend 2min each time waiting for eslint to parse the repos. I don’t want to fix styling because I now I will fix it later and rebase -i before pushing.
You can use custom pre-commit in your own workflow, but forcing all developer to have the same pre-commit is a bad idea.
Amen. I also need to be able to commit WIP quickly if i need to urgently checkout master, or push my code because my laptop battery is about to die and i dont want it to have the only copy of my work.
Everytine I’ve seen a pre-commit hook in my job, it was something that should have been in integration pipeline.
You should not run linter, test or any static analysis tool in a pre-commit (I’m looking at you husky 😡). Why ? Because:
It takes time. A commit should be instantaneous.
It may change the content of the commit or of the repos without explicite action of the developer.
The developper’s branch is the developper’s mess. He don’t have to respect any convention, any quality gate or any workflow on its branch. Quality gates should happen only when integrating into trunk.
I always commit and push on Friday afternoon before leaving as “WIP”, in case my computer crash during week end. I don’t want to address issues of a WIP job. I just want to backup my work.
I may commit several time per minute, and do a rebase latter. I don’t want to spend 2min each time waiting for eslint to parse the repos. I don’t want to fix styling because I now I will fix it later and rebase -i before pushing.
You can use custom pre-commit in your own workflow, but forcing all developer to have the same pre-commit is a bad idea.
Amen. I also need to be able to commit WIP quickly if i need to urgently checkout master, or push my code because my laptop battery is about to die and i dont want it to have the only copy of my work.
There are ways to skip the hooks.