D20572: RFC: Add .clang-format
Vlad Zagorodniy <[email protected]>
| Newsgroups | gmane.comp.kde.devel.kwin |
|---|---|
| Message-ID | <[email protected]> |
zzag created this revision. zzag added a reviewer: KWin. Herald added a project: KWin. Herald added a subscriber: kwin. zzag requested review of this revision. REVISION SUMMARY Different developers prefer different coding styles, e.g. some people align pointers to the left and some to the right, etc. Unfortunately, there are changes that don't follow the kdelibs/Frameworks coding style. Reviewing such changes gets a bit tedious for both code reviewer and patch author. The worst part is that some coding style incompliance issues go in unnoticeable, which is okay, we're humans after all... Luckily, LLVM project developed a tool called clang-format. As its name suggests, clang-format is a tool to format C/C++ code. In order to use it, we have to provide our own .clang-format file where different style options are specified (e.g. pointer alignment, etc). As a developer you need to enable auto-formatting in your text editor (or just setup a pre-commit hook to run clang-format). Though clang-format isn't perfect. The biggest issue with it right now is that there is no any option to disable formatting of SIGNALs and SLOTs (using // clang-format off and // clang-format on is unacceptable). This is probably not a big issue because we have to replace majority of string-based connections with functor-based connections anyway. REPOSITORY R108 KWin BRANCH add-clang-format REVISION DETAIL https://phabricator.kde.org/D20572 AFFECTED FILES .clang-format To: zzag, #kwin Cc: kwin, jraleigh, GB_2, mkulinski, ragreen, jackyalcine, Pitel, iodelay, bwowk, ZrenBot, ngraham, alexeymin, lesliezhai, ali-mohamed, hardening, jensreuterberg, abetts, sebas, apol, mart