devtools::load_all("~/lehre/goodpractice")
#> Loading goodpractice
url_prep <- make_prep(
name = "desc",
func = function(path, quiet) {
cat("actually calling prep") #!!
desc::description$new(path)
}
)
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")
)
bad1 <- system.file("bad1", package = "goodpractice")
gp(bad1, checks = "no_description_depends",
extra_preps = list("desc" = url_prep),
extra_checks = list("url" = url_chk))
#> Preparing: description
#> ── GP badpackage ──────────────────────────────────────────────────────────
#>
#> It is good practice to
#>
#> ✖ not use "Depends" in DESCRIPTION, as it can cause name
#> clashes, and poor interaction with other packages. Use
#> "Imports" instead.
#> ───────────────────────────────────────────────────────────────────────────
# --> url_prep and url_chk function never got called, missing URL not detected.
# fix:
gp(bad1, checks = c("url", "no_description_depends"),
extra_preps = list("desc" = url_prep),
extra_checks = list("url" = url_chk))
#> Preparing: desc
#> actually calling prep
#> Preparing: description
#> ── GP badpackage ──────────────────────────────────────────────────────────
#>
#> It is good practice to
#>
#> ✖ have a URL field in DESCRIPTION
#> ✖ not use "Depends" in DESCRIPTION, as it can cause name
#> clashes, and poor interaction with other packages. Use
#> "Imports" instead.
#> ───────────────────────────────────────────────────────────────────────────
Created on 2019-08-19 by the reprex package (v0.2.1)