Closed
Description
The guide currently has pretty broad rules about braces:
https://style.tidyverse.org/syntax.html#indenting
One edge case apparently precluded by the current rules is an empty expression: { }
or {}
, for example empty while loops:
while (some_updating_condition()) { }
I don't think splitting the braces is a good choice in this case:
while (some_updating_condition()) {
}
styler
already enforces what looks to me like a good rule:
library(styler)
style_text("while (TRUE) { }")
# while (TRUE) { }
style_text("while (TRUE) {}")
# while (TRUE) {}
style_text("while (TRUE) { 1 }")
# while (TRUE) {
# 1
# }
Is it worth codifying this behavior in the guide?
We are wondering how to handle this in lintr
: r-lib/lintr#1346
Metadata
Metadata
Assignees
Labels
No labels