Coffee and Space

Do something nice for your code reviewers

·

I don’t think about code reviews as a nuisance – the reviewers are doing me a favor! To make sure that they want to do me this favor over and over again, I try to make reviewing my code as easy as possible. That means I self-review my code before submitting it, make sure the tests pass and all code is written according to existing guidelines, and try to anticipate and answer questions that may come up beforehand.

Making reviews easy also means sticking around, being open for feedback and addressing comments on the submitted code. For reviewers, it’s hard to untangle follow-up fixes if all I leave is a big lump labeled Address PR feedback or a trail of Fix commits.

It’s a little more work, but I like creating a separate commit for every comment I write a fix for and then reply to the comment with a link to the diff. Platforms like GitHub and GitLab even turn commit SHAs into links, so I can just copy and paste the SHA from my terminal:

As a reviewer, this saves me a ton of work! As a code author, this helps me get more focused feedback on my pull requests. Everybody wins!