Code formatting tools

brikis98

Diamond Member
Jul 5, 2005
7,253
8
0
The code base at my company - which primarily consists of code in Java, Velocity, JS and CSS - is a bit "messy". It has been written by many different people, using many different editors/IDE's and unfortunately, many different coding conventions. The result is that it can sometimes be really hard to read through the code as you deal with tabs vs spaces, curly brace position, variable naming and more.

In the next month, we will be moving the code base from CVS to Subversion and I thought this might be a good opportunity to introduce some process to standardize the code. Therefore, I'm looking for some kind of tools that can automatically format (or at least check the format) of our code. For example, Eclipse has a built in code formatter for Java that does a great job of handling white space, tabs, variable declarations, curly braces, etc. I'm looking for something similar that can be run automatically, supports Velocity, JS and CSS as well as Java and can even be set-up as a commit hook (automatically formatting code people check in or alternatively throwing an error if you try to check in unformatted code).

Any suggestions?