[Qbs] [RFC] Add a clang-format config file to qbs repo

Christian Gagneraud chgans at gmail.com
Mon Jul 8 11:39:09 CEST 2019


Hi there,

I would like to propose to add a clang-format config file to qbs repo.
I don't want to go in depth about which coding style we should use, so
i propose we simple copy the one used by QtCreator developers. :)

The rational for using clang-format is that it simplifies code review,
no need to waste time for coding style any more (line too long, white
space in the wrong place, ...). Any modern IDE will pick it up
automatically and format your changes according to it.

If you're interested, it is as well possible to add client side hooks
that will automatically reformat *only the edited part of files* of
the commit.

Before you say Ya/Na, i would like to give some pros and cons (again
won't go into details):
- cons: It's rigid, if the config file is "wrong", doesn't understand
edge cases, is not contextual enough, ... then you just have to deal
with it (read: accept its rules).
- pros: say bye-bye to the need to comment (or address comment) about
indentation, spaces, bracket placement, ... and the need to manually
check if you do the right thing or not. Let SW do the hard job.

We've switched to that at work a year or 2 ago, and since then,
reviews are more focus, it made a huge difference.

Let me vote first, :)
+1

Any comment, objection?

Chris


More information about the Qbs mailing list