Skip to content

Commit e8ad27b

Browse files
remove blank lines in function headers
1 parent 68bc00c commit e8ad27b

File tree

6 files changed

+124
-26
lines changed

6 files changed

+124
-26
lines changed

NEWS.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
## Major changes
44

5+
- blank lines in function calls and headers are now removed (#629, #630).
56

67
## Minor chnages and fixes
78

@@ -10,7 +11,6 @@
1011
- typos in documentation (#618, #614).
1112

1213

13-
1414
# styler 1.3.2
1515

1616
Release upon request by the CRAN team.
@@ -435,4 +435,3 @@ specify_reindention(
435435
)
436436
initialize_default_attributes(pd_flat)
437437
```
438-

R/rules-line-break.R

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -170,9 +170,10 @@ remove_line_break_before_round_closing_after_curly <- function(pd) {
170170
pd
171171
}
172172

173-
remove_line_break_before_round_closing_fun_dec <- function(pd) {
173+
remove_line_breaks_in_fun_dec <- function(pd) {
174174
if (is_function_dec(pd)) {
175175
round_after <- pd$token == "')'" & pd$token_before != "COMMENT"
176+
pd$lag_newlines[pd$lag_newlines > 1L] <- 1L
176177
pd$lag_newlines[round_after] <- 0L
177178
}
178179
pd

R/style-guides.R

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -117,8 +117,8 @@ tidyverse_style <- function(scope = "tokens",
117117
set_line_break_before_curly_opening,
118118
remove_line_break_before_round_closing_after_curly =
119119
if (strict) remove_line_break_before_round_closing_after_curly,
120-
remove_line_break_before_round_closing_fun_dec =
121-
if (strict) remove_line_break_before_round_closing_fun_dec,
120+
remove_line_breaks_in_fun_dec =
121+
if (strict) remove_line_breaks_in_fun_dec,
122122
style_line_break_around_curly = partial(
123123
style_line_break_around_curly,
124124
strict

tests/testthat/fun_dec/line_break_fun_dec-in.R

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
a <- function(x, #
2-
y
3-
) {
2+
y) {
43
x - 1
54
}
65

@@ -13,6 +12,24 @@ a <- function(x, #
1312

1413
a <- function(x, #
1514
y #
16-
) {
15+
) {
1716
y
1817
}
18+
19+
20+
a <- function(x,
21+
y) {
22+
x - 1
23+
}
24+
25+
a <- function(x,
26+
#
27+
y) {
28+
x - 1
29+
}
30+
31+
a <- function(x,
32+
33+
y) {
34+
x - 1
35+
}

tests/testthat/fun_dec/line_break_fun_dec-in_tree

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

tests/testthat/fun_dec/line_break_fun_dec-out.R

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,3 +15,20 @@ a <- function(x, #
1515
) {
1616
y
1717
}
18+
19+
20+
a <- function(x,
21+
y) {
22+
x - 1
23+
}
24+
25+
a <- function(x,
26+
#
27+
y) {
28+
x - 1
29+
}
30+
31+
a <- function(x,
32+
y) {
33+
x - 1
34+
}

0 commit comments

Comments
 (0)