Skip to content

Commit e4da5ae

Browse files
Remove spaces around dollar operator
1 parent 2f1cc9b commit e4da5ae

File tree

4 files changed

+6
-5
lines changed

4 files changed

+6
-5
lines changed

R/rules-spaces.R

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -341,9 +341,10 @@ set_space_after_bang_bang <- function(pd_flat) {
341341
pd_flat
342342
}
343343

344-
remove_space_before_dollar <- function(pd_flat) {
344+
remove_space_around_dollar <- function(pd_flat) {
345345
dollar_after <- (pd_flat$token == "'$'") & (pd_flat$lag_newlines == 0L)
346346
dollar_before <- lead(dollar_after, default = FALSE)
347+
pd_flat$spaces[dollar_after] <- 0L
347348
pd_flat$spaces[dollar_before] <- 0L
348349
pd_flat
349350
}

R/style-guides.R

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ tidyverse_style <- function(scope = "tokens",
108108
remove_space_after_opening_paren = remove_space_after_opening_paren,
109109
remove_space_after_excl = remove_space_after_excl,
110110
set_space_after_bang_bang = set_space_after_bang_bang,
111-
remove_space_before_dollar = remove_space_before_dollar,
111+
remove_space_around_dollar = remove_space_around_dollar,
112112
remove_space_after_fun_dec = remove_space_after_fun_dec,
113113
remove_space_around_colons = remove_space_around_colons,
114114
start_comments_with_space = partial(start_comments_with_space,
@@ -205,7 +205,7 @@ tidyverse_style <- function(scope = "tokens",
205205
# remove_space_after_opening_paren = c("'('", "'['", "LBB"),
206206
remove_space_after_excl = "'!'",
207207
set_space_after_bang_bang = "'!'",
208-
remove_space_before_dollar = "'$'",
208+
remove_space_around_dollar = "'$'",
209209
remove_space_after_fun_dec = "FUNCTION",
210210
remove_space_around_colons = c("':'", "NS_GET_INT", "NS_GET"),
211211
start_comments_with_space = "COMMENT",
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
x$
2-
add(10) $
2+
add(10) $ add(10) $
33
add(10)$sum +
44
3
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
x$
2-
add(10)$
2+
add(10)$add(10)$
33
add(10)$sum +
44
3

0 commit comments

Comments
 (0)