I like StyleCop‘s static code analysis and rules enforcement. However, it is severely lacking in several key departments.
- Adding new rules isn’t officially supported and from what I hear pretty difficult.
- Automatic ‘fixing’ of trivial rules violations would be nice! Perhaps not with variable naming but with method ordering (static, etc) this would be a huge time saver.
- Microsofts ‘one-size-fits-all’ approach to StyleCop is kind of restrictive. I would like to have a custom set of rules for our in-house standards.
Is there such a commercial product out there?
alt text http://blogs.interakting.co.uk/images/blogs_interakting_co_uk/dominicz/WindowsLiveWriter/MicrosoftStyleCopSourcecodeanalysisforfo_D8EF/styleCopErrors_6.gif
Adding rules is, or is going to be, officially supported:
In terms of our ‘in-house’ style, I got pretty close by disabling a handful of StyleCop rules:
You can do this globally by modifying the Settings.StyleCop file in the installation directory, though I’ve taken the approach of putting one at the root of our source tree in each project.
The end effect is much what we want. There are a handful of ‘in-house’ choices that would be nice to flag, but even without them StyleCop is delivering a lot of value for us.