r-lib / devtools

Tools to make an R developer's life easier
https://devtools.r-lib.org
Other
2.37k stars 755 forks source link

Provide helper for missing returns/examples #2525

Open hadley opened 11 months ago

hadley commented 11 months ago
path <- dir("man", pattern = "\\.Rd$", full.names = TRUE)
rd <- lapply(path, tools::parse_Rd, permissive = TRUE)

has_tag <- function(x, tag) {
  tags <- unlist(lapply(x, attr, "Rd_tag"))
  any(tags %in% paste0("\\", tag))
}

path[sapply(rd, \(x) !has_tag(x, "value"))]
path[sapply(rd, \(x) !has_tag(x, "examples"))]

Not sure where this should live.