How to deal with clang-format
Thomas Baumgart
thb at net-bembel.de
Sun Aug 13 09:20:02 BST 2023
On Sonntag, 13. August 2023 01:54:21 CEST Jack Ostroff via KMyMoney-devel wrote:
> I'm finding git requiring me to run clang-format on most code changes.
> Most of the time, it is fine - just fixing up bad indentation (tabs ->
> spaces) but sometimes it completely re-indents something in ways that
> make it actually harder to read, or using longer lines.
> https://community.kde.org/Policies/Frameworks_Coding_Style says you can
> use a comment at the end of a line to preserve manual line breaks, but
> I have a case where it still re-flows, putting ". //" on a line by
> itself. Do we have a preference on how to handle this, or do we just
> let clang-format do its thing?
I'd say let clang-format do its thing. It's what I prefer if I can't get
things controlled the way I want them.
> Related - is there a way to get emacs to use the required formatting
> style without having to explicitly run clang-format (either in emacs or
> command line) ?
Here's something I found (but I am more on the vim side of things)
https://emacs.stackexchange.com/questions/55635/how-can-i-set-up-clang-format-in-emacs
https://github.com/SavchenkoValeriy/emacs-clang-format-plus
The .clang-format file should be part of the repo already.
Hope that helps
Thomas
--
Regards
Thomas Baumgart
-------------------------------------------------------------
UTF-8 Test: The 🐈 ran after a 🐁, but the 🐁 ran away.
-------------------------------------------------------------
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 868 bytes
Desc: This is a digitally signed message part.
URL: <http://mail.kde.org/pipermail/kmymoney-devel/attachments/20230813/a560f139/attachment.sig>
More information about the KMyMoney-devel
mailing list