Skip to content

Commit 82c325e

Browse files
postpone deprication of style guide without name and version to version 2.0 since this is a braking changes.
1 parent 0cbdff1 commit 82c325e

File tree

2 files changed

+9
-7
lines changed

2 files changed

+9
-7
lines changed

R/set-assert-args.R

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,23 +21,25 @@ set_arg_write_tree <- function(write_tree) {
2121
#' @inheritParams make_transformer
2222
#' @keywords internal
2323
assert_transformers <- function(transformers) {
24+
version_cutoff <- 1.5
2425
no_name <- is.null(transformers$style_guide_name)
2526
no_version <- is.null(transformers$style_guide_version)
2627
if (no_name || no_version) {
27-
action <- ifelse(utils::packageVersion("styler") >= 1.4,
28-
"are not supported", "won't be supported"
28+
action <- ifelse(utils::packageVersion("styler") >= version_cutoff,
29+
"are not supported anymore",
30+
"depreciated and will be removed in a future version of styler."
2931
)
3032
message <- paste(
31-
"Style guides without a name and a version field are depreciated and",
32-
action, "in styler >= 1.4. \nIf you are a user: Open an issue on",
33+
"Style guides without a name and a version field are",
34+
action, "\nIf you are a user: Open an issue on",
3335
"https://github.com/r-lib/styler and provide a reproducible example",
3436
"of this error. \nIf you are a developer:",
3537
"When you create a style guide with `styler::create_style_guide()`, the",
3638
"argument `style_guide_name` and `style_guide_version` should be",
3739
"non-NULL. See help(\"create_style_guide\") for how to set them."
3840
)
3941

40-
if (utils::packageVersion("styler") >= 1.4) {
42+
if (utils::packageVersion("styler") >= version_cutoff) {
4143
rlang::abort(message)
4244
} else {
4345
rlang::warn(message)

tests/testthat/test-exception_handling.R

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,13 +25,13 @@ test_that("style_file with no tokens returns empty string and warning", {
2525

2626
test_that("warning is given when transformers does not contain a version", {
2727
sg <- create_style_guide(style_guide_version = NULL)
28-
if (packageVersion("styler") < "1.4") {
28+
if (packageVersion("styler") < "1.5") {
2929
expect_fun <- expect_warning
3030
} else {
3131
expect_fun <- expect_error
3232
}
3333
expect_fun(
3434
assert_transformers(sg),
35-
"name and a version field are depreciated and are not supported in styler >= 1.4"
35+
"name and a version field are depreciated and will be removed in a future version of styler"
3636
)
3737
})

0 commit comments

Comments
 (0)