Skip to content

Commit c430adc

Browse files
can't use if condition in assignment because it will assign NULL to the element (instead of not assigning anything
1 parent b80a0f2 commit c430adc

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

R/style-guides.R

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -217,11 +217,15 @@ tidyverse_style <- function(scope = "tokens",
217217
# and `text` supplied to transformers_drop() is "", so it appears to not
218218
# contain EQ_ASSIGN, and the transformer is falsely removed.
219219
# compute_parse_data_nested / text_to_flat_pd ('a = 4')
220-
force_assignment_op = if (getRversion() >= 3.6) "EQ_ASSIGN",
220+
force_assignment_op = "EQ_ASSIGN",
221221
wrap_if_else_while_for_fun_multi_line_in_curly = c("IF", "WHILE", "FOR", "FUNCTION")
222222
)
223223
)
224224

225+
if (getRversion() >= 3.6) {
226+
transformers_drop$token$force_assignment_op <- NULL
227+
}
228+
225229
style_guide_name <- "styler::tidyverse_style@https://github.com/r-lib"
226230
create_style_guide(
227231
# transformer functions

0 commit comments

Comments
 (0)