Runs R CMD check on the package and extracts every
no visible binding for global variable and no visible global function
note. Use fix_globals() to print or write the corresponding
globalVariables() block. Wraps get_no_visible().
audit_globals(pkg = ".", checks = NULL)Path to the package to audit.
Optional. A pre-computed rcmdcheck::rcmdcheck() result
(a list with at least a notes element). When supplied, audit_globals()
reuses it instead of re-running R CMD check on pkg. Useful to share
a single check between audit_globals() and fix_globals().
A list with three tibbles, globalVariables, functions
and operators, or NULL if the package has no global notes.
globalVariables collects names that need a
utils::globalVariables() declaration; functions collects
external functions to import via @importFrom; operators
collects NSE tokens / data.table / rlang pronouns (:=,
.SD, .data, !!, ...) that also need @importFrom rather
than a globalVariables() entry.
if (FALSE) { # \dontrun{
pkg <- create_example_pkg()
# One-shot:
audit_globals(pkg)
# Shared check (avoid running R CMD check twice):
chk <- rcmdcheck::rcmdcheck(pkg)
audit_globals(pkg, checks = chk)
fix_globals(pkg, checks = chk)
} # }