-
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
Clarify indentation rules if multiple apply at the same time #197
Comments
Thanks @AshesITR. Clarification for {styler} decision: The same indention is applied when working with RStudio interactively and {styler} currently usees the principle that indention per new line is at most one level. |
@lorenzwalthert I can't reproduce this. Maybe RStudio behaviour has changed in the meanwhile? rstudio-if.movRStudio IDE version details |
I think my informal advice would be "don't do that" 😄 Generally, where I encounter such code in a function, I'll try to refactor it by introducing a variable or a helper function. I can think about where to add such advice to the style guide. |
I think a hanging indent looks fine inside of function calls: fun(
arg1 |>
arg1_processor1() |>
arg1_processor2(),
arg2
) And for if statements, @mine-cetinkaya-rundel suggested another form: if (
long_conditional &&
other_long_conditional
) {
conditionally_evaluated_code()
} |
Raised in r-lib/styler#1065
There are circumstances where both, a hanging / block indent for a function call and a block indent for line continuation of binary operators (e.g. pipes), are triggered on the same line of code.
Currently, lintr's
indentation_linter()
requires two levels of indent in such cases whereas styler only wants one.Here are some code examples that need clarification on what the tidyverse style should be:
cc @IndrajeetPatil, @lorenzwalthert
The text was updated successfully, but these errors were encountered: