David Grey's Blog

November 2008 - Posts

Laying on the Style!

The .NET development landscape is awash with some fantastic tools. Visual Studio itself includes a wide range of powerful tools but there are some great free and commercial third-party tools available, including some from Microsoft themselves. One I added to my toolchain some time ago is Microsoft's StyleCop, a source code analysis tool which helps enforce coding conventions. I have it enabled by default on every project I work on and I have found it very valuable in improving my own coding consistency. Like many of these tools it takes a bit of getting used to and gives you all sorts of grief when you first enable it, but once you get used to it and configure it to your way of working it just another unobtrusive, but powerful, part of the build process.

The only criticism I have of StyleCop is that it is very much a passive tool and doesn't give you any feedback until you force it to run. I have it enabled as part of the build process so it gives me feedback every time I compile. For years I have been a user and great fan of ReSharper and I love the dynamic assistance that gives me whilst I'm entering code. ReSharper supports third-party plugins but there has never really been a wealth of plugins for it.

Yesterday I was delighted to discover that Conchango have produced a StyleCop ReSharper plugin which causes ReSharper to dynamically apply StyleCop rules to your code as you type. As soon as you enable it you get little red wigglies (like the Word spellchecker) appearing under your code to warn you of StyleCop rule violations and because it is dynamic you can see and fix these before you even get as far as compiling the code. It's brilliant, I love it!!! In fact I would happily pay the licence fee for ReSharper just to be able to use this feature.

AgentJohnson is another neat little ReSharper plugin. I have to admit that I don't use many of it's feature but the context action which automatically adds explicit exception handlers for each exception that a method can throw is neat and definitely a time-saver.

del.ico.us del.ico.us | Digg It Digg It | Technorati Technorati | StumbleUpon StumbleUpon | Furl Furl | reddit reddit