Re: [Development] clang-format

2019-10-14 Thread Frederik Gladhorn
Hi Mitch, thanks for trying! On mandag 14. oktober 2019 14:51:41 CEST Mitch Curtis wrote: > As a side note, I installed it on Ubuntu 18.04.3 with: > > sudo apt-get install clang-format > > but there was no git-clang-format binary, even though >

Re: [Development] clang-format

2019-10-14 Thread Mitch Curtis
> -Original Message- > From: Development On Behalf Of > Frederik Gladhorn > Sent: Monday, 14 October 2019 1:46 PM > To: development@qt-project.org > Subject: [Development] clang-format > > Hi, > > after just a bit over a year, we have a hint of progress

[Development] clang-format

2019-10-14 Thread Frederik Gladhorn
Hi, after just a bit over a year, we have a hint of progress on the state of using clang-format. If you use qt5.git, you'll get the git hook for it set up, to automatically run clang-format on the lines you changed. To benefit today, get the dev branch of qt5 and run init-repository -f

Re: [Development] clang-format

2018-07-03 Thread resurrection
Interesting discussion about using clang-format Qt wide. As someone who implemented something like that in a project (of smaller size than Qt, but not all that small) some points:   - clang-format virtually annihilates A LOT of manual work. It might not seem like much but I have measured it

Re: [Development] clang-format

2018-07-03 Thread Frederik Gladhorn
On onsdag 20. juni 2018 13.01.10 CEST Tor Arne Vestbø wrote: > On 20 Jun 2018, at 12:13, Lars Knoll wrote: > > > > > I can’t see how clang-format will make you jump through any sort of hoops. > > Creator already has a hook for doing it on file saving time afaik, > > git-clang-format will clean

Re: [Development] clang-format

2018-07-03 Thread Shawn Rutledge
> On 3 Jul 2018, at 14:12, Dominik Holland > 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

Re: [Development] clang-format

2018-07-03 Thread Dominik Holland
>> 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

Re: [Development] clang-format

2018-07-03 Thread Tor Arne Vestbø
On 3 Jul 2018, at 13:42, Lars Knoll wrote: > > To some extent it might introduce new ones, but the idea was to aim for a > format file that is very close to our existing rules. It seems the extent is wider than first outlined. And even if it’s very close to the existing rules, those rules

Re: [Development] clang-format

2018-07-03 Thread Lars Knoll
On 3 Jul 2018, at 12:13, Tor Arne Vestbø mailto:tor.arne.ves...@qt.io>> wrote: On 3 Jul 2018, at 10:26, Lars Knoll mailto:lars.kn...@qt.io>> wrote: On 2 Jul 2018, at 16:52, Tor Arne Vestbø mailto:tor.arne.ves...@qt.io>> wrote: On 2 Jul 2018, at 16:49, Lars Knoll

Re: [Development] clang-format

2018-07-03 Thread Philippe
> Really?? That sounds like a key feature, I’m surprised clang-format doesn’t > allow it to leave code untouched. As already mentionned, there is always the option to tag code sections: // clang-format off ... // clang-format on > I thought we were going to run it as a fancy style bot,

Re: [Development] clang-format

2018-07-03 Thread Svenn-Arne Dragly
On 07/03/2018 10:26 AM, Lars Knoll wrote: On 2 Jul 2018, at 16:52, Tor Arne Vestbø > wrote: > > > >> On 2 Jul 2018, at 16:49, Lars Knoll >> > wrote: >> >> >>> On 2 Jul 2018, at 13:35, Tor Arne Vestbø >>> >

Re: [Development] clang-format

2018-07-03 Thread Tor Arne Vestbø
> On 3 Jul 2018, at 10:26, Lars Knoll wrote: > >> On 2 Jul 2018, at 16:52, Tor Arne Vestbø wrote: >> >> >> >>> On 2 Jul 2018, at 16:49, Lars Knoll wrote: >>> >>> On 2 Jul 2018, at 13:35, Tor Arne Vestbø wrote: > On 2 Jul 2018, at 12:56, Svenn-Arne Dragly >

Re: [Development] clang-format

2018-07-03 Thread Lars Knoll
On 2 Jul 2018, at 16:52, Tor Arne Vestbø mailto:tor.arne.ves...@qt.io>> wrote: On 2 Jul 2018, at 16:49, Lars Knoll mailto:lars.kn...@qt.io>> wrote: On 2 Jul 2018, at 13:35, Tor Arne Vestbø mailto:tor.arne.ves...@qt.io>> wrote: On 2 Jul 2018, at 12:56, Svenn-Arne Dragly

Re: [Development] clang-format

2018-07-02 Thread Tor Arne Vestbø
> On 2 Jul 2018, at 16:49, Lars Knoll wrote: > > >> On 2 Jul 2018, at 13:35, Tor Arne Vestbø wrote: >> >> >>> On 2 Jul 2018, at 12:56, Svenn-Arne Dragly wrote: >>> >>> There are also many nice options set in the clang-format config found in Qt >>> Creator's sources[2] which I think are

Re: [Development] clang-format

2018-07-02 Thread Lars Knoll
> On 2 Jul 2018, at 13:35, Tor Arne Vestbø wrote: > > >> On 2 Jul 2018, at 12:56, Svenn-Arne Dragly 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"

Re: [Development] clang-format

2018-07-02 Thread Tor Arne Vestbø
> On 2 Jul 2018, at 12:56, Svenn-Arne Dragly 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

Re: [Development] clang-format

2018-07-02 Thread Svenn-Arne Dragly
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

Re: [Development] clang-format

2018-06-22 Thread Philippe
> It doesn't help me all that much to have > familiar formatting and naming in a translation > unit This is a good skill. But the idea is to help developers that don't have this skill. Philippe On Fri, 22 Jun 2018 19:47:14 +0300 Ville Voutilainen wrote: > On 22 June 2018 at 19:39, Scott Bloom

Re: [Development] clang-format

2018-06-22 Thread Scott Bloom
> I cant even get my developers to agree the emacs takes to many fingers, and > VI(m) is the only editor they need > > Let alone, where the brackets and spaces belong > > Let alone, if statements on the same line as the conditional > > The problem ive seen, is while you may LOVE the

Re: [Development] clang-format

2018-06-22 Thread Ville Voutilainen
On 22 June 2018 at 19:39, Scott Bloom wrote: > I cant even get my developers to agree the emacs takes to many fingers, and > VI(m) is the only editor they need > > Let alone, where the brackets and spaces belong > > Let alone, if statements on the same line as the conditional > > The

Re: [Development] clang-format

2018-06-22 Thread Scott Bloom
on the same line, you will never convince me...  -Original Message- From: Development On Behalf Of Philippe Sent: Friday, June 22, 2018 09:12 To: development@qt-project.org Subject: Re: [Development] clang-format > I usually come to the conclusion, code in the style you w

Re: [Development] clang-format

2018-06-22 Thread Philippe
me and effort > necessary to implement a format change that is being taken away from customer > oriented development. > > Scott > > -Original Message- > From: Development On > Behalf Of Thiago Macieira > Sent: Friday, June 22, 2018 08:26 > To: development@q

Re: [Development] clang-format

2018-06-22 Thread Thiago Macieira
On Friday, 22 June 2018 08:34:09 PDT Scott Bloom wrote: > But IMO, wholesale "format changes" have zero value to the customer, so any > pain associated with them, should be weighed against the time and effort > necessary to implement a format change that is being taken away from > customer

Re: [Development] clang-format

2018-06-22 Thread Thiago Macieira
On Friday, 22 June 2018 07:40:58 PDT Scott Bloom wrote: > In a series of wrapper scripts, essentially, everything checked in was > converted to the check in format. However each developer had their own > format . And on checkout, the code would be compare to it. > > On "Diff" analysis of two

Re: [Development] clang-format

2018-06-22 Thread Frederik Gladhorn
OK, so for now, my take-away from this thread is that we should simply create nice commit-hooks that help everyone along. As a next step we can also enhance the sanity bot with friendly messages. I ran clang-format a few times over different parts of the code-base and I agree that it sometimes

Re: [Development] clang-format

2018-06-21 Thread Thiago Macieira
On Thursday, 21 June 2018 16:56:00 PDT Ville Voutilainen wrote: > While I appreciate your git-fu, I must bat my eyelids if we consider that > a normal procedure for people wishing to submit patches. Not many people have over 100 pending patches for Qt. In fact, you can probably count them in the

Re: [Development] clang-format

2018-06-21 Thread Ville Voutilainen
On 22 June 2018 at 02:36, Olivier Goffart wrote: > On 2018-06-21 16:02, Thiago Macieira wrote: >> >> On Thursday, 21 June 2018 04:51:38 PDT Frederik Gladhorn wrote: >>> >>> checkout the change before we run clang-format >>> run clang-format on the changed files >>> push on top of the formatting

Re: [Development] clang-format

2018-06-21 Thread Olivier Goffart
On 2018-06-21 16:02, Thiago Macieira wrote: On Thursday, 21 June 2018 04:51:38 PDT Frederik Gladhorn wrote: checkout the change before we run clang-format run clang-format on the changed files push on top of the formatting change I'd appreciate such a script. As I said, I will dedicate no

Re: [Development] clang-format

2018-06-21 Thread Thiago Macieira
On Thursday, 21 June 2018 04:51:38 PDT Frederik Gladhorn wrote: > checkout the change before we run clang-format > run clang-format on the changed files > push on top of the formatting change I'd appreciate such a script. As I said, I will dedicate no more than 15 minutes total for rebasing

Re: [Development] clang-format

2018-06-21 Thread Frederik Gladhorn
On tirsdag 19. juni 2018 17.51.28 CEST Thiago Macieira wrote: > On Tuesday, 19 June 2018 02:34:09 PDT Lars Knoll wrote: > > Currently, we only merge from 5.11 to dev, so I hope this won’t be too > > bad. > > But we could of course also run the tool over both branches. > > I have right now 149

Re: [Development] clang-format

2018-06-20 Thread Jean-Michaël Celerier
> I never seen anything QtCreator had trouble with. really ? paste this in a .cpp and indent it : #define WHATEVER struct foo { WHATEVER public: explicit foo(); }; struct bar { public: explicit bar(); }; --- Jean-Michaël Celerier http://www.jcelerier.name On Wed, Jun 20,

Re: [Development] clang-format

2018-06-20 Thread Philippe
> When you line-break an expression, clang-format will indent it a >fixed amount from the beginning of the next line, > where QtCreator will try to find places to line up with from the line above, > including indenting from the > last paranthesis For instance: I don't use QtCreator, but

Re: [Development] clang-format

2018-06-20 Thread Eirik Aavitsland
On 20. juni 2018 13:23, Morten Sørvig wrote: On 19 Jun 2018, at 17:33, Allan Sandfeld Jensen wrote: Btw. Just for your information. I have attached a few random examples of what we can look forward too after running an auto-"beautifying" tool over our hand-formated Qt code. And these

Re: [Development] clang-format

2018-06-20 Thread Allan Sandfeld Jensen
On Mittwoch, 20. Juni 2018 14:09:20 CEST Ivan Donchevskii wrote: > One more thing about clang-format. > > It might be really nice if we use it as a default formatting tool in Qt > Creator. And I really want to experiment with it and see how clang-format > can replace the indenter that we

Re: [Development] clang-format

2018-06-20 Thread Ivan Donchevskii
for example with modern C++). BR, Ivan From: Development on behalf of Sérgio Martins via Development Sent: Wednesday, June 20, 2018 1:56 PM To: Frederik Gladhorn Cc: Development; development@qt-project.org Subject: Re: [Development] clang-format On 2018-06-18 10:04

Re: [Development] clang-format

2018-06-20 Thread Sérgio Martins via Development
On 2018-06-18 10:04, Frederik Gladhorn wrote: Hi all, as part of the closing ceremony of this year's Qt Contributors' Summit we agreed to start using clang-format, to have fewer discussions around coding style and rather focus on the actual code. I have not yet thought about all angles, how

Re: [Development] clang-format

2018-06-20 Thread Tor Arne Vestbø
On 20 Jun 2018, at 12:13, Lars Knoll wrote: > > I can’t see how clang-format will make you jump through any sort of hoops. > Creator already has a hook for doing it on file saving time afaik, > git-clang-format will clean up your change from the command line. Good point, I was imagining it

Re: [Development] clang-format

2018-06-20 Thread Lars Knoll
I can’t see how clang-format will make you jump through any sort of hoops. Creator already has a hook for doing it on file saving time afaik, git-clang-format will clean up your change from the command line. Lars > On 20 Jun 2018, at 11:52, Tor Arne Vestbø wrote: > > How about we also start

Re: [Development] clang-format

2018-06-20 Thread Tor Arne Vestbø
How about we also start with only one or two obvious rules that everyone agrees on? I don’t want Qt development to turn into Python PEP8 type rigid rules that makes you jump through a million hoops. If the latter is the goal here then I’m against enforcing clang-format, and it should be

Re: [Development] clang-format

2018-06-20 Thread André Pönitz
On Wed, Jun 20, 2018 at 06:30:26AM +, Lars Knoll wrote: > > > > On 19 Jun 2018, at 18:19, Ville Voutilainen > > wrote: > > > > On 19 June 2018 at 19:13, Philippe wrote: > >>> For the above reasons I'd lean towards not running it globally and > >>> just using it on new changes. > >> > >>

Re: [Development] clang-format

2018-06-20 Thread Kari Oikarinen
On 20.06.2018 09:30, Lars Knoll wrote: > > >> On 19 Jun 2018, at 18:19, Ville Voutilainen wrote: >> >> On 19 June 2018 at 19:13, Philippe wrote: For the above reasons I'd lean towards not running it globally and just using it on new changes. >>> >>> +1, based on my clang-format

Re: [Development] clang-format

2018-06-20 Thread Lars Knoll
> On 19 Jun 2018, at 18:19, Ville Voutilainen > wrote: > > On 19 June 2018 at 19:13, Philippe wrote: >>> For the above reasons I'd lean towards not running it globally and just >>> using it >>> on new changes. >> >> +1, based on my clang-format experience on a big application. >> >> BTW,

Re: [Development] clang-format

2018-06-19 Thread Christian Gagneraud
On 20 June 2018 at 03:33, Allan Sandfeld Jensen wrote: > Btw. Just for your information. > > I have attached a few random examples of what we can look forward too after > running an auto-"beautifying" tool over our hand-formated Qt code. And these > changes are NOT something we can configure out

Re: [Development] clang-format

2018-06-19 Thread Ville Voutilainen
On 19 June 2018 at 19:13, Philippe wrote: >> For the above reasons I'd lean towards not running it globally and just >> using it >> on new changes. > > +1, based on my clang-format experience on a big application. > > BTW, keep in mind that you can disable clang-format on code sections with: > >

Re: [Development] clang-format

2018-06-19 Thread Philippe
> For the above reasons I'd lean towards not running it globally and just using > it > on new changes. +1, based on my clang-format experience on a big application. BTW, keep in mind that you can disable clang-format on code sections with: // clang-format off // clang-format on Philippe On

Re: [Development] clang-format

2018-06-19 Thread Thiago Macieira
On Tuesday, 19 June 2018 02:34:09 PDT Lars Knoll wrote: > Currently, we only merge from 5.11 to dev, so I hope this won’t be too bad. > But we could of course also run the tool over both branches. I have right now 149 changes on top of qtbase's dev branch. For something that is ostensibly a

Re: [Development] clang-format

2018-06-19 Thread Thiago Macieira
On Monday, 18 June 2018 02:04:33 PDT Frederik Gladhorn wrote: > as part of the closing ceremony of this year's Qt Contributors' Summit we > agreed to start using clang-format, to have fewer discussions around coding > style and rather focus on the actual code. Are we going to review the resulting

Re: [Development] clang-format

2018-06-19 Thread Allan Sandfeld Jensen
Btw. Just for your information. I have attached a few random examples of what we can look forward too after running an auto-"beautifying" tool over our hand-formated Qt code. And these changes are NOT something we can configure out ouf of in clang-format, it is just cases where it can't do any

Re: [Development] clang-format

2018-06-19 Thread Liang Qi
> On 19 Jun 2018, at 09:58, Joerg Bornemann wrote: > >> * Which branch do you run it in? If an early one, there's many merges to do. >> If >> a late one, all the subsequent merges are tricky. > > Our commit policy suggests that the right branch would be dev. > You're right that the merges

Re: [Development] clang-format

2018-06-19 Thread Allan Sandfeld Jensen
On Montag, 18. Juni 2018 11:23:53 CEST Kari Oikarinen wrote: > On 18.06.2018 12:04, Frederik Gladhorn wrote: > > > Other parts sound good, so I'll just touch on the big question. > > > And then there is the big question when we run it once over the entire > > codebase. > > I'd hesitate to

Re: [Development] clang-format

2018-06-19 Thread Lars Knoll
> On 19 Jun 2018, at 09:58, Joerg Bornemann wrote: > > On 06/18/2018 11:23 AM, Kari Oikarinen wrote: > >> I'd hesitate to ever run it over the entire codebase. >> * It will ruin plain git blame, since so much will point to that particular >> commit. Yes, you can use `git blame -w` to avoid

Re: [Development] clang-format

2018-06-18 Thread Liang Qi
On Mon, 18 Jun 2018 at 11:23, Kari Oikarinen wrote: > On 18.06.2018 12:04, Frederik Gladhorn wrote: > > > Other parts sound good, so I'll just touch on the big question. > > > And then there is the big question when we run it once over the entire > > codebase. > > I'd hesitate to ever run it

Re: [Development] clang-format

2018-06-18 Thread Kari Oikarinen
On 18.06.2018 12:04, Frederik Gladhorn wrote: Other parts sound good, so I'll just touch on the big question. > And then there is the big question when we run it once over the entire > codebase. I'd hesitate to ever run it over the entire codebase. * It will ruin plain git blame, since so

[Development] clang-format

2018-06-18 Thread Frederik Gladhorn
Hi all, as part of the closing ceremony of this year's Qt Contributors' Summit we agreed to start using clang-format, to have fewer discussions around coding style and rather focus on the actual code. I have not yet thought about all angles, how to best implement this, here are some notes:

Re: [Development] clang-format config file.

2016-06-30 Thread Matthew Woehlke
On 2016-06-30 06:52, Olivier Goffart wrote: > [clang-format] follows the style closely, but there are some cases > that might not be following existing practices. The question is if we > want to try to fix clang-format to be able to cope with them, or > simply adapt the coding style to fit

Re: [Development] clang-format config file.

2016-06-30 Thread Olivier Goffart
On Donnerstag, 30. Juni 2016 14:26:34 CEST Lorenz Haas wrote: > Hi, > > > The style disabled any re-wraping of the comments, because the qdoc rules > > are not encoded in clang-format. So comments will not be touched. > > just for the record: clang-format can exclude specific comment types >

Re: [Development] clang-format config file.

2016-06-30 Thread Lorenz Haas
Hi, > The style disabled any re-wraping of the comments, because the qdoc rules are > not encoded in clang-format. So comments will not be touched. just for the record: clang-format can exclude specific comment types from re-wrapping. Thus if you/we do not mind a "either re-wrap all comments or

Re: [Development] clang-format config file.

2016-06-30 Thread Olivier Goffart
On Donnerstag, 30. Juni 2016 13:01:30 CEST Dominik Holland wrote: > Hi Olivier, > > Am 06/30/2016 um 12:52 PM schrieb Olivier Goffart: > > Hi, > > > > I have made a clang-format config file. I believe it should go into the > > qtrepotools repository, so I made this pull request: > >

Re: [Development] clang-format config file.

2016-06-30 Thread Dominik Holland
Hi Olivier, Am 06/30/2016 um 12:52 PM schrieb Olivier Goffart: > Hi, > > I have made a clang-format config file. I believe it should go into the > qtrepotools repository, so I made this pull request: > https://codereview.qt-project.org/163941 > > You can download this file from there and put

[Development] clang-format config file.

2016-06-30 Thread Olivier Goffart
Hi, I have made a clang-format config file. I believe it should go into the qtrepotools repository, so I made this pull request: https://codereview.qt-project.org/163941 You can download this file from there and put it in the parent directory of your qt repositories. (clang-format search all