TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Ask HN: Habits to avoid small mistakes in PRs

6 pointsby mr_00ff00over 1 year ago
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.<p>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

marshmellmanover 1 year ago
I always read through my entire diff in the PR preview (on GitHub, say) before submitting, and I find I catch many things this way (typos, small todos, small factoring improvements).<p>I get feedback that my PRs are very polished, and I think this habit has helped.
gtirloniover 1 year ago
Can these small misses get caught by tools? If so, litter your pre-commit with them. Maybe tests? Make a point to add those if they help catch these errors. You want to automate as much as possible so you get quick feedback before it becomes a PR.<p><a href="https:&#x2F;&#x2F;pre-commit.com&#x2F;hooks.html" rel="nofollow">https:&#x2F;&#x2F;pre-commit.com&#x2F;hooks.html</a>
jamil7over 1 year ago
As others have said, tools like linters and formatters would be the first step. Vale is a great one for catching spelling and grammar mistakes in comments and code. If you can&#x27;t get buy in, then just have the linter&#x2F;formatter config locally in your repo and not checked in, I&#x27;ve done this when freelancing before. You can also write yourself a checklist to go through before asking for a review, check for common mistakes you&#x27;ve made before that can&#x27;t be checked by a linter.<p>Sometimes I&#x27;ll also do a PR review of my own PR before asking for someone else to review it.
interbasedover 1 year ago
We use linters like flake8 and black on my team to make the diffs as clean as possible each time. This makes it easier to spot every change to the code, which makes it easier to spot errors.
schwartzworldover 1 year ago
Smaller PRs. You won&#x27;t miss mistakes if your changes are focused enough. No team I&#x27;ve ever been on has gotten mad about me breaking big changes into logical chunks whenever possible. You won&#x27;t miss things in a 4 file PR, but you will in a 25 file one.<p>My other personal rule is that if I feel the need to leave a comment explaining a decision, it&#x27;s probably the wrong one.
imronover 1 year ago
git add -p<p>Aside from being a super useful way to only stage some of your changes, it will also serve as a useful proofreading step.
UglyToadover 1 year ago
For sure as others have mentioned review it yourself in the web interface of whichever PR tool you use. (Generally after having a break first)<p>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.
helph67over 1 year ago
Normally the coder is the wrong person to test the program since we already know how it&#x27;s designed to work. Better to have someone with no prior knowledge of the program, with you observing. Often can indicate valuable tweaks to ensure users better understand how to use it.
nicbouover 1 year ago
Using a UI tool (Sublime Merge) instead of the command line helps me a lot. I review every line I commit this way now. I caught a lot of mistakes like this.<p>Linters and other tools also help. They should run as a pre-commit hook.
mindwokover 1 year ago
What kind of gotchas do you mean? any examples?