[Development] RFC: more liberal 'auto' rules?
olivier at woboq.com
Mon Dec 14 11:52:15 CET 2015
On Saturday 5. December 2015 00:57:23 Bubke Marco wrote:
> > You are basically assuming that there's no need for you to write sane
> > code to start with because during your development work you have a
> > decent IDE to help you out. This assumption is wrong, independent
> > of the existence of such an IDE.
> > Since the discussion here is about what to use in Qt, the whole Qt
> > development workflow matters. A lot of Qt code reading happens on Gerrit
> > without IDE features at hand. The context there usually just a few lines.
> > The appropriateness of an expression 'list[x]' is impossible to judge
> > on Gerrit after applying an 'Almost always auto' policy.
> Oswald and I spoke about using the clang code model to provide the
> information to gerrit too. It should be not that hard.
> But you have to import the code in the IDE anyway because of the missing
> context. For non trivial change review the calling context is far to
> important to be ignored. A html code browser could change that but we don't
> have one in gerrit.
I have made a user script to integrate http://code.woboq.org/qt5/ with gerrit.
With that script, you can just click on a function in the code on gerrit and
it will lookup in the code.woboq.org database and show the signature in a
tooltip and links to code.woboq.org. (It shows a disambiguation popup if there
are several possibilities.)
It also makes the filename in the header of the diff clickable to the
corresponding file on code.woboq.org
Look at this screenshot: http://i.imgur.com/Q3a2ixz.png
When you see the signature you can see the return type. And had 'auto' been
used there, we would have known it's a QUrl.
This does not work for all functions, but should already be of a great help
The user script is there:
You can use it with the Greasmonkey extension on Firefox or the Tampermonkey
extension on Chrome, or whatever equivalent extension for your browser.
If qt-project's admins think it's a good idea they could enable it by default.
Woboq - Qt services and support - http://woboq.com - http://code.woboq.org
More information about the Development