Skip to content

Commit a89eeb5

Browse files
committed
Correct cli abort calls
1 parent b6a535f commit a89eeb5

File tree

5 files changed

+15
-14
lines changed

5 files changed

+15
-14
lines changed

R/addins.R

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ style_active_file <- function() {
6868
} else if (is_r_file) {
6969
out <- try_transform_as_r_file(context, transformer)
7070
} else {
71-
abort("Can only style .R, .Rmd and .Rnw files.")
71+
abort("Can only style .R, .qmd, .Rmd, and .Rnw files.")
7272
}
7373
rstudioapi::modifyRange(
7474
c(1L, 1L, length(context$contents) + 1L, 1L),
@@ -98,10 +98,10 @@ save_after_styling_is_active <- function() {
9898
op_new <- getOption("styler.save_after_styling", default = "")
9999
if (!is.na(op_old)) {
100100
rlang::warn(paste(
101-
"Using the environment variable save_after_styling is depreciated and",
102-
"won't work in a future version of styler. Please use the R option",
103-
"`styler.save_after_styling` to control the behavior. If both are set,",
104-
"the R option is taken."
101+
"Using the environment variable `save_after_styling` is deprecated and",
102+
"won't work in a future version of styler. Please use",
103+
"`options(styler.save_after_styling)` to control the behavior. If both are set,",
104+
"the R option is used."
105105
))
106106
}
107107

R/parse.R

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -95,10 +95,10 @@ get_parse_data <- function(text, include_text = TRUE, ...) {
9595
if (getRversion() < "4.2") {
9696
is_unicode_parsing_error <- grepl("^\"<U\\+[0-9]+>\"$", pd$text)
9797
if (any(is_unicode_parsing_error)) {
98-
rlang::abort(paste0(
99-
"Can't parse input due to unicode restriction in base R. Please ",
100-
"upgrade R to >= 4.2 to style this input. ",
101-
"Context: https://github.com/r-lib/styler/issues/847"
98+
cli::cli_abort(c(
99+
"Can't parse input due to unicode restriction in base R.",
100+
i = "Please upgrade R to >= 4.2 to style this input. ",
101+
"Context: {.url https://github.com/r-lib/styler/issues/847}"
102102
))
103103
}
104104
}

R/stylerignore.R

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -76,9 +76,10 @@ add_stylerignore <- function(pd_flat) {
7676
pd_flat$indicator_off <- cumsum_start + cumsum_stop
7777
is_invalid <- cumsum_start - cumsum_stop < 0L | cumsum_start - cumsum_stop > 1L
7878
if (any(is_invalid)) {
79-
cli::cli_warn(paste0(
80-
"Invalid stylerignore sequences found, potentially ignoring some of the ",
81-
"markers set.\nSee {.help styler::stylerignore}."
79+
cli::cli_warn(c(
80+
"Invalid stylerignore sequences found, potentially ignoring some of the \\
81+
markers set.",
82+
i = "See {.topic styler::stylerignore}."
8283
))
8384
}
8485

R/transform-code.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ transform_code <- function(path, fun, ..., dry) {
2222
..., dry = dry
2323
)
2424
} else {
25-
abort(paste(path, "is not an R, Rmd, qmd, or Rnw file"))
25+
cli::cli_abort("{.path {path}} is not an R, Rmd, qmd, or Rnw file.")
2626
}
2727
}
2828

R/zzz.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ ask_to_switch_to_non_default_cache_root <- function(ask = interactive()) {
6666
ask_to_switch_to_non_default_cache_root_impl <- function() {
6767
cli::cli_inform(paste0(
6868
"{{styler}} cache is cleared after 6 days. ",
69-
"See {.help styler::caching} to configure differently or silence this message."
69+
"See {.topic styler::caching} to configure differently or silence this message."
7070
))
7171
}
7272

0 commit comments

Comments
 (0)