This topic explains how reviewers use Code Review to examine authors’ code, then either accept it or request additional changes.
Sections include:
Typical Workflow
Reviewers use Code Review as follows:
- Import or refresh tasks in the Quality Tasks view.
- Open one of the source files that you want to review by double-clicking the To Review node for the revision or code review issue you want to review.
- This opens the selected file revision in the Compare panel. The author’s revisions are displayed on the left side of the Compare panel. The previous revision of that file is displayed on the right. Code Review automatically compares those two revisions and highlights the recent changes. The indicators in the right gutter indicate how many changes were made to the selected file and allow to easily navigate from one change to another.
Note that the following icon indicates a revision that needs to be reviewed:
The following icon indicates a code review issue that has already been entered:Tip
The following keyboard shortcuts help you navigate within the Compare panel
- Ctrl + L: Opens the Goto Line dialog.
- Ctrl + F: Opens the Find Text dialog.
- Ctrl + T: Displays/hides line numbers
- Tab/Shift+Tab: Jumps to the next/previous change
Visual Studio "Global" key mappings can override/block these shortcuts.
Additionally, you can use the shortcut menus (accessible by right-clicking in the Compare panel) and toolbar buttons to help you navigate through the changes and to add new issues to specific lines of code.
- This opens the selected file revision in the Compare panel. The author’s revisions are displayed on the left side of the Compare panel. The previous revision of that file is displayed on the right. Code Review automatically compares those two revisions and highlights the recent changes. The indicators in the right gutter indicate how many changes were made to the selected file and allow to easily navigate from one change to another.
- Examine the revision.
- If you have not already done so, choose Parasoft> Show View> Code Review Issue to open the Code Review Issue view.
- For each new issue you want to add:
Specify the related code in one of the following ways:
To add a comment for this... Do this... A specific line of code 1) Right-click that line of code in the Compare panel.2) Choose Add Code Review Issue from the shortcut menu.3) Add your comment.Code Review automatically adds the file path to your comments.One or more general issues 1) Right-click the related To Review task node(s).2) Choose Add General Issue.3) Add your comment.You can select multiple To Review task nodes if they have the same session tag, task name or comment, and owner and reviewers. A general issue that is created for files from the same project will also have this project set. A general issue that is created for files from the same package will also have this package set. This issue will have the same session tag, task name and reviewer configuration as set in the original selection.A group of files (not tied to any specific issue) 1) Right-click the appropriate code review tree item.2) Choose Add General Thread.3) Add your comment.- Choose the category that best describes your issue.
- Indicate the severity of the issue you are raising.
- Enter your comment.
- For each existing code review issue you want to respond to, review the changes and enter your comment in the Add New Comment to Current Issue box
- Indicate whether additional author tasks are required to address the current issue:
- If the author needs to make more changes to address the issue you entered or commented on, click To Fix.
Once the issue is committed, this request for modification will be assigned to the author. If you want to indicate that a previously-entered issue has been resolved, click Accept.
This indicates that no additional action is needed for the current issue. If your team is following the default workflow policy, the issue will be considered "closed" after this action is committed. Otherwise, it will be sent to the author, who can then close the revision
- If the author needs to make more changes to address the issue you entered or commented on, click To Fix.
- Submit your comments on this issue by clicking the Commit Review button in the top corner of the Code Review Issue view.
- If this is your first time reviewing this revision, the revision will remain in the review tree until you mark it as accepted or done (as described in the following step). This allows you to continue reviewing the file and enter additional issues as needed. This applies to review tasks marked with the following icon:
- If you are responding to a specific previously-entered code review issue, the related code review task will then be removed from the review tree or have its status changed to waiting. This applies to committing review tasks marked with the following icon:
- If this is your first time reviewing this revision, the revision will remain in the review tree until you mark it as accepted or done (as described in the following step). This allows you to continue reviewing the file and enter additional issues as needed. This applies to review tasks marked with the following icon:
- When you have completed reviewing that file (i.e., you do not want to add any more issues for it and want it removed from your code review tree), right-click that node, then choose Mark as Accepted or Mark as Done (the available command depends upon your configuration—see below for details).
Workflow Diagrams
The following diagrams illustrate the various workflows available.
For more details, see Workflow Overview.
Rejecting a Review (Pre-Commit Only)
If you want to reject a review (e.g., if you want the code for the submitted change to be reverted to its original state), right-click the appropriate item(s) in the code review tree, then choose Reject from the shortcut menu.
Adding or Changing Assigned Reviewers
If you want to add another reviewer (e.g., for a second opinion), right-click the appropriate item(s) in the code review tree, choose Add Reviewer from the shortcut menu.
If you want to reassign the review to another reviewer, right-click the appropriate item(s) in the code review tree, then choose Reassign from the shortcut menu.