I recently set up the static analysis in VS2010 for one of my hobby projects (and annotated all headers), and some of the suggestions it made helped track down a few annoying little bugs.
Seeing that, I've been curious as to whether there is a more extensive rule se开发者_Go百科t around or if such things are available anywhere (I'm using the "Microsoft All Rules" at the moment).
Are there additional rule sets that I could use; if so, where? (Google didn't find any easily)
If not (or even if there are), is there a better set to use? (my project works with graphics mostly)
I have written about 8, and may be writing more soon, if any of these interest you let me know.
Team policy reminder/enforcers
- warn on calls to forbidden methods
- GC.Collect GC.AddMemoryPressure
- Messagebox.Show
- warn if inheriting directly from Windows.Forms or Windows.Control
- warn if a control or form subclass constructor does not call InitializeComponent()
- warn if a control property is not set per team standards
- DialogBorderStyle must be fixed
- error if you do not override certain virtual properties (legacy from vs2005 designer bug)
- error if you have code that raises a NotImplementedException
- warn if you don't have hungarian notation to name controls
- warn if fields are not private
- ensure a project does not call a Config value or index that does not exist.
Also some of the code is found here
精彩评论