-
Notifications
You must be signed in to change notification settings - Fork 73
Redesign API #123
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
Redesign API #123
Conversation
Codecov Report
@@ Coverage Diff @@
## master #123 +/- ##
==========================================
- Coverage 89.59% 84.56% -5.04%
==========================================
Files 19 19
Lines 740 719 -21
==========================================
- Hits 663 608 -55
- Misses 77 111 +34
Continue to review full report at Codecov.
|
Ok, do you have any specific use case in mind already or is it a matter of principle? I wonder which user-control should then be passed via the transformers argument and what other options should be passed through via |
I just wanted to write |
Ok, cool, I did not know that |
9644e4a
to
5a4974f
Compare
@krlmlr can you review quickly? Can't assign the PR for review to you since you created it. |
- Remove relicts from flat approach - Rename get_transformers to tidyverse_style - Pass arguments to transformers via ... by default
5a4974f
to
28dfeea
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good.
API
Outdated
style_pkg(pkg = ".", flat = FALSE, transformers = get_transformers(flat = flat)) | ||
style_text(text, flat = FALSE, transformers = get_transformers(flat = flat)) | ||
create_style_guide(filler, line_break, space, token, indention, use_raw_indention = FALSE) | ||
style_dir(path = ".", recursive = TRUE, ..., style = tidyverse_style, transformers = style(...)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe also move recursive = FALSE
past the dots?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sounds good.
28dfeea
to
652dbe0
Compare
Also, I set defaults for all arguments of |
set defaults so create_style_guide() returns the empty styler
79dd9a3
to
6bea186
Compare
- 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).
This is a major API change. It makes closes #121 and makes working with top-level stylers much easier, in particuar through enabling the use of
...
.For example we change
To
All other top-level stylers such as
style_dir()
,style_pkg()
etc. are also adapted to be consistent with the example above. Second argument is always...
.In addition, the function
create_style_guide()
is introduced, which will help useres to create the input corresponding to thestyle
argument. Since we usetibble::lst()
, all transformer functions (and not just the lists containing them) are now named too.