[Development] Proposal: (re)move qt5.git/_clang-format
Marc Mutz
marc.mutz at qt.io
Tue Sep 12 19:29:51 CEST 2023
Hi,
TL;DR:
- remove _clang-format in qt5.git
- add it instead to submodules which conform to it
The clang-format philosophy is that you pick a config and stick to it.
If your personal preferences are different, you use a different
configuration locally and re-format on check-in and check-out.
This means that the source code in the VCS must always conform to the
clang-format configuration in effect in that branch. It also means that
when and if you make changes to the clang-format configuration, you need
to re-run the tool over the whole code base and apply the changed
configuration, otherwise the clang-format workflow doesn't work
(produces unrelated white-space changes).
We have for quite some time had a _clang-format config file in qt5.git.
After many attempts by many people, it has become clear that a) it has
completely wrong settings (e.g. template<> vs. template <>), leading to
a complete formatting mess in modules that predate the addition of the
file and more discussions around formatting than before, because there
appear to be two true styles, and b) we can't seem to hammer
clang-format into reproducing what we traditionally understand as the Qt
style. In addition, the position in qt5.git means that if you edit files
in submodules of qt5.git, the config is in effect, if you just checkout
qtbase, it is not.
I would therefore propose to remove the file from qt5.git:
https://codereview.qt-project.org/c/qt/qt5/+/503430
Newer submodules which have been developed against and therefore adhere
to the file should feel free to add it to the submodule, but it
shouldn't be in qt5.git anymore. They should also make sure that they're
up-to-date with any changes that have been made to _clang-format over
the time (or revert them in their copy), and get clang-format nagging
enabled in the CI.
WDYT?
Thanks,
Marc
--
Marc Mutz <marc.mutz at qt.io>
Principal Software Engineer
The Qt Company
Erich-Thilo-Str. 10 12489
Berlin, Germany
www.qt.io
Geschäftsführer: Mika Pälsi, Juha Varelius, Jouni Lintunen
Sitz der Gesellschaft: Berlin,
Registergericht: Amtsgericht Charlottenburg,
HRB 144331 B
More information about the Development
mailing list