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:
- Separate the person from the issue
- 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.