tests/testthat/setup-linting.R

pkgname <- "DENR"
lint_path <- path.expand(normalizePath(getwd(), winslash = "/"))

find_root <- function(path, pkgname) {
  if ("DESCRIPTION" %in% dir(path)) {
    return(path.expand(normalizePath(path, winslash = "/")))
  } else if ("00_pkg_src" %in% dir(path)) {
    path <- file.path(path, "00_pkg_src", pkgname)
    return(path.expand(normalizePath(path, winslash = "/")))
  } else {
    find_root(dirname(path), pkgname)
  }
}

lint_path <- find_root(lint_path, pkgname)
CshlSiepelLab/DENR documentation built on July 16, 2021, 10:42 p.m.