[Development] clang-format

Shawn Rutledge Shawn.Rutledge at qt.io
Tue Jul 3 14:54:20 CEST 2018


> On 3 Jul 2018, at 14:12, Dominik Holland <dominik.holland at pelagicore.com> wrote:
> 
> 
>>> I thought we were going to run it as a fancy style bot, complaining if
>>> the code isn't per the format-file, but allowing us to ignore it if we
>>> feel the tailored code-formatting is better? Doesn't this mean the bot
>>> will complain a lot? 
>> If there is the need for some human intervention after a bot work, for
>> code formatting purposes, this would defeat any productivity goal.
> 
> Not necessarily. In one of our previous project we patched the Sanity
> Bot to run clang-format over the patch (only the patch, not the complete
> files) and provide the complains as bot comment.
> You could ignore it, or just copy and paste one command from the comment
> and it would fix all the issues in your patch (again only the patch, not
> the complete file).
> 
> Just pasting a single command doesn't sound like it would defeat any
> productivity goal to me.

I think the way to start is with a commit hook to run clang-format on each patch, in a way which will reformat only changed lines and ignore other lines in the file.  After we try that for a while we’ll see whether we like the results.



More information about the Development mailing list