-
Notifications
You must be signed in to change notification settings - Fork 73
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Remove excessive line breaks between top-level expressions #1239
Merged
Merged
Changes from 6 commits
Commits
Show all changes
17 commits
Select commit
Hold shift + click to select a range
2530f99
Add rule to reduce blank lines between scopes
IndrajeetPatil 86daefa
pre-commit
github-actions[bot] 287c756
fix
IndrajeetPatil 2ed0197
pre-commit
github-actions[bot] 23eb8a3
add tests
IndrajeetPatil 1166e3b
update precommit
IndrajeetPatil a2014dc
address review feedback
IndrajeetPatil 35cd8a9
pre-commit
github-actions[bot] 5705339
another test
IndrajeetPatil ab6cb64
address feedback
IndrajeetPatil 62c29dd
Merge branch 'main' into rm-line-breaks-between-funs
IndrajeetPatil 7dc83ba
make name of transformer more similar to existing ones
lorenzwalthert a59d4bb
pre-commit
github-actions[bot] e843fd5
create a new test collection instead of modifying existing tests
IndrajeetPatil 127588a
pre-commit
github-actions[bot] 7848039
correct non-strict mode test
IndrajeetPatil 6b5a4c5
Merge branch 'rm-line-breaks-between-funs' of https://github.com/r-li…
IndrajeetPatil File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -102,7 +102,6 @@ call( | |
) | ||
|
||
|
||
|
||
# if all col1 arguments are named, col1 must also be aligned | ||
# not aligned | ||
fell( | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,7 +4,6 @@ if (value > 0) { | |
} | ||
|
||
|
||
|
||
if (value > 0) { | ||
print(value) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -59,3 +59,12 @@ while (TRUE){ | |
|
||
while (TRUE){# | ||
} | ||
|
||
|
||
for (i in 1:10) {} | ||
|
||
|
||
|
||
|
||
|
||
while (TRUE) {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -53,3 +53,9 @@ while (TRUE) { | |
|
||
while (TRUE) { # | ||
} | ||
|
||
|
||
for (i in 1:10) {} | ||
|
||
|
||
while (TRUE) {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,11 @@ | ||
1:10 %>% # sum | ||
sum() | ||
|
||
|
||
f %>% g() | ||
|
||
|
||
|
||
|
||
|
||
h %>% i() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,8 @@ | ||
1:10 %>% # sum | ||
sum() | ||
|
||
|
||
f %>% g() | ||
|
||
|
||
h %>% i() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,6 +10,10 @@ call( | |
1 | ||
) | ||
|
||
|
||
|
||
|
||
|
||
call( | ||
x = 2, | ||
1, | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,6 +8,7 @@ call( | |
1 | ||
) | ||
|
||
|
||
call( | ||
x = 2, | ||
1, | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -19,7 +19,6 @@ call( | |
2, | ||
|
||
|
||
|
||
# comment | ||
|
||
1, | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,7 +16,6 @@ switch( # | |
) | ||
|
||
|
||
|
||
switch(x, | ||
a = 2, # | ||
y = 3 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,7 +16,6 @@ call(call( | |
)) | ||
|
||
|
||
|
||
# no more barcket on same line -> | ||
call(call( | ||
3, 4 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,8 +18,6 @@ call( | |
# new comment | ||
|
||
|
||
|
||
|
||
a() | ||
# I think it gets boring | ||
# new_line here | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,8 +9,6 @@ | |
#' # two | ||
#' | ||
#' | ||
#' | ||
#' | ||
#' ( | ||
#' # more | ||
#' a <- 3 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -24,7 +24,6 @@ NULL | |
NULL | ||
|
||
|
||
|
||
#' this | ||
#' | ||
#' empty line after example | ||
|
16 changes: 16 additions & 0 deletions
16
tests/testthat/roxygen-examples-complete/30-multiple-empty-lines-between-in.R
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
#' Empty line in examples | ||
#' | ||
#' @examples | ||
1 | ||
|
||
|
||
|
||
|
||
|
||
|
||
#' Empty line in examples | ||
#' | ||
#' @examples | ||
#' \dontrun{ | ||
#' } | ||
2 |
13 changes: 13 additions & 0 deletions
13
tests/testthat/roxygen-examples-complete/30-multiple-empty-lines-between-out.R
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
#' Empty line in examples | ||
#' | ||
#' @examples | ||
1 | ||
|
||
|
||
#' Empty line in examples | ||
#' | ||
#' @examples | ||
#' \dontrun{ | ||
#' | ||
#' } | ||
2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
# NB: DO NOT EDIT. Auto-generated by ./tests/dev/generate_roxygen_tests.R. | ||
|
||
test_that("analogous to test-roxygen-examples-complete: 30", { | ||
expect_warning(test_collection("roxygen-examples-complete", "^30-", transformer = style_text), NA) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,7 +14,6 @@ d | |
'text with "quotes"' | ||
|
||
|
||
|
||
# adding brackets in pipes | ||
a %>% | ||
b() %>% | ||
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Style guide recommends one line breaks, but only for function calls. But that itself felt quite aggressive, given the huge numbers of changes in test outputs.
2L
nicely aligns with Python and feels "natural" as well.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lets limit to two blank lines as towards the style guide and decide later if we'll go all the way to one line break. Also, can you please apply the
2L
limit tostrict = TRUE
only?