AFAIK, there are currently no guidelines about this in the tidyverse style guide, but I was wondering if {styler} should adopt a convention to remove empty lines between roxygen documentation and the code.
In the wild, I often come across codebases that have formatting like the following. The count of empty spurious lines may differ across files. Currently, {styler} preserves such empty lines.
styler::style_text(
"#' @export
foo <- function() NULL"
)
#> #' @export
#>
#>
#>
#> foo <- function() NULL
I wish {styler} could remove such inconsistencies and adopt a single rule. I'd propose that it removes all empty lines by default, but I am also open to other rules (e.g. always have a single empty line). The point is more about consistency in formatting.
#> #' @export
#> foo <- function() NULL
Just like in formatting R6 lists, I think one exception to this rule could be the presence of a comment block before the function. In such cases, a single empty line can be preserved.
styler::style_text(
"#' @export
# bla bla bla
foo <- function() NULL"
)
#> #' @export
#>
#> # bla bla bla
#> foo <- function() NULL
Curious to hear what you think.
AFAIK, there are currently no guidelines about this in the tidyverse style guide, but I was wondering if {styler} should adopt a convention to remove empty lines between roxygen documentation and the code.
In the wild, I often come across codebases that have formatting like the following. The count of empty spurious lines may differ across files. Currently, {styler} preserves such empty lines.
I wish {styler} could remove such inconsistencies and adopt a single rule. I'd propose that it removes all empty lines by default, but I am also open to other rules (e.g. always have a single empty line). The point is more about consistency in formatting.
Just like in formatting
R6lists, I think one exception to this rule could be the presence of a comment block before the function. In such cases, a single empty line can be preserved.Curious to hear what you think.