Automating code formatting
I've attempted this once before. I'm ghost, for the shame of being rejected I had deleted my account. Kidding. But trying this one more time.
Essentially this means a .clang-format
file describing how code should be formatted placed at the root of the Kea repository.
The file needs to be in the root of the repository so that editors can pick up on it. vim, vscode, sublime, clion, eclipse all know to look there for it by default or with the right plugin installed. Select the code you contributed -> Format Selection. Furthermore, this is a project-specific set of settings, if you work on other projects you might not want them formatted the same way which is why it is not suited as a global set of settings. If this were to be placed in a separate repository, it would have to be copied to Kea each time. Personally, I have two practices which make this too laborius.
One - I clean my git repository very often git clean -dffx .
, usually before each new build.
Two - I clone a separate directory for each issue, having to copy the .clang-format
each time.
clang-format
is de facto accepted as the best code formatter for C++.
This .clang-format is by design very close to the coding guidelines. It takes away the worry of having to know the coding guidelines by heart.
I noticed that libockless has one too.
What are your thoughts?