Instant StyleCop Code Analysis How-to Review

Instant StyleCop Code Analysis How-to

In the past days I’ve been reading Instant StyleCop Code Analysis How-to. Having interest in static code analysis, I have always been interested in StyleCop and FxCop, Microsoft’s static analysis tools, so this came with great interest.

I must say it was an interesting read, although it covers some tools that I don’t use – Jenkins, Hudson and NAnt, to be precise. It is a short book, and easy to follow.

The first chapter shows how to install StyleCop and how to integrate it with the various Visual Studio editions still around, from 2008 to 2012 (still not 2013, of course).

Next, it goes on to talk about integrating with Resharper, the productivity tool we all love, so that it uses StyleCop’s rules besides its own. You must be aware that specific Resharper versions only work with appropriate StyleCop ones; you will find a compatibility matrix at StyleCop’s web site.

Then it moves on to explain how to integrate with MSBuild, the build engine used by Visual Studio. This will allow us to have compile time checks, which is definitely a good thing.

The next chapter talks about running StyleCop from the command line, which is also useful for automation/continuous integration scenarios.

NAnt is next, then Hudson and Jenkins (successor/fork of Hudson), which I honestly haven’t read because I don’t use them. I would sure welcome a chapter on Team City and Team Foundation Server, or even Team Foundation Service instead, but…

The book goes on to talk about how to customize document headers (comments), so as to prevent violations.

Following that, my favorite chapter, on creating custom rules. Granted, this chapter is identified as simple, but I would sure appreciate if it had gone a bit further.

The final chapter explains how we can integrate StyleCop with our own tools, by providing a working example of a real-time analysis tool for MonoDevelop. I’m not a MonoDevelop user myself, but the concepts are interesting.

All in one, it is an interesting and easy to read book, but don’t expect advanced contents! Smile

                             

No Comments

Add a Comment

As it will appear on the website

Not displayed

Your website