From c430adcc8e310e465095aa91c57cca2a2233f42e Mon Sep 17 00:00:00 2001 From: Lorenz Walthert Date: Mon, 25 Jan 2021 09:42:55 +0100 Subject: [PATCH] can't use if condition in assignment because it will assign NULL to the element (instead of not assigning anything --- R/style-guides.R | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/R/style-guides.R b/R/style-guides.R index f4ceb00e3..1e3986391 100644 --- a/R/style-guides.R +++ b/R/style-guides.R @@ -217,11 +217,15 @@ tidyverse_style <- function(scope = "tokens", # and `text` supplied to transformers_drop() is "", so it appears to not # contain EQ_ASSIGN, and the transformer is falsely removed. # compute_parse_data_nested / text_to_flat_pd ('a = 4') - force_assignment_op = if (getRversion() >= 3.6) "EQ_ASSIGN", + force_assignment_op = "EQ_ASSIGN", wrap_if_else_while_for_fun_multi_line_in_curly = c("IF", "WHILE", "FOR", "FUNCTION") ) ) + if (getRversion() >= 3.6) { + transformers_drop$token$force_assignment_op <- NULL + } + style_guide_name <- "styler::tidyverse_style@https://github.com/r-lib" create_style_guide( # transformer functions