@@ -119,21 +119,24 @@ tidyverse_style <- function(scope = "tokens",
119119 if (strict ) remove_line_break_before_round_closing_after_curly ,
120120 remove_line_break_before_round_closing_fun_dec =
121121 if (strict ) remove_line_break_before_round_closing_fun_dec ,
122- style_line_break_around_curly = partial(style_line_break_around_curly ,
122+ style_line_break_around_curly = partial(
123+ style_line_break_around_curly ,
123124 strict
124125 ),
125126 # must be after style_line_break_around_curly as it remove line
126127 # breaks again for {{.
127128 set_line_break_around_curly_curly ,
128- set_line_break_after_opening_if_call_is_multi_line = if (strict )
129+ set_line_break_after_opening_if_call_is_multi_line = if (strict ) {
129130 partial(
130131 set_line_break_after_opening_if_call_is_multi_line ,
131132 except_token_after = " COMMENT" ,
132133 except_text_before = c(" switch" , " ifelse" , " if_else" )
133- ),
134+ )
135+ },
134136 set_line_break_before_closing_call = if (strict ) {
135137 partial(
136- set_line_break_before_closing_call , except_token_before = " COMMENT"
138+ set_line_break_before_closing_call ,
139+ except_token_before = " COMMENT"
137140 )
138141 },
139142 remove_line_break_in_empty_fun_call ,
@@ -160,19 +163,19 @@ tidyverse_style <- function(scope = "tokens",
160163 update_indention_ref_fun_dec =
161164 if (scope > = " indention" ) update_indention_ref_fun_dec
162165 )
163-
166+ style_guide_name <- " styler::tidyverse_style@https://github.com/r-lib "
164167 create_style_guide(
165168 # transformer functions
166169 initialize = default_style_guide_attributes ,
167- line_break = line_break_manipulators ,
168- space = space_manipulators ,
169- token = token_manipulators ,
170- indention = indention_modifier ,
170+ line_break = line_break_manipulators ,
171+ space = space_manipulators ,
172+ token = token_manipulators ,
173+ indention = indention_modifier ,
171174 # transformer options
172- use_raw_indention = use_raw_indention ,
173- reindention = reindention ,
174- style_guide_name = " styler::tidyverse_style@https://github.com/r-lib " ,
175- style_guide_version = styler_version
175+ use_raw_indention = use_raw_indention ,
176+ reindention = reindention ,
177+ style_guide_name = style_guide_name ,
178+ style_guide_version = styler_version
176179 )
177180}
178181
@@ -211,9 +214,14 @@ tidyverse_style <- function(scope = "tokens",
211214# ' pd_flat
212215# ' }
213216# ' set_line_break_before_curly_opening_style <- function() {
214- # ' create_style_guide(line_break = tibble::lst(set_line_break_before_curly_opening))
217+ # ' create_style_guide(
218+ # ' line_break = tibble::lst(set_line_break_before_curly_opening)
219+ # ' )
215220# ' }
216- # ' style_text("a <- function(x) { x }", style = set_line_break_before_curly_opening_style)
221+ # ' style_text(
222+ # ' "a <- function(x) { x }",
223+ # ' style = set_line_break_before_curly_opening_style
224+ # ' )
217225# ' @importFrom purrr compact
218226# ' @export
219227create_style_guide <- function (initialize = default_style_guide_attributes ,
@@ -267,12 +275,13 @@ NULL
267275# ' @export
268276specify_reindention <- function (regex_pattern = NULL ,
269277 indention = 0 ,
270- comments_only = TRUE )
278+ comments_only = TRUE ) {
271279 lst(
272280 regex_pattern ,
273281 indention ,
274282 comments_only
275283 )
284+ }
276285
277286# ' @describeIn reindention Simple forwarder to
278287# ' `specify_reindention` with reindention according to the tidyverse style
330339# ' @export
331340specify_math_token_spacing <-
332341 function (zero = " '^'" ,
333- one = c(" '+'" , " '-'" , " '*'" , " '/'" )) {
342+ one = c(" '+'" , " '-'" , " '*'" , " '/'" )) {
334343 assert_tokens(c(one , zero ))
335344 lst(
336345 one = setdiff(c(math_token , one ), zero ),
0 commit comments