How to Perform a Code Review with Teamscale
Teamscale supports a simple file-based review process. This means that developers can mark a file as "reviewed", "work-in-progress" or "ready to review", and Teamscale will store and display the current state. Teamscale will also change the review status automatically if unreviewed file changes take place.
Enabling Code Review
On a technical level, the analysis group Code review comes with an assessment metric that assigns each file with an assessment corresponding to its current review status. As with every other assessment metric, you can also view treemaps and trends for the review status of your code base or parts of it.
To enable the Code Review feature, choose edit the analysis profile of your project under Projects → Analysis Profiles. In the final step of the edit process, you need to add the analysis group Code review.
Setting the Review Status for a File
To set the review status for a file, navigate to the file (e.g., from the Metrics perspective) and select a status from the Code Review Status dropdown menu:
You can assign one of
- In review (yellow),
- Needs rework (orange), and
- Done (green).
Besides the explicit manual status change, a change of the file's content will change its assessment to "red", which indicates that a review of the changes is due.
Reviews and Branches
Please note that in multi-branch projects, the review status will not be transferred between branches upon merge operations.
Changes to the review status will create an artificial Code Review Commit, which is integrated in the history of the Teamscale project and thus also visible in the activity perspective.
Setting a Review Baseline
The review feature also supports a baselining concept. To use it, you can define a review baseline date in the project options ( → Code Review).
As a consequence, files that were not changed after the baseline are assessed with a blue color for the code review assessment metric.
Manually Creating Findings
Teamscale supports adding review comments to code sections. These review comments are represented as regular findings, so all findings-related features (e.g., filtering) can be used for review findings.
To enable review findings, the analysis profile of the project has to contain the analysis group Code review (see below) with the Review Comment Findings option enabled.
Creating a Review Finding
To create a review finding, navigate to the file in the metrics perspective, select the code range by clicking on the start and end line and then selecting Create Review Finding from the menu.
You will be prompted to enter the comment which will be used as the finding message for the new review finding. A corresponding "commit" will be created in the commit history of the project with which the review finding will be associated.
Resolving a Review Finding
To indicate that a review finding has been resolved, navigate to the finding details view and click on the
Mark as Resolved button.