Ask HN: Habits to avoid small mistakes in PRs
I always seem to have small misses in my PRs, more than I think others have. I am trying to develop good habits so I write code and catch those small errors.
Typical I write it and try to pay attention to the style of the repo, than run the tests. But often, there are small gotchas at my work that I don’t notice.
10 comments
[ 5.0 ms ] story [ 36.5 ms ] threadhttps://pre-commit.com/hooks.html
Sometimes I'll also do a PR review of my own PR before asking for someone else to review it.
Linters and other tools also help. They should run as a pre-commit hook.
I get feedback that my PRs are very polished, and I think this habit has helped.
My other personal rule is that if I feel the need to leave a comment explaining a decision, it's probably the wrong one.
Aside from being a super useful way to only stage some of your changes, it will also serve as a useful proofreading step.
This is something of a superpower for catching things before review and in my experience makes the actual third party review pointless 95% of the time.