-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
Look at flipping clang-tidy's misc-* to enable-by-default #4699
Conversation
@zygoloid Particularly interested in your recursion thoughts here. |
b1e2ce8
to
117e79d
Compare
Co-authored-by: Richard Smith <richard@metafoo.co.uk>
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.
Just FYI, I like the direction, and the comments on the no-recursion bits seem pretty helpful.
Note, per discussion, I'll be looking more at misc-non-private-member-variables-in-classes but in a separate PR. |
Pull Request is not mergeable
…to match (#4702) Pursuant to discussion regarding #4699, turn on `misc-non-private-member-variables-in-classes` using the `IgnoreClassesWithAllMemberVariablesBeingPublic` flag (the check treats structs as classes, so we need this for structs with all-public members). Updates the style guide notes to match, which should be pretty minor due to the scoping of test fixtures. Also fixes some underscore uses in test files on the way. Basically this is keeping the style for [class data member naming](https://google.github.io/styleguide/cppguide.html#Variable_Names) even while making them public.
I was wondering, instead of treating
misc
differently and enabling specific checks, maybe we can flip that since we actually seem okay with most of the checks?The main check I'm enabling, with significant edits here, is
misc-no-recursion
. But maybe this is helpful to enable, even with the necessary NOLINTs, since we want to avoid recursion in the toolchain? This PR shows some example fixes in subst.cpp (which are more stylistic, since the code shouldn't actually have recursed due to its structure; I think we could remove the warning on TryResolveInst the same way). Some also just don't seem worth fixing, like those in tests files (I didn't see a way to exclude files in .clang-tidy, so instead I'm using NOLINTBEGIN). But I think we might actually want to fix inst_namer, and there's enough in convert that I didn't look closely.Also, I made some protected -> private style fixes based on
misc-non-private-member-variables-in-classes
(this is also how I noticedclass Real
versusstruct Real
). With node_stack, it looks like theprotected
wasn't even used. Per style, data members should be private outside tests. But since we can't trivially excludeprotected
members in tests, I'm turning it off -- I don't view it as offering enough benefit on the whole.migrate_cpp issues are preexisting (I believe we just aren't monitoring it), but changes there make
bazel build --config=clang-tidy -k //...
work cleanly.