Skip to content

Commit afe8879

Browse files
committed
making updates as per lorenzwalthert
1 parent 1ea8f36 commit afe8879

File tree

4 files changed

+6
-22
lines changed

4 files changed

+6
-22
lines changed

API

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ open_config(root = here::here())
1111
open_wordlist(root = here::here())
1212
path_pre_commit_exec(check_if_exists = TRUE)
1313
path_precommit_exec(check_if_exists = TRUE)
14+
precommit_docopt(doc, args = commandArgs(trailingOnly = TRUE), ...)
1415
robust_purl(path)
1516
roxygen_assert_additional_dependencies()
1617
roxygenize_with_cache(key, dirs)

R/testing.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ hook_state_create <- function(tempdir,
149149

150150
# quote any individual filenames with spaces so the shell identifies them
151151
# each as a single term
152-
files <- ifelse( grepl(' ', files), shQuote(files), files)
152+
files <- shQuote(files)
153153

154154
system2(paste0(Sys.getenv("R_HOME"), "/bin/Rscript"),
155155
args = as.character(c(path_executable, cmd_args, files)),

R/utils.R

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -89,14 +89,14 @@ git_init <- function(path = ".") {
8989
#' than an array/vector, and so this function wraps docopt
9090
#' to
9191
#'
92-
#' @param doc \code{character} vector with command line specification
93-
#' @param args \code{character} vector of commandline arguments.
94-
#' Defaults to \code{commandArgs(trailingOnly=TRUE)}.
92+
#' @param doc `character` vector with command line specification
93+
#' @param args `character` vector of commandline arguments.
94+
#' Defaults to `commandArgs(trailingOnly=TRUE)`.
9595
#' @param ... Additional parameters passed to `docopt`
9696
#' @family hook script helpers
9797
#' @keywords internal
9898
#' @export
99-
precommit_docopt <- function(doc, args = commandArgs(trailingOnly=TRUE), ...) {
99+
precommit_docopt <- function(doc, args = commandArgs(trailingOnly = TRUE), ...) {
100100
docopt::docopt(doc, c(args, ""), ...)
101101
}
102102

tests/testthat/test-hooks.R

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -232,23 +232,6 @@ run_test(
232232
)
233233

234234

235-
# verify that functions that use docopt without arguments function as
236-
# expected with filenames that contain spaces
237-
238-
run_test("parsable-R",
239-
file_name = "parsable R with spaces",
240-
suffix = "-success.R",
241-
std_err = NULL
242-
)
243-
244-
run_test("parsable-R",
245-
file_name = "parsable R with spaces",
246-
suffix = "-fail.R",
247-
std_out = "Full context",
248-
std_err = "1 1"
249-
)
250-
251-
252235
### . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ..
253236
### spell-check ####
254237
# success

0 commit comments

Comments
 (0)