Share via


Microsoft Source Analysis releases to web

Six months ago, the developers on MSBuild began to use an internal tool then called "StyleCop" in order to clean up our source code going forward. Think of it as a little like "FXCop" for your C# style. It flags as build warnings all kinds of deviations from a set of fairly strict style rules. We excluded all our existing source code files from inspection, since they generated thousands of warnings, and used it for all new source files, and for heavily rewritten old code, and required every check-in to be clean.

For a few days, it was frustrating, mainly because you have to accept its rules over your own ingrained conventions. I don't like some of them. Frankly however many of these conventions are important only for consistency, and not intrinsically better or worse than any others.

After that first week, we were surprised to find that once we got used to the rules, it was little or no effort to avoid the warnings, and the readability and consistency of our source code has improved considerably. I thought I would have to push the team to use it, but they picked it up enthusiastically, and one of the developers even enabled it on all our unit test code as well. There's no more "interesting" use of tabs, or personalized curly placement, and code reviews can focus entirely on the content of the change. As others joined our team, they picked it up easily too.

Well, StyleCop has just been released as "Microsoft Source Analysis". It's a free download from here. I highly recommend it.

Dan

Comments

  • Anonymous
    May 23, 2008
    PingBack from http://noocyte.wordpress.com/2008/05/23/microsoft-source-analysis-releases-to-web/

  • Anonymous
    May 24, 2008
    Microsoft has published a great tool called Microsoft Source Analysis for C# , also known as StyleCop

  • Anonymous
    May 25, 2008
    Very handy! (A tool to be internalized in the CLR itself, in my view). I did have a curious issue today, with Source Analysis installed, OS Vista Home Premium, Studio2008 with a VB.net solution: pointer errors in combination with MSB3021 access denial errors. After uninstalling Source Analysis these disappeared. Any idea's?

  • Anonymous
    August 27, 2008
    Why do they always rename it something dumb?  StyleCop is great, or "Microsoft Code Style Auditor" would work, if they have to stick "microsoft" in there somewhere. But "Source Analysis"?  That kinda covers everything you can possibly analyze (static analysis, complexity, and so on), none of which it does.  Stupid, again. Thanks marketing, you are sooooo cool!  Nobody who had to use it would call it that, we would never have thought of it!