Closed horta closed 5 years ago
Can you provide a bit more information about how this would work? Is the idea that we’d put such a file somewhere in our code base, and then clang would warn/complain about style violations?
Is there any sort of cross-compatibility between Clang and GCC on this? I’m not sure that something that only analyzed style on Clang builds would be that much help,
-Nick
On June 25, 2019 at 1:37:03 PM, Danilo Horta (notifications@github.com) wrote:
Would you be considering in defining a code format via clang-format? It would help to automatically enforce some code format aspects, and add a single .clang-format file.
Here is a clang-format generator: https://zed0.co.uk/clang-format-configurator/
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/EddyRivasLab/easel/issues/35?email_source=notifications&email_token=ABDJBZD2RCWHXX7E537JKY3P4JJT5A5CNFSM4H3KUZRKYY3PNVWWK3TUL52HS4DFUVEXG43VMWVGG33NNVSW45C7NFSM4G3TPJCQ, or mute the thread https://github.com/notifications/unsubscribe-auth/ABDJBZF42TBOXL7FI4IEGRTP4JJT5ANCNFSM4H3KUZRA .
Sure. clang-format is just a tool that happens to be developed by the guys from LLVM: it is compiler independent. It can be installed via brew, for example: brew install clang-format.
You can use it by entering clang-format original.c > new.c
or, more commonly, use it in your favorite editor. For example, I've created this .clang-format file that resembles Easel's current format:
---
BasedOnStyle: Mozilla
BreakBeforeBraces: GNU
ColumnLimit: '88'
TabWidth: '2'
UseTab: Never
...
This transform original format into new format. Notice that the tab vs space identation problem disappear. Also, trailing spaces are removed, etc.
It is a way to have a code style defined precisely and automatically enforced (at least by those using clang-format tool).
I think it's an interesting idea and worth considering, but not right now. I do find the tab/spaces thing annoying in our code, and I try to deal with it by configuring my editor (emacs) to only use spaces. I worry that automagically reformatting our code will have unexpected side effects that could be even more annoying. So with HMMER4 development as our priority right now, I don't see formatting as a high priority, and I think we should defer it for later and continue muddling through as we are.
Would you be considering in defining a code format via clang-format? It would help to automatically enforce some code format aspects, and add a single
.clang-format
file.Here is a clang-format generator: https://zed0.co.uk/clang-format-configurator/