-
Notifications
You must be signed in to change notification settings - Fork 105
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Newline after multiline arguments? #209
Comments
This is the relevant section: https://style.tidyverse.org/syntax.html#long-lines Is your example really representative? In particular the second argument being unnamed. I find that often in practice examples like yours can be reflowed with explicit arguments instead: # foo = function(descriptive_name1, descriptive_name2)
foo(
c(
a
), c(
b
)
)
foo(
descriptive_name1 = c(
a
),
descriptive_name2 = c(
b
)
) It might help to share some specific package code you've come across that'd be affected by the rule here. |
Does the Occasionally, I create unnamed lists of vectors, with |
Yes, there definitely should be a new line there, yielding: list(
c(
a
),
c(
b
)
) (and this is what codegrip generates) I agree that this violates the "no more than one argument per line" rule. |
So I think this is covered by the style guide (or at least is sufficiently esoteric we don't need to explicit mention it) |
This looks fairly awkward to me:
Created on 2023-06-15 with reprex v2.0.2
I think there should be a newline after
),
. Is there a rule in the style guide? Should there be one?@MichaelChirico suggests that enforcing the newline creates wasted space. While true, I also find the comma between
)
andc(
difficult to spot, and I'm happy to trade the extra lines for readability here.Downstream: r-lib/styler#1133 (which also suggests to discuss here first).
The text was updated successfully, but these errors were encountered: