-
Notifications
You must be signed in to change notification settings - Fork 195
Fix package_hooks_linter to validate .onUnload() arguments
#2964
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
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #2964 +/- ##
=======================================
Coverage 99.24% 99.24%
=======================================
Files 129 129
Lines 7282 7282
=======================================
Hits 7227 7227
Misses 55 55 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
3011d78 to
905bddb
Compare
| rex::rex(".onUnload() should take one argument starting with 'lib'."), | ||
| linter | ||
| ) | ||
| expect_lint( |
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.
use expect_no_lint here
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.
Right, fixed 🙌
|
thanks! basically LGTM. please link the R source of how this is enforced in the PR description for future reference |
Signed-off-by: Emmanuel Ferdman <[email protected]>
905bddb to
c742504
Compare
|
Oh, @emmanuel-ferdman, thanks for the link. Actually, what I had in mind is: But, it turns out that's not currently enforced by |
PR Summary
This PR fixes
package_hooks_linterto properly validate.onUnload()hook signatures. Previously, the linter would silently ignore.onUnload()functions with missing or incorrect arguments, butR CMDcheck requires.onUnload()to take exactly one argument starting with 'lib' (like libpath). The fix adds.onUnloadto the existing argument validation logic that was already checking.onDetach()and.Last.lib().R source reference for
.onUnload(libpath): https://github.com/wch/r-source/blob/97f6c68d5856ecc2257867e89bc870d7e49a8da8/src/library/base/R/namespace.R#L881-L892Fixes #2940.
Related: #2737