rcmdcheck icon indicating copy to clipboard operation
rcmdcheck copied to clipboard

Ability to ignore checks set by `--as-cran`

Open jimhester opened this issue 2 years ago • 2 comments

Using args = '--as-cran' sets the environment variables during the check (https://github.com/wch/r-source/blob/722824a89bcc9bcd6848abcb80ce4f7f21246e1b/src/library/tools/R/check.R#L6430-L6510) so any variables set in tools/check.env` are ignored.

This makes using tools/check.env less useful then it otherwise would be.

I don't know if there is anything the package could do to change this behavior, but possibly what it could provide is a way to set the equivalent of --as-cran in envvars, which then could be overriden.

Maybe based off of https://svn.r-project.org/R-dev-web/trunk/CRAN/QA/Kurt/.R/check_CRAN_regular.Renviron so it remains updated with at least some of the checks used on the check machines?

jimhester avatar Apr 14 '22 16:04 jimhester

Those are not necessarily the same as --as-cran, though, and it is also only one cran machine. There is a good chance that we would be creating yet another check configuration, that is different than anything else.

I am also not sure if --as-cran only sets env vars. We might not be able to emulate exactly what it does via env vars only. But assuming that it only sets env vars, we could run a quick check for a very small package, record all R-related env vars, and then use them for the real check. So this would be always equivalent to --as-cran (in terms of env vars), but you could still tweak it.

gaborcsardi avatar Apr 15 '22 07:04 gaborcsardi

Most of what --as-cran does is here https://github.com/wch/r-source/blob/722824a89bcc9bcd6848abcb80ce4f7f21246e1b/src/library/tools/R/check.R#L6430-L6503, though there are a a few other places that explicitly check for the as_cran variable.

I agree there is no perfect solution, other than maybe doing post-check filtering of the outputs, which would be more complicated to implement and maintain.

Alternatively maybe we could convince R core to tweak that code to check for the existence of the envvar in all cases, rather than only in some like it does now.

jimhester avatar Apr 15 '22 14:04 jimhester

It seems really hard to implement this in a way that works for all R versions, and in a way that we can keep current. So I am going to close it now. FWIW we now have the ability to ignore checks, that probably helps with the original problem.

gaborcsardi avatar Nov 01 '23 09:11 gaborcsardi