-
Notifications
You must be signed in to change notification settings - Fork 447
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
Enforce clang-format on the entire code base. #3679
Conversation
cf67ba7
to
e7668bf
Compare
Well, not a huge problem in practice with .git-blame-ignore-revs. If you use docker images to develop p4c, this "issue" is easy to fully work around, as you need to run https://www.stefanjudis.com/today-i-learned/how-to-exclude-commits-from-git-blame/ |
Oh interesting, I did not know about this. So should we add this file after we have merged this PR? With the appropriate commit ID. |
Yes, +1 |
e7668bf
to
29031f0
Compare
It's not a good use of human time to review this kind of change. |
Yes, there is no expectation to review every single file. The clang-format changes are expected to be semantically equivalent. This check actually does automatically enforce the right format on every file going forward. So a big PR like this should not be necessary anymore, unless we change the format file. |
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.
This is good and an improvement to our hygiene. Let's wait to merge it until we have clear consensus though.
@mbudiu-vmw Any other thoughts on this? Once this is in, all PRs should be checked with clang-format. #3701 is a follow-up that cleans up the includes of the IR files so that clang-format can be enforced there. |
No other comments. |
Prehaps a pre-commit hook should check the format, otherwise we'll have lots of failed jobs. |
🙌 |
This PR enforces clang-format on the entire P4C code base. This is a one-and-done procedure since we already have an automated script There are pros and cons to this approach.
Pros:
Cons:
Note that the
ir
folder is not checked yet. The reason is that the includes there are set up in a very specific manner. I have a PR that fixes this, which I can merge in case this PR is approved.