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

fix documentation of default values for on_error parameter #2529

Closed
wants to merge 1 commit into from

Conversation

jan-glx
Copy link

@jan-glx jan-glx commented Jul 29, 2023

Currently the documentation for devtools::check's on_error parameter reads as inherited from rcmdcheck::rcmdcheck:

Whether to throw an error on R CMD check failures. Note that the check is always completed (unless a timeout happens), and the error is only thrown after completion. If "never", then no errors are thrown. If "error", then only ERROR failures generate errors. If "warning", then WARNING failures generate errors as well. If "note", then any check failure generated an error. Its default can be modified with the RCMDCHECK_ERROR_ON environment variable. If that is not set, then "never" is used.

However, devtools already sets the default to "never" (for interactive session) or "warning" (for non-nteractive sessions) according to:

check <- function(pkg = ".",

error_on = c("never", "error", "warning", "note")) {

devtools/R/check.R

Lines 82 to 85 in 2c642ab

if (missing(error_on) && !interactive()) {
error_on <- "warning"
}
error_on <- match.arg(error_on)

This PR copies the description to of on_error to devtools::check and fixes the description of this default behavior.

@jan-glx
Copy link
Author

jan-glx commented Jul 29, 2023

A potentially cleaner alternative could be to set the default for on_error to if(interactive()) "never" else "warning" within the function's formals, while leaving the error checking (the match.arg call) to rcmdcheck::rcmdcheck.

@jennybc
Copy link
Member

jennybc commented Nov 2, 2023

Sorry I just did a fix for this myself, because I didn't realize this PR was here. Next time if you refer to the associated issue using the Magic Syntax, it will create a link and make these things much easier for others to discover.

Thanks for the PR anyway!

https://code-review.tidyverse.org/author/submitting.html#sec-github-features

@jennybc jennybc closed this in #2541 Nov 2, 2023
@jan-glx
Copy link
Author

jan-glx commented Nov 3, 2023

Of course! - did not realize there was an open issue about this... your solution referencing rcmdcheck::rcmdcheck documentation is better anyways!

@jan-glx jan-glx deleted the patch-1 branch November 3, 2023 08:08
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.

2 participants