Set one reviewer as required out of a group for code review in VSTS

Code review or Peer code review is a well known practice in software development, where code written by one programmer is reviewed thoroughly by his peers. In some cases, it is reviewed by one’s seniors as well. When done correctly, peer reviews save time, streamlining the development process upfront and drastically reducing the amount of work required later of Quality Assurance teams. Reviews can also save money, particularly by catching the types of bugs that might slip undetected through testing, through production, and into the end-users.

When your source code repository is hosted in the VSTS or Visual Studio Team Services, you can choose to made the peer review mandatory by using build policies and also enforce use of pull requests:

Mandate peer review for master branch
Mandate peer review for master branch

However, you can also choose to auto add specific team members directly to each pull request by default in the lower section of the branch policies:

Include specific users automatically for peer review
Include specific users automatically for peer review

This helps to avoid confusion and saves time by not having to add each reviewer one at a time by the developer. However, you would need to add users one by one. So if you want to add approval of one person from a particular team, it cannot be done directly.

In such a case, we first need to define a VSTS group by going to Settings icon -> Project Settings -> Security -> Create Group:

Select create group to create a VSTS group
Select create group to create a VSTS group

Provide the name of the group and an optional description and then select ‘Create Group’:

Provide a name for the VSTS group and select create group
Provide a name for the VSTS group and select create group

After this, add the required team members to the newly created group.

Once done, go to branch policies and then select ‘Add automatic reviewers’ in the ‘Automatically add code reviewers’ section:

Click on automatic add reviewers
Click on automatic add reviewers

This will open a new pane. In the pane, search for the VSTS group name you just created, optionally specify path and then set Required:

Search for VSTS group, add and save configuration

You cannot still mandate approval of x members from group of y members though although it’d make complete sense. This functionality may come some later point in time.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

w

Connecting to %s