Skip to content

Draft: add clang-format pre-commit hook

Mark Penner requested to merge mrp/kwave:work/clang-format into master

Marking this as draft because I'm not sure if it is the right thing and I want to give a chance for discussion.

@eschenbacher, I noticed you have been committing some coding style fixes. What do you think about clang-format? I like consistent formatting, but I know automatic formatters can be controversial.

The first commit in this MR would add the KDE .clang-format file and install a pre-commit hook to make sure new commits were formatted. That way the code base could gradually get closer to the KDE clang-format style.

The next commit would add a build target to format all source files. I'm not sure if this is a good idea or not. I tried formatting everything, and there would be a lot of changes. There are ways of preserving manual formatting, but it looks like a big job to go through the whole code base and mark up where to use manual formatting. I could add a commit showing the changes that would be made if you want.

If this is not desired, that's fine. I'm interested in any feedback.

Merge request reports