Mastering Code Review: A Guide for Reviewers and PR Creators
Tags: productivity, career, learning
Published: 2024-04-27 14:19:45

Code reviews are essential for code quality, team collaboration, and to make sure that best practices are followed in the development process. Guess no news so far, however, effective code reviews requires more than just looking for bugs or syntax errors. Let's take a look in the best practices for conducting code reviews from the perspective of the reviewer and the pull request creator.

## For Reviewers 🔎

1. **Be constructive**: Provide feedback in a constructive and respectful way. Focus on improving the code rather than criticizing the developer. Being polite is always good xP

2. **Understand the context**: Take the time to understand the purpose and requirements. This will help you provide more relevant feedback.

3. **Review the code, not the person**: Remember that code reviews are about improving the code, not attacking the developer. 

4. **Be specific**: Provide specific comments and suggestions. Avoid vague or general feedback that may confuse the developer (one of the most important, in my opinion).

5. **Prioritize issues**: Identify critical issues that need immediate attention and non-critical one that can be addressed in the future. This will help the developer focus on the most important.

6. **Offer alternatives**: Instead of just pointing out problems, suggest alternative solutions or improvements.

7. **Consider the bigger picture**: Think about the impact of the changes on the overall system. Consider scalability, maintainability, and performance aspects during the review.

8. **Remember of deadlines**: Review code promptly to avoid delaying the development process. If you need more time, communicate it to the pull request creator.

9. **Avoid "Pull Request Friendship"** : Do not approve a pull request just because the creator is a friend or because you have faith in their deliveries. Every pull request should be reviewed objectively, based on the quality of the code and its adherence to project standards and best practices. This ensures fairness and maintains the integrity of the codebase.

---

_Enjoying it? If so, don't forget to give a_ ❤️_ and follow me to keep updated. Then, I'll continue creating more content like this_

---

## For Pull Request Creators 💻

1. **Prepare your code**: Before submitting a pull request, make sure your code is clean, well-structured, and follows the project's coding conventions. This will make the review process smoother.

2. **Utilize repository features**: Assign the pull request to yourself, use a clear and descriptive title and apply labels. Maintaining an organized repository is straightforward, easier fot future filtering and searching, and fosters a healthy codebase to work with.

3. **Provide context**: Include a clear description of the changes made and the problem being solved. This will help reviewers understand the purpose of the code and also make easier to future investigations.

4. **Be open to feedback**: Be receptive to feedback and willing to make changes. Remember that code reviews are (should be) an opportunity to improve the quality of your code.

5. **Engage in discussions**: Respond to comments and questions from reviewers.

6. **Learn from the review**: Use the feedback received during the code review to improve your coding skills. Take the opportunity to learn from more experienced developers.

7. **Address all comments**: Address all comments and suggestions made by the reviewers. If you disagree with a comment, provide a clear explanation and discuss it with the reviewer.

8. **Test your changes**: Before marking the pull request as ready for merge, ensure that your changes have been thoroughly tested and do not introduce any regressions.

9. **Keep it concise and context-specific**: Concentrate on delivering within the context and avoid modifying files outside the scope. Smaller pull requests are easier to review and reduce the overall time for pull request approval.

10. **Be grateful**: Show appreciation to the reviewers for their time and effort in providing feedback. A simple thank you is enough and creates a positive code review culture. ❤️

> [Buy me a coffee](https://ko-fi.com/tjordao) ☕. Hope I have helped you somehow. 🤗

[See my other articles](https://frontend-pattern.vercel.app/articles) and [my open source project](https://github.com/tassioFront/frontend-pattern)