Diagnose Bare Calls to Unexported Functions in Examples
Source:R/diagnostics-documentation.R
lab_unexported_example_ns.RdFlags an \examples{} block that calls its own topic bare when that topic is
not exported. Examples run with only the package's exports attached, so the
call fails.
Value
checktor_check_result() with passed, issues, message.
Details
R CMD check does catch this, but only by RUNNING the examples, which is late
and slow, and it is skipped entirely when examples are wrapped in \dontrun{}
or when you check with --no-examples. This finds it statically in a second.
Source
No formal rule. An example that reaches for an unexported object will
error when it runs, which is why this sits at robustness tier. See
vignette("check-sources", package = "checktor") for how every check maps to its
source.
Examples
pkg_path <- example_diagnose_scenario("code_examples/tf_usage_bad.R",
show_content = FALSE)
lab_unexported_example_ns(pkg_path, verbose = FALSE)$passed
#> [1] TRUE