Skip to content

Commit 6fefe71

Browse files
Merge branch 'main' into split-test
2 parents e0b42aa + 940010d commit 6fefe71

File tree

12 files changed

+385
-71
lines changed

12 files changed

+385
-71
lines changed

R/addins.R

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ set_style_transformers <- function() {
157157
current_style
158158
)
159159
if (!is.null(new_style)) {
160-
parsed_new_style <- rlang::with_handlers(
160+
parsed_new_style <- rlang::try_fetch(
161161
{
162162
transformers <- eval(parse(text = new_style))
163163
style_text(
@@ -208,7 +208,7 @@ communicate_addins_style_transformers <- function() {
208208
#' [make_transformer()].
209209
#' @keywords internal
210210
try_transform_as_r_file <- function(context, transformer) {
211-
rlang::with_handlers(
211+
rlang::try_fetch(
212212
transformer(context$contents),
213213
error = function(e) {
214214
preamble_for_unsaved <- paste(

R/io.R

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ transform_utf8 <- function(path, fun, dry) {
2020
#' @keywords internal
2121
transform_utf8_one <- function(path, fun, dry) {
2222
rlang::arg_match(dry, c("on", "off", "fail"))
23-
rlang::with_handlers(
23+
rlang::try_fetch(
2424
{
2525
file_with_info <- read_utf8(path)
2626
# only write back when changed OR when there was a missing newline
@@ -70,7 +70,7 @@ transform_utf8_one <- function(path, fun, dry) {
7070
#' @param path A path to a file to read.
7171
#' @keywords internal
7272
read_utf8 <- function(path) {
73-
out <- rlang::with_handlers(
73+
out <- rlang::try_fetch(
7474
read_utf8_bare(path),
7575
warning = function(w) w,
7676
error = function(e) e

R/parse.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
#'
1616
#' styler:::parse_safely("a + 3 -4 -> \n glück + 1")
1717
parse_safely <- function(text, ...) {
18-
tried_parsing <- rlang::with_handlers(
18+
tried_parsing <- rlang::try_fetch(
1919
parse(text = text, ...),
2020
error = function(e) e,
2121
warning = function(w) w

R/roxygen-examples-parse.R

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ parse_roxygen <- function(roxygen) {
6666
#' )
6767
#' @keywords internal
6868
roxygen_remove_extra_brace <- function(parsed) {
69-
parsed <- rlang::with_handlers(
69+
parsed <- rlang::try_fetch(
7070
{
7171
parse(text = paste0(gsub("^\\\\[[:alpha:]]*", "", parsed), collapse = ""))
7272
parsed
@@ -92,7 +92,7 @@ roxygen_remove_extra_brace <- function(parsed) {
9292
parsed <- parsed[-last(linebreak)]
9393
}
9494
# try if can be parsed (need remve dontrun)
95-
worth_trying_to_remove_brace <- rlang::with_handlers(
95+
worth_trying_to_remove_brace <- rlang::try_fetch(
9696
{
9797
# this will error informatively
9898
parse(text = gsub("^\\\\[[:alpha:]]+", "", parsed))

R/roxygen-examples.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ style_roxygen_code_example_one <- function(example_one,
3535
) %>%
3636
flatten_chr()
3737
if (bare$example_type == "examplesIf") {
38-
rlang::with_handlers(
38+
rlang::try_fetch(
3939
parse_text(unmasked[1L]),
4040
error = function(e) {
4141
abort(paste0(

R/transform-files.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -413,7 +413,7 @@ parse_tree_must_be_identical <- function(transformers) {
413413
#' @keywords internal
414414
verify_roundtrip <- function(old_text, new_text, parsable_only = FALSE) {
415415
if (parsable_only) {
416-
rlang::with_handlers(
416+
rlang::try_fetch(
417417
parse_safely(new_text),
418418
error = function(e) {
419419
rlang::abort(paste0(

tests/testthat/curly-curly/mixed-in_tree

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

tests/testthat/indention_operators/eq_formals_complex_indention-in_tree

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

tests/testthat/roxygen-examples-complete/27-no-code-block-after-example-in_tree

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

tests/testthat/roxygen-examples-complete/28-end-not-blank-in_tree

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

0 commit comments

Comments
 (0)