[CMake] AStyle or similar code beautifier

Paul Smith paul at mad-scientist.net
Fri Jan 31 08:11:58 EST 2014


On Fri, 2014-01-31 at 02:26 -0800, Alan W. Irwin wrote:
> And to answer the OP's question, I can highly recommend uncrustify for
> code styling

I agree with Alan.  We did a huge reformatting effort last year to
change a very large C++ codebase from a style based loosely on
Whitesmith to a more common style.  I started with AStyle which is a
solid program, but it has limited customization support.

Then I found uncrustify and was quite satisfied with it.  I sent a few
patches for minor fixes and they were well received.  The main issue
with uncrustify is that the documentation could be better: for some of
the more advanced settings it's very hard to understand exactly what
they control.

I had to do a bit of scripting around it since uncrustify didn't handle
all the whitespace conversion we wanted, but it worked great!

We didn't try to integrate it with the build system.  We just checked in
the configuration file and a script people could use if they wanted to
re-beautify their code.



More information about the CMake mailing list