1

I like to know if it is possible, and if so how, to automatically request a code review while code is being checked into TFS.

So, for instance, I would like to have the request code review gui inside the pending changes gui, so that I can enter the name of the reviewer. When the code gets checked in, I would like Visual Studio to automatically request the code review for that check in. Is this possible?

I see a lot of questions (and answers) about how to require a code review before checking in, but I like to be able to check the code in and have it reviewed afterwards.

Stephen Kennedy
  • 20,585
  • 22
  • 95
  • 108
R. Beiboer
  • 712
  • 9
  • 21

2 Answers2

1

No, it's not the general workflow. You have already checked in, so what is the meaning of code review? That does't make sense.

Generally we need to create Code Review as much as possible to ensure that there are no obvious and potential problems before you check in your code. Because it may impact your build/release if you checked in the wrong code. You can use Visual Studio to ask someone else from your team to review it. Your request will show up in his team explorer, in the my work page.

Please see Get your code reviewed with Visual Studio for details.

Back to your question itself: It's not possible as no changes anymore, they have checked in and you can only compare the changesets to get the differences...

Andy Li-MSFT
  • 28,712
  • 2
  • 33
  • 55
  • 1
    Thank you for your reply. I am fully aware of the fact that reviewing code before checking in is the better workflow, but that is not an answer to my question. I also know how to request a code review after code has been checked in. My question is clear, I want to know if I can automatically request a review after is has been checked in by Visual Studio. The answer may be 'no' or it may be 'yes, you need to write an extention for that', or whatever else. I'll accept that. – R. Beiboer Oct 04 '18 at 11:44
  • I read that, but your argument was that it is because it is not the general workflow. And because you think I should not do it. But is it also a technical issue then? I mean, there is a difference in ‘you should not’ and ‘you cannot’. From your answer I read that I should not, not that I cannot. – R. Beiboer Oct 06 '18 at 06:50
  • 1
    @R.Beiboer I have explicitly pointed that in my answer : `Back to your question itself: It's not possible as no changes anymore, they have checked in and you can only compare the changesets to get the differences...` It's not possible... The answer is **no**... – Andy Li-MSFT Oct 08 '18 at 01:43
0

For planned releases out of the master branch, this perfectly makes sense. With TFS you can manually request a code review for one or more commits. The communication between the programmer and the reviewer is done through comments attached to commits. Here is how to proceed.

  1. In TFS, locate the branch that contains the code to review. Suppose it is the master branch of the project DevOps, as shown below. Select History, and click on the commit for which you want code review, say 12aa6235.

enter image description here

  1. This takes you to the detailed view of the commit, shown below. Click on the button on the right (highlighted in red) to add comments, and the comment edit window appears. You can request code review by typing the name of the reviewer prefixed with @. An email will be sent to that user with a link to the commit to be reviewed.

enter image description here

  1. When the reviewer clicks on the link in the email, he/she gets to the commit details page, where he/she can review. Communication may back and forth between the programmer and the reviewer, until code is accepted. The comments may be marked as being in the following different states.

enter image description here

RobertBaron
  • 2,817
  • 1
  • 12
  • 19
  • Thanks for you answer. My question though, was about how to _automatically_ create code review requests _after_ I checked in. I would like to enter the names of the reviewers _before_ I check in the code, and have Visual Studio _automatically_ create request _after_ it checked in the code. – R. Beiboer Aug 12 '19 at 06:41