Skip to contents

Walks \examples{} sections via tools::parse_Rd() and flags \dontrun{} subtrees that don't appear to have a justifying reason (interactive, network, credentials, long-running, etc.).

Usage

lab_example_structure(path = ".", verbose = TRUE)

Arguments

path

Character. Path to package directory

verbose

Logical. Print diagnostic messages

Value

checktor_check_result() with passed, issues, message.

Source

The CRAN Cookbook covers this under Structuring of Examples. \dontrun{} should wrap only code that genuinely cannot run inside a check, a convention rather than a rule, which is why this sits at opinion tier. See vignette("check-sources", package = "checktor") for how every check maps to its source.

Examples

pkg <- example_diagnose_scenario("documentation_examples/example_structure_bad.Rd",
                                 show_content = FALSE)
lab_example_structure(pkg, verbose = FALSE)$issues
#> [1] "example_structure_bad.Rd: potential unnecessary \\dontrun{}"
unlink(pkg, recursive = TRUE)