Quality
Code review
Before code can be merged into the main
branch it needs to be reviewed. The best way to do this is via a merge request, this can be created in the GitLab UI.
This article describes the process of creating an MR and how to review code. Additionally, we’ll touch on the importance of code reviews and the benefits they bring to the project.
The review workflow
The code review process is illustrated in the diagram below. The process is as follows:
Why do we do code reviews?
- Knowledge sharing - educate less experienced developers by giving them advice on how to write code simpler and more effectively. Also, by reviewing and reading senior developers’ work we can learn how to implement components in a smarter way.
- Improving the readability and quality of the code - besides catching errors, CR examines code quality and forces us to avoid temporary “easy” solutions which may cause trouble in the future.
- Finding bugs - detection of bugs before our code goes into production, saving time for QA.
- Unifying the code writing style in the project - by using selected libraries, understandable nomenclature, and code structure we can create a pattern of common approach across services