-
Notifications
You must be signed in to change notification settings - Fork 83
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
Use pre-commit for clang-format #175
Conversation
Codecov ReportPatch has no changes to coverable lines. 📢 Thoughts on this report? Let us know!. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, but before merging I think we should add some documentation on how to use the pre-commit when you are developing, similar to what we have in the ROS2 Driver
This way it is easier to use for others.
@urmahp I've updated things a bit together with a contributor guideline. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. Just added small suggestion regarding installing clang-format-14
* This repo supports [pre-commit](https://pre-commit.com/) e.g. for automatic code formatting. TLDR: | ||
This will prevent you from committing falsely formatted code: | ||
``` | ||
pipx install pre-commit |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we should state which clang format to install as well.
```suggestion
pipx install pre-commit
sudo apt install clang-format-14
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The clang-format version is specified in the pre-commit job. That's the main reason I switched to pre-commit: clang-format is installed in a python virtualenv with the respective version, so developers (and CI maintainers) don't have to manually install a specific version.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wasn't aware of that, nice solution :)
It has bothered be for quite a while that we have so many "code formatting" commit inside our PRs. Using pre-commit enables us to check formatting before we actually push something.