Skip to content

Commit 5da7935

Browse files
only remove excessive line breaks
1 parent 9d376c4 commit 5da7935

File tree

4 files changed

+108
-8
lines changed

4 files changed

+108
-8
lines changed

R/rules-line-breaks.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,7 @@ add_line_break_after_pipe <- function(pd) {
201201
set_line_break_after_assignment <- function(pd) {
202202
is_assignment <- lag(pd$token, default = FALSE) %in% c("LEFT_ASSIGN", "EQ_ASSIGN")
203203
if (any(is_assignment)) {
204-
pd$lag_newlines[is_assignment] <- min(1L, pd$lag_newlines[is_assignment])
204+
pd$lag_newlines[is_assignment] <- pmin(1L, pd$lag_newlines[is_assignment])
205205
}
206206
pd
207207
}

tests/testthat/line_breaks_and_other/assignment-in.R

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,3 +22,19 @@ x =
2222

2323
# comment
2424
3
25+
26+
27+
28+
ImportantDataFrame$ImportantColumn1 <-
29+
ImportantDataFrame$ImportantColumn2 <-
30+
ComplicatedFunction(ImportantDataFrame$InputColumn)
31+
32+
33+
ImportantDataFrame$ImportantColumn1 <-
34+
ImportantDataFrame$ImportantColumn2 <- ComplicatedFunction(ImportantDataFrame$InputColumn)
35+
36+
37+
38+
ImportantDataFrame$ImportantColumn1 <-
39+
40+
ImportantDataFrame$ImportantColumn2 <- ComplicatedFunction(ImportantDataFrame$InputColumn)

tests/testthat/line_breaks_and_other/assignment-in_tree

Lines changed: 76 additions & 7 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

tests/testthat/line_breaks_and_other/assignment-out.R

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,3 +21,18 @@ x <- 3
2121
x <-
2222
# comment
2323
3
24+
25+
26+
27+
ImportantDataFrame$ImportantColumn1 <-
28+
ImportantDataFrame$ImportantColumn2 <-
29+
ComplicatedFunction(ImportantDataFrame$InputColumn)
30+
31+
32+
ImportantDataFrame$ImportantColumn1 <-
33+
ImportantDataFrame$ImportantColumn2 <- ComplicatedFunction(ImportantDataFrame$InputColumn)
34+
35+
36+
37+
ImportantDataFrame$ImportantColumn1 <-
38+
ImportantDataFrame$ImportantColumn2 <- ComplicatedFunction(ImportantDataFrame$InputColumn)

0 commit comments

Comments
 (0)