Skip to content

Conversation

tanho63
Copy link

@tanho63 tanho63 commented Sep 19, 2025

Closes #172 - prints _R_CHECK_*, NOT_CRAN, and other related rcmdcheck envvars.

R> rcmdcheck::rcmdcheck("tests/testthat/bad1")
── R CMD build ───────────────────────────────────────────────────────────────────────────────
pdflatex not found! Not building PDF manual.
✔  checking for file ‘.../DESCRIPTION’ ...
─  preparing ‘badpackage’:
✔  checking DESCRIPTION meta-information
─  installing the package to build vignettes
✔  creating vignettes (1.4s)
─  checking for LF line-endings in source and make files and shell scripts (351ms)
─  checking for empty or unneeded directories
─  building ‘badpackage_1.0.0.tar.gz’
   
── R CMD check ───────────────────────────────────────────────────────────────────────────────

─ R CMD check env vars set:
• _R_CHECK_PKG_SIZES_THRESHOLD_ = 142
R> rcmdcheck::rcmdcheck("tests/testthat/bad2")
── R CMD build ───────────────────────────────────────────────────────────────────────────────
pdflatex not found! Not building PDF manual.
✔  checking for file ‘.../DESCRIPTION’ ...
─  preparing ‘badpackage’:
✔  checking DESCRIPTION meta-information ...
─  checking for LF line-endings in source and make files and shell scripts
─  checking for empty or unneeded directories
─  building ‘badpackage_1.0.0.tar.gz’
   
── R CMD check ───────────────────────────────────────────────────────────────────────────────

─ No R CMD check env vars set
─  using log directory ‘/tmp/RtmptQxJYO/file111243a95c5f9/badpackage.Rcheck’

@tanho63 tanho63 marked this pull request as ready for review September 19, 2025 16:11
cat_line()
all_vars <- Sys.getenv()
rchk_vars <- all_vars[
grep("_R_CHECK|NOT_CRAN|RCMDCHECK|R_TESTS", names(all_vars))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you could just print _R_CHECK var here — the idea is that devtools prints the env vars that it sets; rcmdcheck prints all the env vars that affect the operation of R CMD check, regardless of how they've been setting.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was thinking that it looked a little duplicative when called from devtools::check() and that we could let it all be handled by rcmdcheck? Here's what it looks like when you call devtools::check() with the PR rcmdcheck + release version devtools (note that it reprints the same variables, basically):

R> devtools::check("~/_nflverse/nflreadr")
══ Documenting ══════════════════════════════════════════════════════════════════════════════
ℹ Updating nflreadr documentation
ℹ Loading nflreadr

══ Building ═════════════════════════════════════════════════════════════════════════════════
Setting env vars:
• CFLAGS    : -Wall -pedantic -fdiagnostics-color=always
• CXXFLAGS  : -Wall -pedantic -fdiagnostics-color=always
• CXX11FLAGS: -Wall -pedantic -fdiagnostics-color=always
• CXX14FLAGS: -Wall -pedantic -fdiagnostics-color=always
• CXX17FLAGS: -Wall -pedantic -fdiagnostics-color=always
• CXX20FLAGS: -Wall -pedantic -fdiagnostics-color=always
── R CMD build ──────────────────────────────────────────────────────────────────────────────
✔  checking for file ‘/home/tan/_nflverse/nflreadr/DESCRIPTION’ ...
─  preparing ‘nflreadr’:
✔  checking DESCRIPTION meta-information ...
─  installing the package to build vignettes
✔  creating vignettes (7s)
─  checking for LF line-endings in source and make files and shell scripts (591ms)
─  checking for empty or unneeded directories
─  building ‘nflreadr_1.5.0.tar.gz’
   
══ Checking ═════════════════════════════════════════════════════════════════════════════════
Setting env vars:
• _R_CHECK_CRAN_INCOMING_USE_ASPELL_           : TRUE
• _R_CHECK_CRAN_INCOMING_REMOTE_               : FALSE
• _R_CHECK_CRAN_INCOMING_                      : FALSE
• _R_CHECK_FORCE_SUGGESTS_                     : FALSE
• _R_CHECK_PACKAGES_USED_IGNORE_UNUSED_IMPORTS_: FALSE
• NOT_CRAN                                     : true
── R CMD check ──────────────────────────────────────────────────────────────────────────────

─ R CMD check env vars set:
• _R_CHECK_CRAN_INCOMING_                       = FALSE
• _R_CHECK_CRAN_INCOMING_REMOTE_                = FALSE
• _R_CHECK_CRAN_INCOMING_USE_ASPELL_            = TRUE
• _R_CHECK_FORCE_SUGGESTS_                      = FALSE
• _R_CHECK_PACKAGES_USED_IGNORE_UNUSED_IMPORTS_ = FALSE
• NOT_CRAN                                      = true

My initial instinct was to make printing the envvars that relate to checking all get printed by rcmdcheck (even if set by devtools or otherwise), so also made a corresponding PR to remove the printing by devtools r-lib/devtools#2621

Copy link
Author

@tanho63 tanho63 Sep 26, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

as for the RCMDCHECK / R_TESTS grep patterns, I did a search through the rcmdcheck codebase for Sys.getenv https://github.com/search?q=repo%3Ar-lib%2Frcmdcheck%20Sys.getenv&type=code and saw those two patterns being referred to in a handful of places, figured they might as well get printed

Copy link
Author

@tanho63 tanho63 Sep 26, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(I'm happy to change to "just" the _R_CHECK ones if we have a stronger preference to have devtools print the vars set by devtools, just explaining the original rationale)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we had this, we'd drop the R_CHECK_ printing in devtools, but still set the other envvars.

rcmdcheck is used in other places apart from devtools, so the goals are a little different — here I'm worried more about env vars that are set elsewhere (i.e. not by devtools). We can also wait for Gabor to take a look.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we had this, we'd drop the R_CHECK_ printing in devtools, but still set the other envvars.

Yeah, I think that's what I tried to implement here (maybe worth eyeballing to confirm?) https://github.com/r-lib/devtools/pull/2621/files

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Report _R_CHECK_ env vars

2 participants