Tuesday, September 16, 2003

Checkstyle

I've always been a stickler for good programming style. It's one reason I often prefer Emacs over IDEs when writing code, especially when fixing existing code: Emac's formatting facilities are peerless. But there's more than one way to skin a cat, the saying goes.

Checkstyle is an automated style checker for Java including the hooks for an Ant task. By style, I don't just mean code formatting, I mean all the rest: javadoc comments, naming conventions, overlarge files, etc. Checkstyle handles these, producing reports suitable for further consumption.

Right now I'm changing some of my Collections extensions to use checkstyle in the build process. I'm updating build.xml to include a check target which checks the style of my Java sources, outputs problems to stdout so Emacs can parse and step through the errors, and writes an XML report to the docs directory for inclusion in the code metrics.

Spiffy.

No comments: