From murdoch@dunc@n @end|ng |rom gm@||@com  Tue Feb  7 16:22:17 2023
From: murdoch@dunc@n @end|ng |rom gm@||@com (Duncan Murdoch)
Date: Tue, 7 Feb 2023 10:22:17 -0500
Subject: [Rd] Unnecessary note when import only used in arg definition
In-Reply-To: <CAEKh8ujzyH=Lhd49yc58=1Q4MxiGbjFpfQ13Rp+dEUQFA0Yr8g@mail.gmail.com>
References: <CAEKh8ujzyH=Lhd49yc58=1Q4MxiGbjFpfQ13Rp+dEUQFA0Yr8g@mail.gmail.com>
Message-ID: <c1d26ab3-55ae-b8ba-0a5d-ff7454d94db5@gmail.com>

I've submitted a bug report 
(https://bugs.r-project.org/show_bug.cgi?id=18465) about this, along 
with a patch to fix it.

Duncan Murdoch

On 06/02/2023 9:42 a.m., Antoine Fabri wrote:
> 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]]
> 
> ______________________________________________
> R-devel at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel



[Rd] Unnecessary note when import only used in arg definition
Duncan Murdoch