Diagnose Interactive Examples Wrapped in \\dontrun{}
Source: R/diagnostics-examples.R
lab_example_interactive.RdFlags an \\examples{} block that hides an interactive function behind
\\dontrun{}. CRAN asks for if (interactive()) instead, so a reader can see
the function is not meant for a script rather than only that it does not run.
Value
checktor_check_result() with passed, issues, message.
Source
The CRAN Cookbook covers this under
Structuring of Examples,
and the rejection reads "Functions which are supposed to only run interactively
(e.g. shiny) should be wrapped in if(interactive()). Please replace \dontrun
with if(interactive()) if possible". See
vignette("check-sources", package = "checktor") for how every check maps to its
source.
Examples
pkg <- example_diagnose_scenario("code_examples/tf_usage_bad.R",
show_content = FALSE)
lab_example_interactive(pkg, verbose = FALSE)$passed
#> [1] TRUE