All merge requests made to SKAO repositories require a code review. Code reviews are checks that are carried out on the content of a merge request by another SKAO developer. Reviews are carried out by one or more people to give impartial feedback on improvements to the content. The main advantages of Code Reviews are:
Ensuring consistency in design and implementation
Optimising code for better performance
Encouraging collaboration and sharing new techniques
Monitoring project quality requirements
Enhancing maintainability of the code
Code reviews happen at multiple stages of the development process and it is beneficial to have reviews throughout the development process. This allows developers to add improvements on the go so they can avoid large changes at the end of their assignment. It is sometimes beneficial to perform code reviews whilst pair programming.
Duty of the Reviewer
The duty of the reviewer is to:
Ensure best practices in coding standards are being upheld.
Improve test coverage.
Identify typos or gramatical errors.
Identify incorrect naming conventions.
Suggest improvements to the code e.g. more suitable methods available.
Reviewing in Gitlab
Gitlab is the tool we use to perform code reviews. The review is completed under the merge request section of the repository being changed. The developer will usually request a review and link the merge request URL, but all open merge requests can also be viewed in Gitlab under “Review Requests”.
On the Merge Request page, select “Changes” tab.
Comment on each file changed as required
Comment on specific lines by selecting the line and clicking the speech bubble. You can drag to select multiple lines.
In the text area, write your first comment, then select “Start a review” below your comment.
Continue adding comments to lines of code. After each comment, select Add to review. Comments made as part of a review are visible only to you until you submit your review.
When your review is complete, you can submit the review. Your comments are now visible, and any quick actions included in your comments are performed.