Skip to content

Commit

Permalink
can't use if condition in assignment because it will assign NULL to t…
Browse files Browse the repository at this point in the history
…he element (instead of not assigning anything
  • Loading branch information
lorenzwalthert committed Jan 25, 2021
1 parent b80a0f2 commit c430adc
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion R/style-guides.R
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit c430adc

Please sign in to comment.