[Development] clang-format

Lars Knoll lars.knoll at qt.io
Mon Jul 2 16:49:06 CEST 2018


> On 2 Jul 2018, at 13:35, Tor Arne Vestbø <Tor.arne.Vestbo at qt.io> wrote:
> 
> 
>> On 2 Jul 2018, at 12:56, Svenn-Arne Dragly <svenn-arne.dragly at qt.io> wrote:
>> 
>> There are also many nice options set in the clang-format config found in Qt Creator's sources[2] which I think are interesting. For instance, "BinPackParameters: false" and "BinPackArguments: false" makes sure you to either put all arguments on one line or give if arguments will have one line each. This might be in the controversial category, but it is nice to enable while developing. It makes clang-format reflow the code consistently just by moving a single argument to a new line and running clang-format afterwards.
> 
> I oppose mandating this style, through clang-format or otherwise.

Having a common style that we start following is worth something. And yes, everybody will always find some details he won't like. So we won't get anywhere if everybody wants it exactly his way. 

I didn't know that creator had a clang-format file. I had a quick chat with some of the team here in Berlin, and the file is a result of discussions they had some time ago. They are apparently mostly happy with the style.

I would really like to go with one format file for all of Qt, so why not use the one from Creator?

And just to repeat: The reasons I want some automated formatting and checking is to remove manual work in the reviewing process. It'll help both the people reviewing as well as making it easier for new contributors to create patches that are consistent with our coding style. Longer term, I want to have as much checking as possible (e.g. compile checking and maybe even auto testing) happening before the manual code review is being done.

Cheers,
Lars



More information about the Development mailing list