-
Notifications
You must be signed in to change notification settings - Fork 192
Open
Milestone
Description
The default for the r_version
argument of backport_linter()
is getRversion()
, which, in most case, won't provide any useful insights.
A possibly better default in the case of R package, or any project with a DESCRIPTION
file, would be to extract the stated minimum R version and use it.
This means that backport_linter()
would now automatically warn you if you use a function that has been defined in an earlier R version that what you declared in DESCRIPTION
.
This can be done with a handful of base R function:
depends <- read.dcf("DESCRIPTION", "Depends")
depends_list <- trimws(unlist(strsplit(",")))
depends_r <- grep("R ", depends_list, value = TRUE)
min_r_version <- gsub("^R \\(>=?\\s(.+)\\)", "\\1", depends_r)
An alternative that seems less generic but still more informative than the default could be to use the tidyverse policy of supporting oldrel-4
. This can make sense since the rest of the lintr already defaults to the tidyverse policy.