« Waltzing with Bears: Part Deux | Main | The Puritan's Olympics »

August 26, 2004

It's the little things...

I've been bitching to my team lead lately.

A lot.

About Checkstyle.

Specifically, about our project's insistence on the checkstyle rule that insists imports are optimized. In other words, no imports of unused classes should be used.

The problems I have with this rule are thus:

  1. To my knowledge, there is no downside from having unused imports in your classes from a performance perspective

  2. The entire development team has IntelliJ configured to collapse the import block, so any seemingly horrendous unused imports are invisible to all and sundry unless the block is intentionally expanded again.

  3. Temporarily commenting code (for testing, investigation, etc.) requires re-optimizing imports and an even more painful re-importing process after the comments are removed. This is one of the things that Eclipse seems to do far better than IntelliJ, IMHO.

  4. It's all to easy to dash off to the loo/a meeting after having commenced a run of the test suite, only to return to find the suite only ran for 20 seconds because of unused imports being picked up by Checkstyle (this can be a huge source of time suckage and a vertiable PITA to boot).

  5. Murphy's law insists that the "tiny little refactoring to this class which couldn't possible change the state of the system so I'll just commit it to CVS from within IntelliJ without going to the command line" is bound the break the build (again, after about 20 seconds) because of some unused import that snuck into a class somewhere.

Nevertheless, my team lead has proven quite the immovable object in light of my complaints and I haven't been able to form a lynching mob within the development team to overthrow the evil despot, so I've had to suck it up in this respect.

And then someone informed me that the answer was staring me in the face...

Apparently, for quite some time now, the IntelliJ CVS commit dialog has provided the facility to automatically optimize imports on a commit (see diagram), which completely removes the chances of issue #5 (the biggest time/money waster) ever occurring.

intellij-cvs-commit-crop.gif

Upon discovering this fabulous "new" features I also found something that does seem to have been added to IntelliJ somewhere between 4.0.3 and 4.5 - a commit tag option. This feature allows the set of files changed during the commit to have their own unique tag. I've never really needed something like this previously, but our project seems to suffer from frequent needs to port sets of changes (i.e., stories and bug fixes) from one CVS branch to another. With this in mind, pre-emptively tagging each commit group with an identifying tag should greatly reduce the pain this porting overhead usually incurs.

So congrats to the Idea team for these couple of little features which have made my life a whole lot easier of late.

Posted by Andy Marks at August 26, 2004 01:52 PM

Comments

Another idea would be to run Checkstyle last... breaking the build because of Checkstyle is one thing, but there's no need to do it early.

I switched to putting Checkstyle at the end about a year ago. Also, of all the reasons for "breaking a build", Checkstyle failures are the least offensive. :)

With Eclipse, at least, you can get unused imports flagged as a warning (or even an error if you really want); I'm sure IDEA has a feature like that too, from memory.

(Like the commit tag bit, BTW: very reminiscent of ClearCase)

Posted by: Robert Watkins at August 26, 2004 08:30 PM

Ooooh, I _like_ that idea. Excellent suggestion Robert!

Posted by: Andy Marks at August 27, 2004 11:14 AM

Post a comment

Thanks for signing in, . Now you can comment. (sign out)

(If you haven't left a comment here before, you may need to be approved by the site owner before your comment will appear. Until then, it won't appear on the entry. Thanks for waiting.)


Remember me?