Showcasing the strengths of clang-format to the OpenFOAM community (original) (raw)
December 18, 2023, 1:42pm 1
Dear LLVM community,
you may have heard of OpenFOAM, which is one of the most used and long-standing open-source simulation frameworks for fluid dynamics out there.
As many derived projects depend on it, we have now started an official special interests group discussing software engineering practices we would like the project to follow. In our next meeting, on February 16, 2024, 13:00 CET we want to discuss automatic code formatting solutions and try to propose a solution to the core developers, which then derived projects could use.
The project has its own style guide, for which multiple people have tried to provide a clang-format configuration file, without being able to cover everything.
With this post, I would like to:
- Raise attention to the effort to provide a clang-format file for OpenFOAM
- Call for help in the issue, trying to satisfy any remaining rules with existing rules, or identify new rules that need to be implemented
- Invite people from the clang-format community to join our next meeting, providing ideas and related help.
OpenFOAM is a very large and important project that, in my opinion, has a lot of way to cover to be able to open up to community contributions to the core. I think that managing to provide a clang-format file for this project (with potentially some compromises from OpenFOAM) would unlock an important door to new contributions to OpenFOAM (since formatting is one of the usual points of argument) and would hopefully be an interesting use case for clang-format.
Endill December 18, 2023, 8:06pm 2
I don’t see a good category for clang-format, so CC’ing clang-format code owners: @owenpan @mydeveloperday.
owenpan February 10, 2024, 5:47am 3
Thank you for reaching out!
Your style guide has quite a few uncommon rules that fall outside of the existing clang-format options. As clang-format has grown considerably for the past couple of years in both functionality and flexibility, I’ve become increasingly averse to adding unusual options even if they meet the bar for new options. IMO you may have to either adapt your style guide significantly or customize clang-format for your own use.
MakisH February 15, 2024, 10:24pm 4
Thank you for looking into the style guide! I created a minimal working example, collecting the main rules of the style guide I could not map to clang-format.
The style guide indeed has some unusual rules, but the project has a very long history, as well as many forks and derived projects, making change compilcated and automation very much needed. I wish I could change the style guide, but that is beyond my jurisdiction (I am only a maintainer of a downstream project).
There will be an open discussion about this tomorrow, in case anyone is interested.