Monday, October 09, 2006

In a quest to improve code quality, I've been looking at a number of code analysis tools lately. FxCop was the lowest hanging fruit, since it ships with VS2005 - it's pretty good, and I tend to agree with the bulk of the warnings that it issued. I ran it against a fairly big project (~30 seperate assemblies), and it generated a good number of warnings, which took a few days to trawl through and get fixed. Most of them were trivial in nature, but there were a few good ones, including about 4 clear-cut bugs (this being code that has been live for over 2 years!). There's no doubt that the code is cleaner now than before the FxCop runs, so it's now turned on by default.

I'm now having a play with Spec# (SpecSharp), which at first glance looks to be extremely powerful. A few teething problems so far (mainly the VS2005 integration - the Spec# project templates just don't seem to work for me), but nothing too serious. I'm going to spend the next couple of days running it against some subsets of some existing projects and adding in the appropriate annotations to the code - it'll be interesting to see how much effort it entails with existing code, and what value it adds.

No comments: