I'll second (third) the vote for uncrustify over astyle. Astyle doesn't have enough options to take care of all style issues, with uncrustify you can configure everything. Also check out clang-format - it only supports 3 styles (last I checked), but if one of them fit it might be easiest.
What works well for us is a custom script that ties into our version control, and code review tool. Since everyone is using this script to upload code reviews they get for free uncrustify run on changed files, and cppcheck (you are a fool not to use this as a minimum requirements things in my opinion) is also run on all code. This script is of course tied very closely to our development process and servers and so it isn't worth sharing. However it is easy to write something similar for your processes, and seems like a better course of action. Once a file is uncrustifed it doesn't need to be checked on everyone's build again. You just need to ensure the tool is run before the code reaches version control. On the same lines most source control systems allow you to write a pre checkin hook. While it is possible to do the work in cmake, I don't think it is the right approach. -----Original Message----- From: CMake [mailto:cmake-boun...@cmake.org] On Behalf Of Paul Smith Sent: Friday, January 31, 2014 7:12 AM To: Alan W. Irwin Cc: CMake ML Subject: Re: [CMake] AStyle or similar code beautifier 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. -- Powered by www.kitware.com Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Kitware offers various services to support the CMake community. For more information on each offering, please visit: CMake Support: http://cmake.org/cmake/help/support.html CMake Consulting: http://cmake.org/cmake/help/consulting.html CMake Training Courses: http://cmake.org/cmake/help/training.html Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Follow this link to subscribe/unsubscribe: http://www.cmake.org/mailman/listinfo/cmake -- Powered by www.kitware.com Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Kitware offers various services to support the CMake community. For more information on each offering, please visit: CMake Support: http://cmake.org/cmake/help/support.html CMake Consulting: http://cmake.org/cmake/help/consulting.html CMake Training Courses: http://cmake.org/cmake/help/training.html Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Follow this link to subscribe/unsubscribe: http://www.cmake.org/mailman/listinfo/cmake