Update code style clang format - #7330
Open
gassmoeller wants to merge 3 commits into
Open
Conversation
Open
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This is the alternative to #7326 using clang-format instead.
I adjusted the deal.II .clang-format slightly to reduce the amount of changes to ASPECTs source code, but a few unintentional changes remain:
function specifiers and return types (
virtual double) will now always be put on the same line. The necessary config option to keep our current style is only available from clang-format 23 onwards (BreakBeforeReturnType).some of our macros in the
interface.hfiles are reformatted quite a bit, I dont think the new style is particularly better or worse, just differentclang-format is a bit more zealous in breaking parameters across lines (see e.g. parameters.cc). I actually like the new style more, but it is quite a lot of code change for little gain.
Downloading clang-format was very simple using deal.II's script, so this may be an even simpler workflow than installing astyle via candi (and it makes installing ASPECT slightly simpler). Also we could benefit from deal.II's infrastructure. I saw that deal.II installs the
indent.pyscript, so maybe we can just use that instead of including it again in ASPECT.This PR will need a bit more cleanup of integrating clang-format into our cmake system and removing astyle, but I would like to come to a decision which style we like more before finalizing either this or #7326. We could also decide we are happy with the current style of astyle 2.04, I dont want to force this if it is not better.
Personally I tend towards the clang-format solution, mostly to keep things as similar to deal.II as possible, but I also admit there is no pressing reason that we absolutely have to do this right now. Opinions?