📎 Webclip
The Code Review Guide
Code review is presented as a normal practice in tech, where a reviewer checks a PR or MR, gives feedback, and approves it when it is ready. The article frames review as a way to learn from others, not as a personal attack, and asks reviewers to look at both readability and functionality.
Reading notes#
- Read the PR caption first so you understand its purpose before looking at the code.
- Check the modified files to see whether they match what the PR is supposed to change.
- Review the code with two questions in mind: how it could be improved and what could go wrong.
- For readability, look for typos in names and comments, clear class and function names, descriptive comments, consistency with the rest of the repository, no print statements, fewer unnecessary nested statements, and early returns when possible.
- For functionality, check whether the flow makes sense, whether there are unnecessary validations or loops, whether methods and classes keep single responsibility, whether the code is prone to failures, and whether tests match the impact of the change.
- Do not delete or change tests without a reason, and ask why if a test seems to have changed its purpose.
- If you do not know the language of the code, start with a superficial review, ask other reviewers who know it, look for patterns in the repository, and ask questions when something is unclear.
- Do not follow best practices blindly; think first about the value the code adds and how it will affect the developer who maintains it later.
