Tuesday, June 26, 2007

Automated code formatting tools

I love automated code formatting tools. Anything that will help clean the layout of code, especially code that I've inherited, is a major productivity booster.

I've been a bit of an evangelist for ReSharper in every development team I've been a member of. If the only thing ReSharper provided was code formatting I would still recommend it. It provides a great deal more which I'll cover some other time. ReSharper has granular enough code-style rules tools that should satisfy almost any possible team standard for code layout. The rules can also be imported/exported which is a time saver when you work on several machines or in a team. ReSharper is one of the few tools I've bought out of my own pocket and will be happily upgrading my 1.x license to the new 3.0 version very soon.

A classic free tool is GhostDoc. It doesn't reformat your code, but it will clean up and generate the xml documentation for methods, constructors and properties. It's very handy when you are maintaining code that doesn't have any xml comments to select "Document This" from inside the method and have the template filled out for you.

A new tool that seems very promising is Regionerate. It will automatically organize your C# class properties, fields, constructors, events and methods into neat regions with nice labels that contain a count of the number of items in that region. Very slick.

Submit this story to DotNetKicks


Ilya Ryzhenkov said...

Interesting, though, ReSharper 3.0 provides most of the Regionerate's features out of the box and more... Learn Type Member Layout templates and automatic member layouting on reformat :)

Anonymous said...

Regionerate looks good, but the default layout is ass. It also won't nuke current regions, so you can't use it to fix bad region layouts. With a little work it'll be a nifty little tool.