Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Configure clang-format for Google code style slightly adapted #19855

Draft
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

MaEtUgR
Copy link
Member

@MaEtUgR MaEtUgR commented Jun 30, 2022

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-showcase

Missing:

  • Check styling corner cases like DMA comment table
  • Deal with clang-format not installed
  • Integration with pre-commit hook
  • Transition strategy e.g. remove/add transitioned folders

@howjmay
Copy link
Contributor

howjmay commented Feb 18, 2024

Hi is this still an open task? If so I can try to solve the missing items

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development Environment 🖥️ For setting up environment for developers. VSCode Extensions, WSL configuration, etc
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants