Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Duplicate .clang-format file in OpenFOAM cases #559

Open
MakisH opened this issue Aug 29, 2024 · 3 comments
Open

Duplicate .clang-format file in OpenFOAM cases #559

MakisH opened this issue Aug 29, 2024 · 3 comments

Comments

@MakisH
Copy link
Member

MakisH commented Aug 29, 2024

While we have a central .clang-format file for the tutorials, we also have such a file for the OpenFOAM solver in the partitioned heat conduction case. We need this mainly because the default format moves around header inclusions, which breaks OpenFOAM code. This is already a duplicate of the file used in the OpenFOAM adapter, and other PRs are introducing more duplication (such as #551).

We could maybe move the OpenFOAM-specific file to tools/ for now, and link to it from the various directories.

Note that we are also working on a community proposal, which we could maybe one day import.

@fsimonis
Copy link
Member

fsimonis commented Sep 2, 2024

A possibility which works in pre-commit but not IDEs is to define 2 clang-format hooks and explicitly pass the configuration file to format the OpenFOAM solvers. This way we could use a single clang format file for all openfoam solvers in the repo.

https://github.com/pre-commit/mirrors-clang-format/blob/7d85583be209cb547946c82fbe51f4bc5dd1d017/.pre-commit-hooks.yaml#L7

https://clang.llvm.org/docs/ClangFormatStyleOptions.html#configuring-style-with-clang-format

@MakisH
Copy link
Member Author

MakisH commented Sep 2, 2024

I like the idea. If we also distribute the file as a separate repository, we could import it as a git submodule (I will eventually do this in the context of the OpenFOAM SIG RSE).

@fsimonis
Copy link
Member

fsimonis commented Sep 4, 2024

I like the idea.

I'll try it in #551 and link to the existing clang format in on of the openfoam solver directories.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants