-
Notifications
You must be signed in to change notification settings - Fork 69
ci: add clang-tidy Checks #32
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
Conversation
|
This is the outcome of @lidavidm 's question whether we should use lowerCamelCase or UpperCamelCase for method names. I referenced ORC and Arrow's clang-tidy configs. If a PR want to commit some functions not following conventions, cpp-linter-action will report suggestions, see zhjwpku#2 as a example. |
|
More generally: is there a particular style guide (e.g. Google, LLVM, ...) that we want to adopt? |
|
Should we just follow what Arrow does and adjust it as needed? I think it is based on the Google coding style with some modifications and some contributors are already familiar with it. I have also checked that Impala has derived from the Google style as well: https://cwiki.apache.org/confluence/pages/viewpage.action?pageId=65868536. @gaborkaszab WDYT? |
I didn't find such one line setting, this PR sets lots of readability-identifier-naming rules, some might not be reasonable, we can remove some if someone knows it's wrong. |
IIRC the one complication is that Arrow follows a bit of an old version of Google style (notably: Arrow still prefers |
I do notice that there is a google-objc-function-naming[1] check, but it seems does report the anomaly(see [2]), i.e. [1] https://releases.llvm.org/12.0.0/tools/clang/tools/extra/docs/clang-tidy/checks/google-objc-function-naming.html |
|
As the docs state, that's for Objective-C, so I wouldn't expect it to help |
Yeah, I did not notice that ;( |
Yeah, well I'm not sure how much of the Goggle style we keep in Impala, for me any convention is fine as long as it's well defined and enforced to everyone. I guess Arrow is well adopted enough to follow that, but frankly I have no experience with that so I'll leave this for people involved with that project. |
|
I don't think we've had any major issues with our style conventions on Arrow C++. The only annoyance I have personally is the ambiguity around method naming, between |
I'm wondering if the Arrow style enforced by CI rules or just committers enforce it while reviewing PRs? It seems not easy for a bot to tell whether a method is "cheap" or not, I might be wrong though. |
|
Most of it is enforced by committers on PRs. It would probably be nice to have more automated enforcement, though. |
|
I found a clang-tidy readability-identifier-naming for Google's naming convention [1], the gist has 7 revisions and seems quite popular(18 stars), does it make sense we adopt it? [1] https://gist.github.com/airglow923/1fa3bda42f2b193920d7f46ee8345e04 |
8409c64 to
64a3d57
Compare
Signed-off-by: Junwang Zhao <[email protected]>
64a3d57 to
1f122f0
Compare
|
As @lidavidm is working on the type system, we seems to prefer Arrow-style, so I'm proposing we adopt Arrow's clang-tidy. There are two points I want to mention here:
|
|
Sounds good to me. |
Signed-off-by: Junwang Zhao <[email protected]>
|
TBH, I'm not in favor of adding |
Make sense, maybe we can depend on |
|
If we are going to use a Result/Status object, then I think we should have |
Then we can declare |
|
Ah, interesting. (I am used to the std::expected backport which doesn't do this, so I always put it by hand everywhere...) Anyways, I don't feel strongly about this. If you want to remove nodiscard then let's just proceed, I would rather have some static checks than none. |
|
I don't feel strong on this. We can always enforce static check on functions marked as |
This reverts commit 2708d07.
|
nit: change the PR title to |
raulcd
left a comment
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 have never configured the cpp-linter action previously but don't we have to update the tidy-checks option to an empty string in order to use that config file? From the docs:
It is also possible to rely solely on a .clang-tidy config file by specifying this option as a blank string ('').
My question is if this is currently being exercised and enforced on our linter CI step
I checked that while working on this PR, both '' and file works. |
Thanks for confirming, I didn't see the |
Let's change file to '' in case future misunderstanding. |
Rely on a .clang-tidy config file by specifying `tidy-checks` option
as a blank string (''), see [0] for details.
[0] https://cpp-linter.github.io/cpp-linter-action/inputs-outputs/#tidy-checks
Signed-off-by: Junwang Zhao <[email protected]>
I also think that it does not make sense to add |
ci: add clang-tidy check
This PR also changed cpp-linter's
tidy-checksoption to reduce misunderstanding,Rely on a .clang-tidy config file by specifying as a blank string (''), see [0] for details.
[0] https://cpp-linter.github.io/cpp-linter-action/inputs-outputs/#tidy-checks