Configure clang-format for Google code style slightly adapted #19855
+37
−19
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.
Describe problem solved by this pull request
As discussed we'd like to have a more clear code style that is easy to document, adapt to, apply with tools and maintain.
Describe your solution
As discussed with @dagar @tstastny @ThomasDebrunner we'd prefer to adopt the Google style guide with a few adaptations that are documented in the PX4 guide here: PX4/PX4-user_guide#1918
This pr is deploying clang-format to adapt the spacing of the proposed code style. Note that for naming conventions and other context-aware tooling we need to use clang-tidy on top which I started testing with but didn't get to do what is required yet. Also note that we'll need to transition the style and not change everything at once. Also there are some things that are less expected like the spacing of DMA tables. Please chime in for feedback and suggestions on transitioning.
Test data / coverage
It can be tested by using the make target for testing
make format_clang
and the result of running it I pushed onto this branch for your reference: https://github.com/PX4/PX4-Autopilot/compare/google-style-showcaseMissing: