[Rd] Unnecessary note when import only used in arg definition
Antoine Fabri
@nto|ne@|@br| @end|ng |rom gm@||@com
Mon Feb 6 15:42:51 CET 2023
Dear r-devel,
When a package is only used in an argument definition, e.g :
f <- function(test = testthat::is_testing()) {
if (test) 1 else 2
}
R CMD CHECK gives us a note: "Namespace in Imports field not imported from:
'testthat'"
This incites me to remove the package from the Imports field but that'll
make my package brittle.
I noted I'm not the first one having the issue (
https://github.com/r-lib/devtools/issues/2456 ) and I've seen some
workarounds too, in particular Hadley Wickham suggests in 'R packages' to
use the following construct :
ignore_unused_imports <- *function*() {
aaapkg::aaa_fun
}
That's far from obvious though, and not very satisfying.
Are there any downside to removing this note in this scenario? it makes
little sense to me and incites wrong behaviour AFAIU.
Thanks,
Antoine
[[alternative HTML version deleted]]
More information about the R-devel
mailing list