Skip to content

Commit bfddf48

Browse files
Merge pull request #245 from lorenzwalthert/master
- hotfix: utf8 should not be verbose (#245).
2 parents 997336d + 87c3ae4 commit bfddf48

File tree

3 files changed

+9
-6
lines changed

3 files changed

+9
-6
lines changed

R/style_rmd.R

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,13 @@
66
#'
77
#' @inheritParams utf8::transform_lines_enc
88
#' @param ... Further arguments passed to `utf8::transform_lines_enc()`.
9-
transform_code <- function(path, fun, verbose, ...) {
9+
transform_code <- function(path, fun, verbose = FALSE, ...) {
1010
if (grepl("\\.R$", path, ignore.case = TRUE)) {
11-
utf8::transform_lines_enc(path, fun = fun, ...)
11+
utf8::transform_lines_enc(path, fun = fun, ..., verbose = verbose)
1212
} else if (grepl("\\.Rmd$", path, ignore.case = TRUE)) {
13-
utf8::transform_lines_enc(path, fun = partial(transform_rmd, transformer_fun = fun), ...)
13+
utf8::transform_lines_enc(
14+
path, fun = partial(transform_rmd, transformer_fun = fun), ...,
15+
verbose = verbose)
1416
} else {
1517
stop(path, " is not an R or Rmd file")
1618
}

man/transform_code.Rd

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

tests/testthat/test-public_api.R

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,10 @@ test_that("styler can style Rmd file", {
3434
expect_false(
3535
style_file(testthat_file("public-api", "xyzfile_rmd", "random.Rmd"), strict = FALSE)
3636
)
37-
expect_false(
38-
style_file(testthat_file("public-api", "xyzfile_rmd", "random2.Rmd"), strict = FALSE)
37+
expect_warning(
38+
styled <- style_file(testthat_file("public-api", "xyzfile_rmd", "random2.Rmd"), strict = FALSE)
3939
)
40+
expect_false(styled)
4041
})
4142

4243
test_that("styler handles malformed Rmd file and invalid R code in chunk", {

0 commit comments

Comments
 (0)