Open LeSpocky opened 6 years ago
How about defining a clang-format file and have a hook check all commits against the format? (With an additional make target to apply the format to all changes.)
Never heard about clang format files, but a hook checking would certainly lead to more consistent results.
About clang-format: https://clang.llvm.org/docs/ClangFormat.html Also available in Debian: https://packages.debian.org/stretch/clang-format-3.8
The level of checking/corrections can be specified in the formats file. We use this at work to check consistency with our Coding Guidelines.
So first step would be to specify this formats file or someone picks an existing one, we can agree on. This would already allow to add new code in the desired format, even without a repository hook.
Just found this: http://cf.monofraps.net/
There are lot of C++ styles out there, but I have not found an explicit C style yet.
We need to consent on a C-based coding style anyways, as there are already different styles in the available code.
Some more:
A blog article on the topic: https://opensource.com/article/17/1/coding-style
Currently indentation is done by mixed tabs and spaces and different indentation levels (2 spaces, 4 spaces, …). Choose one policy and stick to it, maybe with editor modelines.