Skip to content
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

Surface unused imports with check(cran = TRUE) #2461

Merged
merged 2 commits into from
Aug 11, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# devtools (development version)

* `check(cran = TRUE)` sets the env var
`_R_CHECK_PACKAGES_USED_IGNORE_UNUSED_IMPORTS_` to `FALSE`, in order to
surface the `"Namespace in Imports field not imported from"` NOTE. This only
applies to R >= 4.2, due to favorable changes in the behaviour of
`R CMD check --as-cran` (#2459).

* `check(check_dir = NULL)` is the new default, to align with the default
behaviour of the underlying `rcmdcheck::rcmdcheck()`.

Expand Down
8 changes: 7 additions & 1 deletion R/check.R
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,9 @@ can_document <- function(pkg) {
#' @rdname check
#' @param path Path to built package.
#' @param cran if `TRUE` (the default), check using the same settings as CRAN
#' uses.
#' uses. Because this is a moving target and is not uniform across all of
#' CRAN's machine, this is on a "best effort" basis. It is more complicated
#' than simply setting `--as-cran`.
#' @param remote Sets `_R_CHECK_CRAN_INCOMING_REMOTE_` env var. If `TRUE`,
#' performs a number of CRAN incoming checks that require remote access.
#' @param incoming Sets `_R_CHECK_CRAN_INCOMING_` env var. If `TRUE`, performs a
Expand Down Expand Up @@ -188,6 +190,10 @@ check_built <- function(path = NULL, cran = TRUE,

if (cran) {
args <- c("--as-cran", args)
env_vars <- c(
"_R_CHECK_PACKAGES_USED_IGNORE_UNUSED_IMPORTS_" = as.character(FALSE),
env_vars
)
}
if (run_dont_test) {
args <- c("--run-donttest", args)
Expand Down
4 changes: 3 additions & 1 deletion man/check.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.