Format the codebase with clang-format #266
Open
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.
Thanks to a suggestion by @telmin, I spent some time on creating a clang-format configuration and (as a test for now) reformatted the codebase with it.
In the Python world, the Black code formatter has become quite popular, and my experience with using it has generally been quite positive because code formatting simply becomes an automated thing that one doesn’t have to think about anymore. In strobealign, I spent some time on formatting code manually, which did not feel very productive. It did however help me form an opinion on which style I would prefer, and I have configured clang-format in such a way as to follow that style. The style is based on the pre-configured clang-format style named "Chromium", and I added a couple of settings to make it more like the style we are already using (4-space indents instead of 2 for example).
For this to work, we would need to enforce the code style. That is, CI would need to fail if the style is not followed. This is a bit of an incovenience because whoever contributes to the code needs to ensure that the formatting is correct.
@psj1997 This would definitely cause conflicts with your work, so I am not suggesting to merge this before we have found a way to rebase your branch without getting a ton of conflicts.
To do
git commit
time