-
Notifications
You must be signed in to change notification settings - Fork 184
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
min_r_version_linter()
to detect invalid or missing minimum R version in R package
#2576
Comments
Funny, I just filed r-lib/rcmdcheck#220 yesterday. I'm not seeing how this works as an R linter though, isn't this a DESCRIPTION linter? But then it's out of scope: #889 |
Can we please relitigate this? We do support a class of linters that are designed for package development and, given that it's the DESCRIPTION file that turns a folder into package, I think linting its contents could also fall under the purview of lintr. |
This really seems like more trouble than it's worth to me. If we were to support linting DESCRIPTION files, this would need to be supported in |
Hmm, yeah, I see what you mean. We probably need to outsource this either to another package (e.g. |
Should I create an issue to scope out This would actually be a good candidate for GitHub Discussions. |
Borrowing from Hadley: library(dplyr, warn.conflicts = FALSE)
library(purrr)
deps <- pak::pkg_deps("lintr", upgrade = TRUE)
#> ℹ Loading metadata database
#> ✔ Loading metadata database ... done
deps$deps |>
set_names(deps$package) |>
map(\(df) df |> filter(ref == "R") |> select(version)) |>
list_rbind(names_to = "package") |>
arrange(desc(package_version(version))) |>
head(1L)
#> # A data frame: 1 × 2
#> package version
#> * <chr> <chr>
#> 1 evaluate 4.0.0 Created on 2024-06-25 with reprex v2.1.0 |
The problem is explained quite well through this example: rvlenth/emmeans#489
With the precedent of the cyclocomp linter, we can now introduce linters that use a suggested dependency, and I think this would come in handy here. In particular, I think the dependency solver in
{pkgdepends}
can be quite helpful to figure out the correct minimum needed R version.Of course, this is going to detect the minimum required R version only by looking at the dependency graph. Figuring that out by checking if any newer R functions are used would be a more challenging task, and I don't consider that to be in the scope of this issue.
WDYT?
The text was updated successfully, but these errors were encountered: