Skip to content

Commit eda0bf7

Browse files
transform_lines_utf8() -> transform_utf8() for consistency. Remoce enc dependency completely.
1 parent 284986b commit eda0bf7

File tree

7 files changed

+15
-15
lines changed

7 files changed

+15
-15
lines changed

R/io.R

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,12 @@
77
#' be written back to the file.
88
#' @importFrom magrittr set_names
99
#' @keywords internal
10-
transform_lines_utf8 <- function(path, fun, write_back = TRUE) {
11-
map_lgl(path, transform_lines_utf8_one, fun = fun, write_back = write_back) %>%
10+
transform_utf8 <- function(path, fun, write_back = TRUE) {
11+
map_lgl(path, transform_utf8_one, fun = fun, write_back = write_back) %>%
1212
set_names(path)
1313
}
1414

15-
transform_lines_utf8_one <- function(path, fun, write_back = write_back) {
15+
transform_utf8_one <- function(path, fun, write_back = write_back) {
1616
old <- xfun::read_utf8(path)
1717
tryCatch({
1818
new <- fun(old)

R/testing.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ transform_and_check <- function(in_item, out_item,
110110
transformed_text <- read_in %>%
111111
transformer(...) %>%
112112
unclass()
113-
transformed <- transform_lines_utf8(
113+
transformed <- transform_utf8(
114114
out_item,
115115
function(x) transformed_text,
116116
write_back = write_back

R/transform-code.R

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,19 +4,19 @@
44
#' either R, Rmd or Rnw files by passing the relevant transformer function for each
55
#' case.
66
#'
7-
#' @inheritParams enc::transform_lines_enc
7+
#' @inheritParams transform_utf8
88
#' @param ... Further arguments passed to `enc::transform_lines_enc()`.
99
#' @keywords internal
1010
transform_code <- function(path, fun, ...) {
1111
if (is_plain_r_file(path)) {
12-
transform_lines_utf8(path, fun = fun, ...)
12+
transform_utf8(path, fun = fun, ...)
1313
} else if (is_rmd_file(path)) {
14-
transform_lines_utf8(path,
14+
transform_utf8(path,
1515
fun = partial(transform_mixed, transformer_fun = fun, filetype = "Rmd"),
1616
...
1717
)
1818
} else if (is_rnw_file(path)) {
19-
transform_lines_utf8(path,
19+
transform_utf8(path,
2020
fun = partial(transform_mixed, transformer_fun = fun, filetype = "Rnw"),
2121
...
2222
)

R/transform-files.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ transform_files <- function(files, transformers, include_roxygen_examples) {
3333
#' @param message_after The message to print after the path.
3434
#' @param message_after_if_changed The message to print after `message_after` if
3535
#' any file was transformed.
36-
#' @inheritParams transform_lines_utf8
36+
#' @inheritParams transform_utf8
3737
#' @param ... Further arguments passed to `enc::transform_lines_enc()`.
3838
#' @keywords internal
3939
transform_file <- function(path,

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.

man/transform_lines_utf8.Rd renamed to man/transform_utf8.Rd

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

tests/testthat/test-parsing.R

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@ test_that("repreated parsing solves wrong parent assignment", {
1818
"R -q -e \"styler::style_file(\\\"", path_temp, "\\\")\""
1919
)
2020
calls_sys(sys_call, intern = FALSE, ignore.stdout = TRUE, ignore.stderr = TRUE)
21-
ref <- enc::read_lines_enc(testthat_file("parsing", "repeated_parsing-out.R"))
22-
result <- enc::read_lines_enc(path_temp)
21+
ref <- xfun::read_utf8(testthat_file("parsing", "repeated_parsing-out.R"))
22+
result <- xfun::read_utf8(path_temp)
2323
expect_equal(ref, result)
2424
unlink(dir)
2525
})

0 commit comments

Comments
 (0)