-
Notifications
You must be signed in to change notification settings - Fork 71
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
Double indentation should be an opt-in/out rule #1157
Comments
Hi @mcanouil. {styler} implements the tidyverse style guide and your code does not correspond to that style. As you can read in various issues, I am not the biggest fan of double indent, but there is another way function(x = 1,
y = 2) {
NULL
} These are the two officially supported styles and styler adheres to those. |
I know that's a "new" tidyverse style guide rule, but that is not the point. My question is why is it not controlled by a rule/transformer that can be opt-out? https://styler.r-lib.org/articles/remove_rules.html EDIT: the rule/transformer regarding function declaration all uses For now, I was basically trashing the whole set of transformers: styler::style_text(
text = "
f <- function(
x,
y
) {
NULL
}",
style = function(...) {
transformers <- styler::tidyverse_style(...)
transformers$indention$update_indention_ref_fun_dec <- NULL
transformers$indention$unindent_fun_dec <- NULL
transformers$line_break$remove_line_breaks_in_fun_dec <- NULL
transformers
}
) |
I am happy to review and merge a PR that refactors existing rules such that the removal of the double indention is possible in an easier way, e.g. by simply remove the rule, but I won't contribute this change. |
The answer to why it is not already implemented like this is because probably I did not care or it was more complex. |
I see. |
Sure. Thanks @mcanouil for understanding that catering to all user requests here is difficult and my time is limited since no one pays me to work on {styler}. |
I know this too well. Anyway, thanks for the time spent on the package and replying. 😉 |
Styler "recently" enforces a rule that double indent function declaration.
Let's say you have the following.
It will be "messed up" (sorry, personal opinion on double indentation) as:
I know there is #1137 open for few months now, but regardless of this PR, I do believe double indent rule should be as other rules an opt-in/out rule.
Thanks for considering this.
The text was updated successfully, but these errors were encountered: