Closed MichaelChirico closed 3 years ago
@MichaelChirico how do you feel about the proposal in #174:
long_function_name <- function(
a = "a long argument",
b = "another argument",
c = "another long argument") {
# As usual code is indented by two spaces.
}
The main difference is that we double indent the argument list and keep ) {
on the same line — this matches Google's advice for C++ and was the consensus vote amongst the tidyverse team.
Closed by #174 (I know this isn't exactly what you were looking for but it's the closest I could get and still maintain rough consensus)
Filed first as https://github.com/r-lib/styler/issues/829, but in writing that I realized the style guide itself could weigh in here as well.
Currently in the style guide we have (https://style.tidyverse.org/functions.html#long-lines-1):
I basically see the point about
c =
having the same indentation as the function body and thus needing to scan for{
at the end of a line to find the start/end of the definition.However I think this is nicely avoided by just dropping
) {
to the next line:I would prefer to allow this latter usage, but either weigh it would be helpful for the style guide to be explicit.