Skip to content

Style formatting config needed (e.g. clang-format)

Functionality to add/problem to solve

Add a clang-format or similar system config file in the code repository, so that contributions to the repository or derived projects can follow the Coding Style Guide.

Clang-format is an established formatting tool and integration is already provided in many editors and IDEs, including Emacs, Vim, and CLion.

Target audience

  • Regular developers of OpenFOAM
  • External contributors to OpenFOAM
  • Contributors to third-party OpenFOAM projects (e.g. function objects, such as the preCICE OpenFOAM adapter)

Proposal

  1. Create a .clang-format file, e.g. in the root directory of the repository, or any other directory preferred for developers' tools.
    • For example, with clang-format -style=llvm -dump-config > .clang-format
  2. Define the preferred rules following the Clang-Format Style Options. Beware that the rules may depend on the Clang-Format version.

What does success look like, and how can we measure that?

Running clang-format -i FILES should reformat the source files FILES to follow the coding style guidelines.

Links / references

Funding

I am not aware of existing functionality regarding this. However, it may have been already developed by other developers.