Dirk Riehle's Industry and Research Publications

Code of conduct for code reviews

On Twitter, @arkwrite suggested that a code review should always say something nice and @chaos_monster commented that we need a code of conduct for code reviews. All of this makes sense to me, however, I suggest that we first have a general code of conduct of productive discussions (and most companies have something like it). The two main rules that come to my mind are:

  1. Separate the person from the issue
  2. Praise liberally, criticize specifically

Separating a person from the issue makes sure that you focus on the technical problem, not the person. Praising liberally is just good practice, showing how you value a person’s contribution. If you have to criticize for good reason, be specific so that the underlying technical issue is clear and provides a chance to respond.

Then, for code reviews, these additional rules might apply to a code of conduct (some taken from the Twitter thread linked to above):

  • Praise good unit tests and increased code coverage
  • Praise code written for readability i.e. with other people in mind
  • Mark non-blocking comments accordingly e.g. #nitpick
  • When criticizing, try to provide a better alternative

There were other suggestions that I’m not so sure about like using emojis or large quantities of exclamation marks. Certainly, emotions are important and can and should be communicated, but I’m not sure about the extent this applies to code reviews.

Newsletter subscription

Comments

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Navigation

Share the joy

Share on LinkedIn

Share by email

Share on X (Twitter)

Share on WhatsApp

Featured startups

QDAcity makes collaborative qualitative data analysis fun and easy.
EDITIVE makes document collaboration more effective.

Featured projects

Making free and open data easy, safe, and reliable to use
Bringing business intelligence to engineering management
Making open source in products easy, safe, and fun to use