Friday, April 28, 2006

 

Code Analysis Tools

I am a heavy user of Fxcop. It is a code analysis tool that works on DotNet assemblies. That means it works with multiple languages, since it is operating at the compiled code level.

It is quite picky, but it is possible and worthwhile getting zero errors.

However, there are some errors that it cannot catch. These relate to information that is lost when you compile. I've come across two examples.

First is imports (or using). It is very easy to get extraneous imports. The compiler removes them, and so FxCop cannot tell if they exist in the source code.

Secondly relates to comments. There are great applications like NDoc. NDoc takes code, strips out XML comments and turns into documentation. Javadoc is another example. However, it is possible to change the code, and not keep the documentation up to date. For example, there is no check the signature of the function matches the signature in the documentation. FxCop like tools cannot check, because the comments are thrown away.

Interestingly tools for Java like IntelliJ handle this. You need to search through the code and find out exactly which imports are used, and could they be simplified.

Should be part of any good IDE.

Comments: Post a Comment





<< Home

This page is powered by Blogger. Isn't yours?

Subscribe to Posts [Atom]