Tuesday, March 03, 2009

Hiding your privates from StyleCop

I like StyleCop but I didn’t like the fact it produced warnings on private fields and methods.  I was wrong. Not wrong in that I didn’t like warnings on privates, but wrong that I thought there was no way to tell it to stop it.

Apparently there is.  Jason Allor kindly left a comment saying that it can be configured through the StyleCop settings dialog in Visual Studio.

I took a look and initially didn’t find it.  I didn’t find it because I assumed there’d be different rules for public and private entities.  But there’s not, you can decide at the rule type level:

sshot-1

It’d be nice to have separate rules for public and private.  Currently, I’ve turned off all Documentation rules because I don’t like being warned that I haven’t commented private methods.  However, I’d still like it to give me all the other great warnings if I do decide to comment a particular private method.

No comments: