Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do i code review in tfs 2010?

I have 3 levels of users in my Team Foundation Server:

  1. Programmer: A code reviewer must review their code and they cannot check in their own code
  2. Professional Programmer: Their code doesn't need to be reviewed but a copy of their code should be automatically sent to a code reviewer
  3. Code Reviewer: Their code doesn't need to be reviewed and can be checked in directly

How can i implement this ?

like image 323
Manoochehr Avatar asked Jun 03 '12 09:06

Manoochehr


3 Answers

You can configure this mostly in TFS 2010, but there is no easy way to expose this from the UI. TFS 2012 and VS2012 will provide a much better UI for code review and it has an embedded process which will take you through he hoops.

If you want to configure Source control permissions as you've described, this is how it would work:

Programmers

Stick them in a TFS group or AD group and set their security so that they have Checkout and Lock permissions on their working branch, but no check-in permissions. When they're done with their work have them create a shelveset and then let them send an email to the reviewer with the shelveset name. The reviewer either returns the set with comments (either inline or through email or workitems) or he checks the code in on behalf of the programmer. because the programmers don't check in directly, you can't set up an automatic alert. You could alter the process template to include ready for review as a state for a task and have them transition the task (it's how the custom code review solutions tend to work).

Code Reviewer

Must at least have checkout, lock and check in rights. Stick them in a TFS group or an AD group and set the security accordingly. They can check in directly without the need to use shelvesets.

Professional Programmers

(I'd be careful with this term, it would make the other programmers sound unprofessional, I'd prefer senior or seasoned). Give them the same permissions as the Code Reviewer. Configure a TFS Alert which goes off when anyone in this group check something in. Send the alert to the Code Reviewers. They can then use the View History option to review the Changeset and send comments to the programmer in question. Use the TFS Power Tools to make configuring the alerts a lot easier (and more powerful).

If you want a more advanced solution, one that integrates into the TFS process template, then you can use one of these two open source solutions:

  • TeamReview
  • TFS Code Review Worlflow

Or look at their code (they're open source) to get an idea on how you could build something like this yourself. It's not going to be very easy though, and it would probably be useless once TFS 2012 comes out.

Also check out my presentation on the new features in TFS 2012 around code review (the ppt is in English, though the recording was done at a Dutch conference and thus in Dutch).

like image 26
jessehouwing Avatar answered Sep 28 '22 07:09

jessehouwing


One approach would be to use Branches and Alerts. For example...

  • Senior programmers would work directly on your "main" branch so they can check code into the live codebase.
  • Junior programmers would work on the "RequiresReview" branch, and then the code reviewers would review their check-ins and merge them into Main only when they are satisfied with the code.

TFS can send email Alerts for various events, so the code reviewers could just subscribe to the check-in events to know when code has been checked into Main (by a Senior programmer) or needs to be reviewed (has been checked into RequiresReview by a Junior Programmer)

The use of branches in this way would mean that you would have to merge in both directions (merge junior's checkins across to Main, and merge senior's checkins back into RequiresReview)

Another approach for Junior Programmers is to use ShelveSets instead of another branch. In this approach, Juniors would not check in their code, but would simply move it into a shelveset and then email the code reviewer to request that their shelveset is reviewed and checked in for them. This avoids the need for merging code from Main back into RequiresReview - the juniors would be working "on" the Main branch, but their checkins would be "gated" via the shelveset.

There are also some 3rd party tools you can purchase to manage code review processes for you in a much more integrated manner. A web search should help you find these sort of tools.

edit Please note that Visual Studio 2012 and 2013 now include integrated support for code reviews (essentially a proper user interface on top of the shelveset idea above), so upgrading from 2010 may be a better option than my suggested workarounds above.

like image 64
Jason Williams Avatar answered Sep 28 '22 06:09

Jason Williams


+1 Jason one of the good 3rd party is team review

http://teamreview.codeplex.com/

like image 34
Mohamed.Radwan -MVP Avatar answered Sep 28 '22 07:09

Mohamed.Radwan -MVP