Skip to content

Commit c8ad30e

Browse files
ensuring "good" names for transformer functions
1 parent 5063918 commit c8ad30e

File tree

1 file changed

+30
-16
lines changed

1 file changed

+30
-16
lines changed

R/style_guides.R

Lines changed: 30 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -64,39 +64,50 @@ tidyverse_style <- function(scope = "tokens",
6464

6565
space_manipulators <- if (scope >= "spaces") {
6666
lst(
67-
partial(indent_braces, indent_by = indent_by),
68-
partial(indent_op, indent_by = indent_by),
69-
partial(indent_eq_sub, indent_by = indent_by),
70-
partial(indent_without_paren, indent_by = indent_by),
71-
67+
indent_braces = partial(indent_braces, indent_by = indent_by),
68+
indent_op = partial(indent_op, indent_by = indent_by),
69+
indent_eq_sub = partial(indent_eq_sub, indent_by = indent_by),
70+
indent_without_paren = partial(indent_without_paren,
71+
indent_by = indent_by
72+
),
7273
fix_quotes,
7374
remove_space_before_closing_paren,
7475
remove_space_before_opening_paren = if (strict) remove_space_before_opening_paren,
7576
add_space_after_for_if_while,
7677
add_space_before_brace,
7778
remove_space_before_comma,
78-
partial(
79+
style_space_around_math_token = partial(
7980
style_space_around_math_token, strict,
8081
math_token_spacing$zero,
8182
math_token_spacing$one
8283
),
83-
partial(
84+
style_space_around_tilde = partial(
8485
style_space_around_token, strict = strict, tokens = "'~'", level = 1L),
85-
if (strict) set_space_around_op else add_space_around_op,
86-
if (strict) set_space_after_comma else add_space_after_comma,
86+
spacing_around_op = if (strict) {
87+
set_space_around_op
88+
}else {
89+
add_space_around_op
90+
},
91+
spacing_around_comma = if (strict) {
92+
set_space_after_comma
93+
} else {
94+
add_space_after_comma
95+
},
8796
remove_space_after_opening_paren,
8897
remove_space_after_excl,
8998
set_space_after_bang_bang,
9099
remove_space_before_dollar,
91100
remove_space_after_fun_dec,
92101
remove_space_around_colons,
93-
partial(
94-
start_comments_with_space,
102+
start_comments_with_space = partial(start_comments_with_space,
95103
force_one = start_comments_with_one_space
96104
),
97-
98105
remove_space_after_unary_pm_nested,
99-
if (strict) set_space_before_comments else add_space_before_comments,
106+
spacing_before_comments = if (strict) {
107+
set_space_before_comments
108+
} else {
109+
add_space_before_comments
110+
},
100111
set_space_between_levels,
101112
set_space_between_eq_sub_and_comma
102113
)
@@ -111,17 +122,20 @@ tidyverse_style <- function(scope = "tokens",
111122
if (strict) remove_line_break_before_round_closing_after_curly,
112123
remove_line_break_before_round_closing_fun_dec =
113124
if (strict) remove_line_break_before_round_closing_fun_dec,
114-
partial(style_line_break_around_curly, strict),
125+
style_line_break_around_curly = partial(style_line_break_around_curly,
126+
strict
127+
),
115128
set_line_break_after_opening_if_call_is_multi_line = if (strict)
116129
partial(
117130
set_line_break_after_opening_if_call_is_multi_line,
118131
except_token_after = "COMMENT",
119132
except_text_before = c("switch", "ifelse", "if_else")
120133
),
121-
set_line_break_before_closing_call = if (strict)
134+
set_line_break_before_closing_call = if (strict) {
122135
partial(
123136
set_line_break_before_closing_call, except_token_before = "COMMENT"
124-
),
137+
)
138+
},
125139
remove_line_break_in_empty_fun_call,
126140
add_line_break_after_pipe
127141
)

0 commit comments

Comments
 (0)