[cmake-developers] Code style auto-formatting
Daniel Pfeifer
daniel at pfeifer-mail.de
Tue Nov 17 16:29:29 EST 2015
On Tue, Nov 17, 2015 at 10:12 PM, Robert Dailey
<rcdailey.lists at gmail.com> wrote:
> On Tue, Nov 17, 2015 at 6:57 AM, Paul Smith <paul at mad-scientist.net> wrote:
>> On Tue, 2015-11-17 at 08:14 +0000, Stuermer, Michael SP/HZA-ZSEP wrote:
>>> In short, there is no fully automated style checking. If someone would
>>> come up with a tool & configuration I would love to use this. So far I
>>> tested astyle and the C++ edition of ReSharper (unfortunately quite
>>> expensive).
>>
>> We've used uncrustify with excellent results in the past, FWIW.
>>
>> It is a major hassle though. We did a complete code reformat with a
>> well-defined process, and then had all developers apply reformatting to
>> their personal branches using a particular set of steps to minimize the
>> insanity.
>>
>
> I'm willing to assist with a clang format file, I've worked with them
> in the past. This means contributions will likely come with multiple
> patch files, some containing only whitespace fixups per the clang
> format.
>
> How did you guys want to approach reformatting inconsistently
> formatted source files?
I would say: As a byproduct.
Adding a .clang-format file to CMake would be greatly appreciated. It
can be used to ensure that refactorings and new contributions follow
exactly the predefined style. However, changing existing code simply
because it does not match the style is something that should be
refused.
git-clang-format can fix the formatting of staged hunks without
changing the rest of the files.
-- Daniel
More information about the cmake-developers
mailing list