[Development] clang-format

Svenn-Arne Dragly svenn-arne.dragly at qt.io
Mon Jul 2 12:56:02 CEST 2018

On 06/20/2018 01:01 PM, Tor Arne Vestbø wrote:
> Good point, I was imagining it used only to verify style, not to auto-format. Still, starting out with a few non-controversial rules would be a good thing.

I agree. For instance, it is clear from the patch discussion[1] that 
line length/column count is controversial. I think it would be best to 
set this to 0 for now to be able to move forward and get the benefits of 
clang-format for all the other things that we do agree on. Setting it to 
0 means that clang-format will respect your decisions about line length 
unless you contradict other rules.

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.


[1] https://codereview.qt-project.org/#/c/233051/

More information about the Development mailing list