How to automate property/method headers when implementing an interface to satisfy StyleCop

253 views Asked by At

We use StyleCop to enforce documentation of our code.

StyleCop (out of the box) requires properties and methods to be documented. Theoretically, interfaces and their concretions can have different headers but in practice they're usually identical.

However, when an interface is implemented in the concretion, the header isn't copied over meaning that it has to be done manually. Is there a better way to automate this rather than having to copy over each one?

Obviously we could simply copy the interface code en masse but you lose a lot of the stub code so it isn't really a perfect solution.

2

There are 2 answers

0
Yohanes Nurcahyo On BEST ANSWER

You can use Ghostdoc, an addin for Visual Studio. After installed it, just right click to the properties, classes or methods and click "Document This".

If you have long properties or methods you can use Resharper to auto implement and copy the interface documentations.

0
Jerode On

I found that Atomineer Pro Documentation does this nicely. I believe the statement in the overview summarizes what you have asked.

Intelligent automatic duplication of existing documentation for overrides of interface and base class methods, throughout groups of overloaded methods, and across related parameters within a class to maximise documentation consistency with minimal effort.

There is a free trial if you want to take it for a test run and see if it meets your needs.

Comparison