3 ms·
> This usually happens to me if I commit, then run tests/linters... and FML, I didn't put a space after an equals sign This is why it's good to put the linting
by eterm 4y ago
> This usually happens to me if I commit, then run tests/linters... and FML, I didn't put a space after an equals sign
This is why it's good to put the linting in a git hook on commit or stage, so you literally can't commit without being formatted correctedly.
- neallindsay 4y agoI generally don't like putting linters on commit hooks. Commits are easy to change and I think people would be better off making more of them. If your lint ends up taking a long time it will discourage frequent commits. Also, unless you jump through a lot of hoops, linters generally run against what's on-disk instead of what's actually going into the commit. So checks that run at commit time discourage partial adds.
- cesnja 4y agoI dislike that approach as it slows down committing. Preferably linter should be integrated in the editor and there should be one in the CI pipeline, but the steps between writing code and pushing it into CI should be as quick and smooth as possible.