Skip to contents

Flags an example, vignette or demo that changes options(), par() or the working directory without putting it back. A reader who runs the example is left with a session that behaves differently afterwards.

Usage

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

Arguments

path

Character. Path to the package directory. Default: ".".

verbose

Logical. Print diagnostic output. Default: TRUE.

Value

checktor_check_result() with passed, issues, message.

Source

The CRAN Cookbook covers this under Change of Options, Graphical Parameters and Working Directory, and the rejection reads "Please always make sure to reset to user's options(), working directory or par() after you changed it in examples and vignettes and demos." See vignette("check-sources", package = "checktor") for how every check maps to its source.

See also

checktor(), lab_option_changes() for the same rule in R/.

Examples

pkg <- example_diagnose_scenario("code_examples/tf_usage_bad.R",
                                 show_content = FALSE)
lab_example_state(pkg, verbose = FALSE)$passed
#> [1] TRUE