RFC: Running clang-format across all Plasma (and more?) repos

Vlad Zagorodniy vladzzag at gmail.com
Thu Jul 11 17:17:11 BST 2019


Hi,

On 7/11/19 5:18 PM, David Edmundson wrote:
> One topic discussed at the recent Plasma sprint was that we should run
> a code formatting tool (clang-format) over all our repos to ease all
> future review comments about whitespace.

This is a good idea! Reviewing such changes can become really painful 
for contributors as well developers. This will also save us time 
disputing coding style, e.g. "I prefer aligning pointers to left in this 
case, change my mind."

> I've written up a wall of text outlining steps, challenges etc.
> https://phabricator.kde.org/T11214

Given that we follow the kdelibs/Frameworks coding style in KWin, I 
don't see any reason to not run clang-format. See HACKING.md.

It is worth to mention that clang-format doesn't fix completely all 
coding style issues, e.g. one of those issues is braces. As you know, we 
have to put braces even if the body of a conditional statement contains 
only one line. clang-format doesn't have any style option to enforce 
this rule. Luckily, clang-tidy can do that [1].

So, perhaps we need to run both clang-format as well clang-tidy for some 
certain projects, e.g. KWin.

Cheers,
Vlad

[1] 
https://clang.llvm.org/extra/clang-tidy/checks/readability-braces-around-statements.html





More information about the Plasma-devel mailing list