ls1mardyn / ls1-mardyn

ls1-MarDyn is a massively parallel Molecular Dynamics (MD) code for large systems. Its main target is the simulation of thermodynamics and nanofluidics. ls1-MarDyn is designed with a focus on performance and easy extensibility.
http://www.ls1-mardyn.de
Other
28 stars 15 forks source link

Modernize clang-format file #342

Open HomesGH opened 3 weeks ago

HomesGH commented 3 weeks ago

Description

As discussed in issue #276 , we want to add a clang-format file to enforce an unified style in ls1. For this, we have to:

If we want to be very fancy, we could do something like in MegaMol.

Resolved Issues

I would recommend that this PR does not apply the formatting to the whole code base in ls1. This should be done in a separate PR for the sake of clarity.

amartyads commented 3 weeks ago

I like that the clangformat file only has the essentials for now, I think it makes it easier for discussion purposes. In the final version, however, we should change it back into a full file.

I made the BreakBeforeBraces style Attach, now we will have } else { again instead of else on a newline.

One (potentially) controversial change I've made is PointerAlignment: Left. We prefer Right (I do too), but the PDF style guide says Left, and I think that if we're following the PDF on spaces vs tabs, we should follow it here as well.

The CI seems to be using clangformat 14. I would vastly prefer 18, because that's what MaMiCo uses, but we can discuss that further.

We could also use git hooks to format all new files according to the clangformat, however AFAIK git hooks are not server side.

github-actions[bot] commented 3 weeks ago

:warning: The CI detected formatting issues in this pull request. Please run clang-format locally to resolve them. Details are shown in the job log.