CFP: Clang format for BPF formatting
This CFP proposes to start using clang-format to format the Cilium C code, and a process for introducing it and resolving changes in formatting.
Discussed in a 1:1:
-
Add a section that describes how this affects developer workflow. In the best case people could just install clang-format locally and then the editor reformats the code on save. But that raises the question how much code changes. Experiment: format all code with the oldest version we want to support (maybe clang-format-11). Then go to the most recent version and reformat using the config from clang-11.
-
Add a snippet that we will lint out future additions of
/* clang-format off */and// clang-format off. We need to drive down the number of special cases over time, not add to them.
@dylandreimerink we now have statuses for CFPs https://github.com/cilium/design-cfps#status. Please add the one that you think fits here
For context, I think this core idea was provided ample opportunity for input (for instance through sharing in Slack and community weekly meetings). The new status process only expects that prior to merge one committer approves the design that it is implementable and doesn't have major flaws / contention points. Both of you are committers so if you two agree then I would suggest marking it as "Implementable". Once implementable it can be merged, even if you still wish to iterate a bit further on the design points - those additions can come as subsequent PRs modifying this file.
From the community meeting: This should be good to merge. Still looking for one more volunteer - if you're interested, please respond here or reach out to Dylan on Slack.
For what it's worth, to minimize disruption I would encourage the committee to consider keeping the style as close to the existing style as is feasible while allowing the style to be programmatically enforceable via the newly proposed tooling. The incentives are probably already there, but this would reduce both churn and also git history obfuscation.
As a later step, providing developer-focused instructions to prepare their environment for the appropriate clang-format tooling to work would be a nice-to-have, perhaps even with defaults configured in .vim and/or .vscode as applicable.
Merging.
Looks like this PR mistakenly added the CFP document to the cfps/ template directory instead of the cilium/ directory in this repo. I've opened https://github.com/cilium/design-cfps/pull/64 to move it there.