views:

99

answers:

2

I'm looking for a Visual Studio 2008 add-in or macro that will examine all of the .cs files and report back on "code comment coverage". Our company's standard is that all C# classes, methods, and properties are code commented. I've got a large solution, and going through the files by hand wastes a lot of time. If I had a report that told me exactly which files have code comments and which ones don't, I could examine just those files.

I don't mind writing some code to accomplish this, but I don't want to reinvent the wheel. Is there an add-in or macro that does this? Failing that, is there a way to use reflection or the System.CodeDom namespace to check a class for code comments? If I could just get my classes loaded into an object model, I could probably get the rest of the way there.

+5  A: 

StyleCop checks for XML documentation on classes and class members.

dtb
The bulk of my build output at the moment is StyleCop warnings. Good news/bad news I suppose :-).
DaveE
Thanks, dtb. This solves my immediate need. Nevertheless, I think I'll look into creating a green light/red light/yellow light code comment coverage VS add-in.
virsum
+3  A: 

Just enable the XML documentation output in the project build settings, then enable "all warnings as errors". You will now get errors for any undocumented classes and members that are not private or internal.

The Ghost Doc extension for Visual Studio is great to reduce typing effort here, and it's free.

Sandcastle Help File Builder is the easiest way to channel all that documentation effort into nice looking HTML, CHM or HxS files.

One last cool thing: it's possible to reference code regions that will be included as examples in your documentation . Recycle those unit tests as documentation and make sure the samples are correct: two birds with one stone! :-)

Wim Coenen