Open
Description
R CMD check
, calls codetools::checkUsageEnv
, which calls codetools::checkUsage
, which calls codetools::collectUsage
with a bunch of arguments set (that's where all the work happens). The key function appears to be codetools:::checkUsageEnterGlobal()
:
function (type, n, e, w)
{
if (type == "function") {
if (exists(n, envir = w$globalenv, mode = "function")) {
def <- get(n, envir = w$globalenv, mode = "function")
if (typeof(def) == "closure")
checkCall(def, e, function(m) w$signal(m, w))
else {
isBuiltin <- typeof(def) == "builtin"
checkPrimopCall(n, e, isBuiltin, function(m) w$signal(m,
w))
}
}
else if (!suppressVar(n, w$suppressUndefined))
w$signal(paste("no visible global function definition for",
sQuote(n)), w)
}
else if (type == "variable") {
if (!exists(n, w$globalenv) && !suppressVar(n, w$suppressUndefined))
w$signal(paste("no visible binding for global variable",
sQuote(n)), w)
}
else if (type == "<<-") {
if (!exists(n, w$globalenv))
w$signal(paste("no visible binding for '<<-' assignment to",
sQuote(n)), w)
}
}
But I think that's too far down the tree in order to be able to special case tidy-evaluation using functions.
The handlers for special base R functions are stored in environment codetools:::collectUsageHandler
, so one possible last resort hack would be to register handlers these on load if R CMD check
is running.