The idea for this VS Team System version control checkin policy came up in the week before Christmas when I was pointed to one of the shortcomings of TFSCCPolicy, namely that it would flag commented-out methods as missing code comments. That triggered me looking at the source code and I saw that it was using regular expressions.
Why use RegEx when you can use a full-blown parser engine with a DOM? Well, that's what I thought and therefore got in touch with Daniel, technical lead of SharpDevelop. We discussed two potential ways: either going to the metal using NRefactory alone, or go it easy using the DOM and visitors. He even supplied me with a few lines of code to get started - of course for the latter option because I am a lazy coder.
So I set out yesterday to write that checkin policy. To make it really useful, I set up a library project which would contain all the logic, a unit test project for it, plus the actual policy project. The advantage? Well, the logic library can be reused in an MSBuild task, the idea is as follows: calculate the "comment coverage" just like you can do with code coverage and unit testing. (Sorry, but this isn't part of the package just yet)
Given that plan, I of course got around to the policy project as the last one today. When I was pretty much done, I set out to test it for the first time inside VSTS - whoa, what a surprise. It balked almost immediately. You can read my quest for enlightenment here, the main takeaway: don't outsmart yourself when you create a checkin policy which consists of multiple assemblies that don't live in the GAC.
That way I at least got around to deploy my first project using ILMerge. There is only one downside to using ILMerge - the merged assemblies don't retain their version numbers, which can be seen in this screenshot of the configuration dialog (NRefactory should be 2.1):
Aside from this minor glitch, the checkin policy is working fine. What can it do / what can't it do at the moment:
Other than that I would love to get feedback from you on this initial version! Simply post feedback on this blog entry.
Finally, the source code (BSD-licensed by the way) and the binaries:
CCCP10_20061227.zip (964.34 KB)
If you are interested in using it only, then please go to the Drop directory. For those interested in the code: start with the solution file in the Source folder (and then go to Setup).
Updates to the code / checkin policy will be linked to at the end of this post, so feel free to bookmark this blog post for your reference on CCCP.