Code Review Practice
Reviews and Review Template support only users of the professional edition or higher.
Background
Code review refers to the process in which developers assign other personnel to read and review the code after designing, compiling, and debugging the code. The purpose of code review is to find standardization and correctness problems about the format, logic, and syntax in the code, thus ensuring the quality of the code. The cost of finding code problems in the code review phase is the lowest. Therefore, strict and careful code review is necessary to improve code quality. To help you review code more efficiently and quickly, you can add a review template in CodeArts Repo as required.
Prerequisites
- A project is available. If no project is available, create one first.
- If you purchase a CodeArts service package, you need to create a project in CodeArts Req.
- If you purchase a CodeArts Repo service package, you need to create a Scrum or an IPD project when creating a repository.
- A repository is available. If no repository is available, create one first.
Procedure
Before code review, the administrator needs to perform the following management settings:
This document describes how to set a review, review template, and review notification, and create and resolve a review or comment. The procedure is as follows:
Review Settings
The review setting is used to standardize the review and configure the review template. The setting takes effect only for the configured repository. Only the repository administrator and owner can view the page and have the setting permission.
- Go to the CodeArts homepage and click the target project name to access the project.
- Choose Code > Repo.
- Go to the repository details page and choose Settings > Policy Settings > Reviews. The Reviews page is displayed.
- Select Enable comment types and modules as required.
- Configure review types.
- Enable preset comment types
If you select Enable preset comment types, you can directly use the preset review comment categories.
- Customize category
You can customize the review comment category. Enter a type name, for example, code specification problem, and press Enter to save the settings.
The name can contain a maximum of 200 characters. A maximum of 20 names can be created.
- Enable preset comment types
- Enter a category name in the text box under Comment Modules.
The name can contain a maximum of 200 characters. A maximum of 20 names can be created.
- Select Mandatory fields to Verify for Comment Creation/Editing as required.
- Click Submits.
Review Template Settings
To configure comment templates, you can choose
on the repository details page. You can create, edit, and delete a review template, and customize template information such as Severity, Assigned to, Comment category, Comment module, and Description. When adding a review, you can select a review template. The template content will be automatically applied to the merge request or the code file to be reviewed. The settings take effect only for the repository configured. Only the repository administrator and owner can view the page and have the setting permission.
Parameter |
Description |
---|---|
Template name |
Mandatory. Name of the template to be created. For example, the code review template. |
Set as default |
Optional. If this parameter is selected, this template is used by default during reviewing. |
Severity |
Optional. Classified into the following types based on problem severity: Fatal, Major, Minor, and Suggestion. For example, set the value of Severity to Minor. |
Assigned to |
Optional.
For example, assign the review to the MR creator. |
Comment category |
This parameter is optional and is disabled by default. You need to select Enable comment types and modules first and configure the review types. For details, see Review Settings. |
Comment Modules |
This parameter is optional and is disabled by default. You need to select Enable review comment categories and modules first and configure the review modules. For details, see Review Settings. |
Description |
Optional. Enter the description of the template. The description can be previewed. For example, the code format is incorrect. |
Set Review Comment Notification
To set notifications, choose Settings > General Settings > Notifications on the repository details page.
- Comment: You can manually set to send an email notification to the MR creator.
- Resolve Comment: You can manually set to send an email notification to the MR creator.
Create a review or comment
You can add a review for a file on the Files and Commits submenus of the Code tab page, or on the Files Changed submenu of the Merge Requests tab page.
You can add comments for a merge request on Comments of the Merge Requests details page, or add comments for a commit on Commits submenu of the Code tab page.
The reviews added on the Files and Commits submenus of the Code tab page can be viewed on the Reviews for commit of the Reviews tab page.
The reviews added on the the Files Changed submenu of the Merge Requests tab page and the comments added on Comments of the Merge Requests details page can be viewed on the Reviews for MR of the Reviews tab page.
- Click Code > Files to create a review.
Click the target file on the Files tab page, click the icon in the code line, enter a review in the text box, and set a value for Severity and Assigned to. For example, set Severity to Minor and Assigned to to MR Creator, and select values for Comment type and Comment module from the drop-down list box, and click OK.
Figure 3 Create a review
- Click Code > Commits to create a review.
Click the target file on the Commits tab page, click the icon in the code line, enter a review in the text box, and set a value for Severity and Assigned to. For example, set Severity to Minor and Assigned to to MR Creator, and select values for Comment type and Comment module from the drop-down list box, and click OK.
Figure 4 Create a review
- Click Merge Requests > Files Changed to create a review.
Go to the Files Changed submenu, click the icon in the code line, enter a review in the text box, and set a value for Severity and Assigned to. For example, set Severity to Minor and Assigned to to MR Creator, and select values for Comment type and Comment module from the drop-down list box, and click OK.Figure 5 Create a review
- Click Merge Requests > details to create a comment.
Click target MR on the Merge Requests page. The merge request details page is displayed. Click Comments, enter a comment, and click OK.
- On the Commits page, click a commit to switch to the Comments page. Then you can create a comment.
Figure 6 Creating a comment
Resolve a review or comment
On the Reviews tab page, you can view Reviews for MR and Reviews for commit.
- After modifying the code file based on the reviews on the Reviews for commit, contact the committer for review. After the code file is approved, change the status to .
- After modifying the code file in the merge request based on the reviews or comments on the Reviews for MR, contact the committer to review the code file. After the code file is approved, change the status to .
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot