-
Notifications
You must be signed in to change notification settings - Fork 486
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
ORC-1307: Add .clang-format
to enforce C++ code style
#1308
Conversation
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.
Thank you so much, @wgtmac . I have three comments.
- This looks worth to have a JIRA ID. Could you file one?
- The code change should be in the same PR because we cannot merge this if this rule causes too breaking changes.
- In addition, we had better the CI enforcement of this rule in this PR together.
cc @williamhyun and @stiga-huang |
I have tried to apply clang-format-action to verify whether the C++ files follow the .clang-format config file. However, I got an error as below:
After some research, I figured out that this action is not whitelisted by the Apache project setting: https://github.com/orgs/community/discussions/25488. Unfortunately I don't have the permission to add it. Do you know how to do that, or is there any alternative? @dongjoon-hyun @williamhyun @stiga-huang |
|
I have checked Apache Arrow but it uses cpplint manually and does not integrate it with the GitHub workflow.
I have checked apache/arrow, apache/avro, and apache/impala. It looks like none of them use Github workflow to apply style check. Apache Arrow uses cpplint manually but it requires hard work to match the style between clang-format and cpplint. I have filed an INFRA JIRA: https://issues.apache.org/jira/browse/INFRA-23873. |
@dongjoon-hyun Now it is good to go. |
Thank you so much, @wgtmac . |
.clang-format
to enforce C++ code style
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.
+1, LGTM.
Since it looks very intrusive, cc @williamhyun , @omalley , @stiga-huang , @guiyanakuang , too. |
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.
+1 LGTM!
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.
+1 LGTM
Thanks for adding this! One concern is that this PR touch most of the c++ codes. |
That's a good catch! Let me add |
Thanks for adding the new rule! Now I see some changes are refactoring simple functions like
into in one line
Does it mean the previous syntax won't be accepted anymore? Impala allows both format. Not sure if this takes effect: https://github.com/apache/impala/blob/3938dae8be6f28132de67f10d0361665e5c6cad3/.clang-format#L7 It'd be nice if both formats are allowed. But I'm ok with merging the current PR. |
Unfortunately |
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.
+1. Thanks for making the changes!
I just committed this. Thank you all! @dongjoon-hyun @stiga-huang @williamhyun @guiyanakuang |
### What changes were proposed in this pull request? This PR is an accumulated change to make the PR labeler up-to-date. - Remove `.travis.yml` (#991) - Add `dev` folder (#1136) - Add `.clang-format` (#1308) ### Why are the changes needed? To make the PR labeler up-to-date. ### How was this patch tested? Manual review. Closes #1362 from dongjoon-hyun/ORC-1351. Authored-by: Dongjoon Hyun <[email protected]> Signed-off-by: Dongjoon Hyun <[email protected]>
### What changes were proposed in this pull request? This PR is an accumulated change to make the PR labeler up-to-date. - Remove `.travis.yml` (apache#991) - Add `dev` folder (apache#1136) - Add `.clang-format` (apache#1308) ### Why are the changes needed? To make the PR labeler up-to-date. ### How was this patch tested? Manual review. Closes apache#1362 from dongjoon-hyun/ORC-1351. Authored-by: Dongjoon Hyun <[email protected]> Signed-off-by: Dongjoon Hyun <[email protected]>
There are some guidelines on formatting: https://orc.apache.org/develop/coding/. But no tooling has been available to enforce the style of C++ code. This patch aims to be the starting point. Follow-up changes will include automatic scripts to format cpp source files and per-commit check.