-
Notifications
You must be signed in to change notification settings - Fork 18
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
[clang-tidy] Disable lints that frequently cause false positives #311
Conversation
We can't enable clang-tidy's `misc-const-correctness` everywhere due to its large number of false positives around accessors and guard types.
We can't add the misc-include-cleaner lint because it causes too many false positives with "interface headers" such as sycl.hpp.
Check-perf-impact results: (32e33781a20e2a3976ece8f7dc81ae2b) ❓ No new benchmark data submitted. ❓ |
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 expected the diff to be a lot worse! Thanks!
I also used the include-cleaner mayhem as an opportunity to set a consistent #include schema:
Should we add that guide to CONTRIBUTING.md? 🤔
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.
Clang-Tidy
found issue(s) with the introduced code (1/1)
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.
Nicely done, I really appreciate 2 main points of this:
- I love standardizing the header ordering, and I also like the reasoning for the 3 groups.
- We really do need to reduce the clang-tidy spam, and I agree with the vast majority of removals. I added notes on a small number of them.
What I'm ambivalent about is the sheer amount of includes that are the result of strict include what you use. But we decided on that earlier. I guess in some cases it might indicate which headers have too much responsibility or not enough encapsulation.
What I really don't like is (bikeshedding warning!) the extra newline. It also seems like this is the opposite of formalizing the established practice of our codebase, since it seems like there are far more files where it is added than there are others.
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.
Clang-Tidy
found issue(s) with the introduced code (1/1)
Pull Request Test Coverage Report for Build 11975782234Details
💛 - Coveralls |
Re newline: I don't feel strongly about this, but visually it does help me in files with huge include lists like And I agree the number of includes is a bit excessive, but I have trouble coming up with a much better rule dictating which includes must be present. We could though, for example, omit all includes from a .cc file that have already happened in the .h file of the same name. |
Resolves #127.
There's two lints we would like to have but can't enable fully due to FPs:
misc-const-correctness
will suggestconst accessor
andconst std::lock_guard
, which is just noise. I've enabled this in the runtime, but disabled it for examples and tests - we don't constuct too many accessors in runtime code itself.misc-include-cleaner
doesn't understand "interface headers" like<sycl/sycl.hpp>
and will insist we include<hipSYCL/sycl/handler.hpp>
et al. It also removes includes that are necessary for trait implementations, such as those offmt::formatter
.I've manually performed autofixes for both these lints and added sensible corrections resulting from them as individual commits in this PR to clean up the codebase somewhat.
I also used the include-cleaner mayhem as an opportunity to set a consistent
#include
schema:I'm including my own headers before the stdlib or 3rdparty dependencies, because this is more likely to lead to a compiler error when another header forgets to include something. clang-format is smart enough to alphabetically sort includes within those groups.
I didn't bother with updating includes in tests in this PR.