-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
fix(clang-tidy): Apply all performance fixes to tests and enable performance checks on CI #3051
fix(clang-tidy): Apply all performance fixes to tests and enable performance checks on CI #3051
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.
That's fantastic! I glanced through the changes but didn't go through with a comb, thinking that's not needed, given that this PR allows us to add automatic tooling for code health, and that we already have extensive testing. As far as I saw there are mostly or only (?) three types of changes:
foo
->const foo&
- adding
noexcept
NOLINTNEXTLINE
Did I miss something important? What do you think about adding that list + anything I missed to the PR description? If you could explain (outline is fine) the rationale for deciding between adding const &
vs NOLINTNEXTLINE
that would be a plus. If there are any special or tricky decisions you made, pointing those out would be good, too. I will take a closer look at those.
@rwgk Feel free to edit the PR directly. I pointed out some of the tricky decisions I made. Mostly erred on the side of caution and just NOLINTed things instead of changing behavior. |
@rwgk I also wanted to enable readability-const-return-type , but it generated a bunch of errors I am not sure how to fix such as:
|
Hi Aaron, thanks for all the comments! I don't have the free bandwidth to get deeply into the weeds. My suggestion is to turn those github comments into terse code comments to go with the |
No immediate idea. Sorry I don't know much about this code, too. My suggestion is to get this PR merged, then open a separate one for this issue while we have the rest in place already. |
…lutter and clang-format issues. This was really meant to be part of PR pybind#3051 but was held back either out of an abundance of caution, or because of confusion caused by stray semicolons.
Description
@rwgk @henryiii I went ahead and tried to fix or ignore as many of the performance issues in tests as possible. It's a big PR, but by fixing all the issues in tests or ignoring them explicitly, this should allow us to automatically run the performance checks on CI. Feel free to directly edit this PR if I broke any tests.
I also caught a couple of issues in the core library that weren't caught by the automated fixes earlier.
Types of changes
I was very conservative with what changes I made manually since I didn't want to break any testing behavior.
The changes made are mostly as follows:
Some of the unparameterized nolintnextlines was because changing the class to be a multiline class or adding std::move in the constructor initializer list would break the pygrep pre-commit hook for proper upper/lowercasing.
@rwgk Plenty of tricky decisions, the most common one is not fixing the Cat and Dog classes in tests because it would cause a formatting change that would break the pygrep pre-commit hook. The other tricky decisions was mostly whether to actually fix the pass by value or leave it as a NOLINT. I erred on the side of caution with NOLINT when possible to avoid breaking tests.
Suggested changelog entry: