R/safety.R

Defines functions made_by check_made_by made_by_roxygen

made_by_roxygen <- function(path) {
  if (!file.exists(path)) {
    return(TRUE)
  }

  first <- read_lines(path, n = 1)
  check_made_by(first)
}

check_made_by <- function(first) {
  if (length(first) == 0L) {
    return(FALSE)
  }
  grepl("^. Generated by roxygen2", first)
}

made_by <- function(comment) {
  # This text is used by IDE to display a special warning. DO NOT CHANGE
  # without consulting the IDE team
  paste0(comment, " Generated by roxygen2: do not edit by hand\n")
}

Try the roxygen2 package in your browser

Any scripts or data that you put into this service are public.

roxygen2 documentation built on Aug. 5, 2026, 1:06 a.m.