Introduce an automatic formatting tool
Open, WishlistPublic

Description

All code should be automatically formatted, as an easy way to enforce the coding style.

The most likely tool we should use for that is clang-format.

cmollekopf updated the task description. (Show Details)
cmollekopf raised the priority of this task from to Needs Triage.
cmollekopf added a project: Sink.
cmollekopf added a subscriber: cmollekopf.

I prepared a .clang-format config that seems decent in a feature branch

One blocking issue is that Q_SLOT: is not recognized (but it will with clang 3.9), so either we use slots: or wait for clang 3.9

Switched to slots, we're pretty much ready to reformat.

cmollekopf moved this task from Backlog to In Progress on the Kube board.Feb 17 2016, 1:07 PM
cmollekopf moved this task from Backlog to Enhancements on the Sink board.Nov 1 2016, 8:42 PM
cmollekopf moved this task from In Progress to Infrastructure on the Kube board.Nov 8 2016, 3:23 PM
mbohlender moved this task from Infrastructure to Backlog on the Kube board.Nov 8 2016, 5:56 PM
cmollekopf moved this task from Backlog to Misc on the Kube board.Feb 10 2017, 2:22 PM
cmollekopf triaged this task as Wishlist priority.

We now have a .clang-format config in both kube and sink. No enforced automatic formatting happening yet though.

alex added a subscriber: alex.Nov 27 2020, 2:17 PM

This has gotten some more attention:

https://phabricator.kde.org/D24568
https://invent.kde.org/plasma/plasma-workspace/-/merge_requests/381
https://invent.kde.org/plasma/plasma-desktop/-/merge_requests/199
https://invent.kde.org/frameworks/extra-cmake-modules/-/merge_requests/20
https://invent.kde.org/plasma/plasma-workspace/-/merge_requests/484
https://invent.kde.org/frameworks/extra-cmake-modules/-/merge_requests/47

Also okular has it already integrated, but with a custom clang-format config file and not the one provided from ECM.
It is still debatable if we can utilize it for the big plasma projects, because it will cause a lot of issues with the currently open MRs. Maybe we should format the components individually, for example runners, kcms etc.