From henr|k@bengt@@on @end|ng |rom gm@||@com  Wed Nov  3 01:52:29 2021
From: henr|k@bengt@@on @end|ng |rom gm@||@com (Henrik Bengtsson)
Date: Tue, 2 Nov 2021 17:52:29 -0700
Subject: [Rd] 
 BUG?: R CMD check with --as-cran *disables* checks for unused
 imports otherwise performed
In-Reply-To: <CANBtttbbDsSkgvDseywE3vi7jxcPG6V4Es_JfP7tWZQm4LTyoA@mail.gmail.com>
References: <CAFDcVCQtwySG8HpbOABqoKJ=B7kiQpj57SaU_hzQ=hSWDDa_GA@mail.gmail.com>
 <CANBtttbbDsSkgvDseywE3vi7jxcPG6V4Es_JfP7tWZQm4LTyoA@mail.gmail.com>
Message-ID: <CAFDcVCRtii3+EbXH=rPrvgYF1pGsVdeWApG749r-B8Kmku2OeA@mail.gmail.com>

I've just posted this to BugZilla as PR18229
(https://bugs.r-project.org/show_bug.cgi?id=18229) to make sure it's
tracked.

/Henrik

On Wed, Oct 20, 2021 at 8:08 PM Jeffrey Dick <j3ffdick at gmail.com> wrote:
>
> FWIW, I also encountered this issue and posted on R-pkg-devel about it, with no resolution at the time (May 2020). See "Dependencies NOTE lost with --as-cran" (https://stat.ethz.ch/pipermail/r-package-devel/2020q2/005467.html)
>
> On Wed, Oct 20, 2021 at 11:55 PM Henrik Bengtsson <henrik.bengtsson at gmail.com> wrote:
>>
>> ISSUE:
>>
>> Using 'R CMD check' with --as-cran,
>> set_R_CHECK_PACKAGES_USED_IGNORE_UNUSED_IMPORTS_=TRUE, whereas the
>> default is FALSE, which you get if you don't add --as-cran.
>> I would expect --as-cran to check more things and more be conservative
>> than without.  So, is this behavior a mistake?  Could it be a thinko
>> around the negating "IGNORE", and the behavior is meant to be vice
>> verse?
>>
>> Example:
>>
>> $ R CMD check QDNAseq_1.29.4.tar.gz
>> ...
>> * using R version 4.1.1 (2021-08-10)
>> * using platform: x86_64-pc-linux-gnu (64-bit)
>> ...
>> * checking dependencies in R code ... NOTE
>> Namespace in Imports field not imported from: ?future?
>>   All declared Imports should be used.
>>
>> whereas, if I run with --as-cran, I don't get that NOTE;
>>
>> $ R CMD check --as-cran QDNAseq_1.29.4.tar.gz
>> ...
>> * checking dependencies in R code ... OK
>>
>>
>> TROUBLESHOOTING:
>>
>> In src/library/tools/R/check.R [1], the following is set if --as-cran is used:
>>
>>   Sys.setenv("_R_CHECK_PACKAGES_USED_IGNORE_UNUSED_IMPORTS_" = "TRUE")
>>
>> whereas, if not set, the default is:
>>
>> ignore_unused_imports <-
>> config_val_to_logical(Sys.getenv("_R_CHECK_PACKAGES_USED_IGNORE_UNUSED_IMPORTS_",
>> "FALSE"))
>>
>> [1] https://github.com/wch/r-source/blob/b50e3f755674cbb697a4a7395b766647a5cfeea2/src/library/tools/R/check.R#L6335
>> [2] https://github.com/wch/r-source/blob/b50e3f755674cbb697a4a7395b766647a5cfeea2/src/library/tools/R/QC.R#L5954-L5956
>>
>> /Henrik
>>
>> ______________________________________________
>> R-devel at r-project.org mailing list
>> https://stat.ethz.ch/mailman/listinfo/r-devel



[Rd] BUG?: R CMD check with --as-cran *disables* checks for unused imports otherwise performed
Henrik Bengtsson