Repository navigation
ORC-1307: Add .clang-format to enforce C++ code style - #1308
Conversation
dongjoon-hyun
left a comment
There was a problem hiding this comment.
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
|
Since it looks very intrusive, cc @williamhyun , @omalley , @stiga-huang , @guiyanakuang , too. |
|
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 |
stiga-huang
left a comment
There was a problem hiding this comment.
+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 <dongjoon@apache.org> Signed-off-by: Dongjoon Hyun <dongjoon@apache.org>
### 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 <dongjoon@apache.org> Signed-off-by: Dongjoon Hyun <dongjoon@apache.org>
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.