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

Bug in devtools::run_examples() devtools_2.0.1 #107

Closed
zellerivo opened this issue Mar 1, 2019 · 5 comments
Closed

Bug in devtools::run_examples() devtools_2.0.1 #107

zellerivo opened this issue Mar 1, 2019 · 5 comments
Labels
bug an unexpected problem or unintended behavior

Comments

@zellerivo
Copy link

run_examples(run= FALSE) does what run_examples(run=TRUE) is actually supposed to do, it comments out code in \dontrun{}.

dschlaep referenced this issue in DrylandEcology/rSFSW2 Mar 11, 2019
- "devtools" v2.0.1 mixed up the logic for "dontrun" examples (see https://github.com/r-lib/devtools/issues/2003); until this is fixed, use `devtools::run_examples(run = FALSE)`

- Note: revert this commit once devtools issue 2003 is fixed
@jimhester jimhester transferred this issue from r-lib/devtools Aug 30, 2019
@jimhester
Copy link
Member

jimhester commented Aug 30, 2019

This is actually a bug in pkgload, these lines should not have ! before them

pkgload/R/dev-example.r

Lines 48 to 50 in 78e7e3a

tools::Rd2ex(path, out = tmp, commentDontrun = !run)
} else {
tools::Rd2ex(path, out = tmp, commentDontrun = !run, commentDonttest = !test)

@salim-b
Copy link

salim-b commented Oct 16, 2019

run_examples(run= FALSE) does what run_examples(run=TRUE) is actually supposed to do, it comments out code in \dontrun{}.

Well, then I guess the same applies to run_examples(test= FALSE).

I.e. run_examples(test= FALSE) does what run_examples(test=TRUE) is actually supposed to do, it comments out code in \donttest{}.

IMHO: The param names run and test are not very well chosen. Actually, the current behaviour (which contradicts the documentation) seems intuitively correct to me.

@kwstat
Copy link

kwstat commented Dec 12, 2019

I'm confused by the wording of the documentation in regards to the run/test arguments. I would like to suggest that the wording be changed to be similar to what is shown by Rcmd check:

Rcmd check --help
      --run-dontrun     do run \dontrun sections in the Rd files
      --run-donttest    do run \donttest sections in the Rd files

Something like this makes more sense to me:

#' @param test if `TRUE`, do run code in \code{\\donttest{}} sections.
#' @param run if `TRUE`, do run code in \code{\\dontrun{}} sections.

@salim-b
Copy link

salim-b commented Dec 12, 2019

Something like this makes more sense to me:

#' @param test if `TRUE`, do run code in \code{\\donttest{}} sections.
#' @param run if `TRUE`, do run code in \code{\\dontrun{}} sections.

Why not:

#' @param run_donttest if `TRUE`, do run code in \code{\\donttest{}} sections.
#' @param run_dontrun if `TRUE`, do run code in \code{\\dontrun{}} sections.

IMHO, the clarity gained would by far outweigh the additional typing required.

@jimhester jimhester added the bug an unexpected problem or unintended behavior label Apr 3, 2020
@lionel-
Copy link
Member

lionel- commented Jun 1, 2022

Fixed by r-lib/devtools#2146 and 3347012.

@lionel- lionel- closed this as completed Jun 1, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug an unexpected problem or unintended behavior
Projects
None yet
Development

No branches or pull requests

5 participants