goodpractice (version 1.0.2)

make_prep: Create a preparation function

Description

Create a preparation function

Usage

make_prep(name, func)

Arguments

name

Name of the preparation function.

func

A function that takes two arguments: The path to the root directory of the package, and a logical argument: quiet. If quiet is true, the preparation function may print out diagnostic messages.

Examples

Run this code
# NOT RUN {
# make a preparation function
url_prep <- make_prep(
  name = "desc", 
  func = function(path, quiet) desc::description$new(path)
)
# and the corresponding check function
url_chk <- make_check(
  description = "URL field in DESCRIPTION",
  tags = character(),
  preps = "desc",
  gp = "have a URL field in DESCRIPTION",
  check = function(state) state$desc$has_fields("URL")
)
# use together in gp()
bad1 <- system.file("bad1", package = "goodpractice")
res <- gp(bad1, checks = "no_description_depends",
          extra_preps = list("desc" = url_prep),
          extra_checks = list("url" = url_chk))
# }

Run the code above in your browser using DataLab