-
Notifications
You must be signed in to change notification settings - Fork 41
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 support for tests and extensibility #237
Conversation
Hello. You may have forgotten to update the changelog!
|
Codecov Report
@@ Coverage Diff @@
## master #237 +/- ##
=======================================
Coverage 99.70% 99.70%
=======================================
Files 4 4
Lines 344 344
=======================================
Hits 343 343
Misses 1 1
Continue to review full report at Codecov.
|
Hi @mlxd, it seems like the current error is due to several unused parameters/variables. In the previous version, I have just suppressed those warnings (only for tests codes) by pennylane-lightning/pennylane_lightning/src/tests/CMakeLists.txt Lines 43 to 45 in 2cb2727
|
Thanks @chaeyeunpark . I have added the casts to get over the failures for now. As discussed, we can look at adapting this to another structure later on. |
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.
Thanks @mlxd for fixing these issues.
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.
Hi @mlxd, thanks for dealing with this problem. Could you just check one thing here? If clang-tidy
still complains about it, let's just remove this whole function (it anyway does nothing now...).
gate_op>::value == nullptr) { | ||
return false; | ||
} | ||
} |
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.
Could you check clang-tidy
still raises errors with these lines? Basically, this template function tests whether GateOpMemberFuncPtr
is well defined (in a compile-time). If it is well-defined, as clang-tidy-11
says, it cannot be nullptr
. Otherwise, it raises a compile-time error.
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.
Hey @chaeyeunpark
Ah, I understand your intention now. Yea, I was getting errors with these locally, and removed them based on the clang-tidy feedback. I'll re-add and retest with the act
package, and if so we can leave them as deleted for now.
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.
Huh, seems to be passing now (weird, may have been a version issue locally). I'll re-add this in and push it back up. Sorry for the confusion.
Update: scratch that, fails locally on clang-tidy-13
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 will do some tests with different environments to see if this is an easy mitigation.
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.
As it cannot be nullptr
anyway, I think replacing the internal if statement just to
static_cast<void>(GateOpToMemberFuncPtr<PrecisionT, ParamT, GateImplemenation, gate_op>::value);
will work (for clang-tidy-13
).
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.
Hey @chaeyeunpark sorry for taking so long to get back to this. That above suggestion does indeed fix the clang-tidy-13 complaint! Thanks for the suggestion.
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.
Good!
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.
Happy to approve this 👍
gate_op>::value == nullptr) { | ||
return false; | ||
} | ||
} |
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.
Good!
Thanks @chaeyeunpark & @maliasadi |
Context: This closes #236 and #235
Description of the Change: Clang-tidy is enabled for CI tests in the formatter action, and subsequent clang-tidy suggestions are applied. Also, The return type for data is modified to become auto-definable at compile time.
Benefits:
Possible Drawbacks:
Related GitHub Issues: