Repository navigation
No line break after switch and friends - #152
Conversation
620e26c to
319a165
Compare
krlmlr
left a comment
There was a problem hiding this comment.
Looks good. Could you please update the rlang pull request?
|
Sure. Should I submit an issue to the tidyverse style guide? |
|
Yes, please. |
Codecov Report
@@ Coverage Diff @@
## master #152 +/- ##
==========================================
+ Coverage 85.86% 85.95% +0.09%
==========================================
Files 19 19
Lines 778 783 +5
==========================================
+ Hits 668 673 +5
Misses 110 110
Continue to review full report at Codecov.
|
|
Do you think the text tokens be arguments in |
| set_line_break_after_opening_if_call_is_multi_line, | ||
| except_token = "COMMENT" | ||
| except_token_after = "COMMENT", | ||
| except_text_before = c("switch", "ifelse", "if_else") |
There was a problem hiding this comment.
Maybe expose an argument to tidyverse_style() that allows adding more exceptions?
There was a problem hiding this comment.
(Basically answering "yes" to your earlier question, if I understood correctly.)
There was a problem hiding this comment.
Ok, what how does that relate to tidyverse/style#39? It seems to be about named arguments according to the answer there, and not to function names anyways.
There was a problem hiding this comment.
Let's merge this the way it is now and discuss rules that involve named/unnamed arguments separately.
| partial( | ||
| set_line_break_after_opening_if_call_is_multi_line, | ||
| except_token = "COMMENT" | ||
| except_token_after = "COMMENT", |
There was a problem hiding this comment.
Side note: I'm not sure about the scope argument to this function, maybe scope should be an argument of the top-level style_() functions? The default values of the arguments to this function here are useful, we can easily change that later.
There was a problem hiding this comment.
Well you can do style_text("a <- 3", scope = "tokens"), so it is a top-level argument trough ...
There was a problem hiding this comment.
We can keep it for now and decide later.
- Vignette on customizing styler (#145). - No line break after `switch()` and friends (#152). - Remove flat relicts completely (#151). - Don't reindent function calls and break line correctly for multi-line calls (#149). - Set space between "=" and "," (#150). - Make R CMD Check perfect (#148). - Adding tests for exception handling with invalid parse data (#139). - Fix indention by checking for all potential triggers (#142). - Fix un-indention (#135). - Support wide characters (#130). - No spaces around :, :: and :::. - Redesigning the API (#123). - Solve eq_sub indention in general (#125). - Minor refactorings. - Re-indent token-dependent (#119). - Supporting more indention patterns. - Allow raw indention. - Definitively fixing eol issue with comments. - Infrastructure. - Flattening out the parse table. - New rule: no space after ! -> !!! for tidyeval. - Fix spacing around '{'. - Don't drop tokens! Fixes #101. - EOL spaces in empty comments (and in general) (#98). - mal-indention in conditional statement due to wrong specification of indent_without_paren) (#95). - Complicated indentions based on arithmetic and special operators (#96). - indention interaction on with assignment operator and other operators (#97).
As requested in krlmlr/rlang#1 (comment), it is now possible to not break the line in function calls where the text of the function is in
except_text_before. I.e.Will not be turned into
Since there is no such rule in the tidyverse style guide yet, I suggest opening an issue or PR before merging this.
Also, I am not sure whether the names of the functions should be an argument to
tidyverse_style(). For now, they are not.case_when()might also be such a function that should be treated as an exception.