i think code conventions (members order, code formatting) quite important. we use checkstyle but never the less there is often code in source control which is not structured as opposed. through this comparing and merging between source control is often a pain (you cannot really see the "real" semantic differences, when methods order and formatting are different). such inconsistencies in my opinion are often lead by error prone manual interaction (manually sorting members and reformatting code) before doing a commit.
to avoid manual interaction i want to use pre or post commit hooks which are changing java source files to be checked in. never the less i feel a bit uncomfortable with interfering into the source checkin-process. has anybody made experience (positive/negative) which such commit hooks?
You didn't mention which VCS you're using - as far as I could tell, Subversion doesn't support this. CVS does, and it has been used in a number of open-source C/C++ code archives I've run across.
An IDE is no substitute for an Intelligent Developer.
Joined: Dec 29, 2005
oh, yes sorry, forgot to mention. i do use subversion. it supports pre and post commit hooks. but as you said it seems that subversion does not support access to committed files in these hooks (what makes we wonder a bit, for this feature could be handy).
now i remember too that it was only possible with CVS (i did already some checks with CVS before we migrated to subversion).
regarding code-conventions, it is really annoying that eclipse does not offer a dialog similar to IntelliJ, where you get asked whether your code should be reformatted inside commit-dialog.
I highly recommend Jalopy. It's very flexible and does just about as good a job as any purely automated cleanup utility can.
While Eclipse may not volunteer to clean up before committing (at least without a custom plug-in), you can easily run formatting on an entire source tree. Just select the file(s) in the navigation pane and do a right-menu "Format".