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
don't re-indent function declarations with scope < "indention" #304
Conversation
Also reorganizing tests in new file.
Codecov Report
@@ Coverage Diff @@
## master #304 +/- ##
==========================================
- Coverage 91.18% 91.17% -0.02%
==========================================
Files 30 30
Lines 1373 1371 -2
==========================================
- Hits 1252 1250 -2
Misses 121 121
Continue to review full report at Codecov.
|
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.
Thanks! Makes sense to me.
R/style_guides.R
Outdated
update_indention_ref_fun_dec, | ||
NULL | ||
if (scope >= "indention") update_indention_ref_fun_dec, | ||
identity |
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.
I'm not in love with the use of identity
here, this sure doesn't help performance. Maybe allow NULL
and filter out later with compact()
? Need to use lst()
instead of c()
.
The name for the list elements will be the full quoted expression, maybe change l. 138 above to wrap_if_else_multi_line_in_curly = if (strict) wrap_if_else_multi_line_in_curly else identity
and likewise in other places?
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.
Ok, I like the idea with purrr::compact()
, lst()
and naming the arguments here and in other places.
and filter with purrr:::compact(). Requires breaking API change since initializer are now not a function anymore but a list of funcitons.
5a29c2b
to
7e8b667
Compare
API
Outdated
@@ -2,7 +2,7 @@ | |||
|
|||
## Exported functions | |||
|
|||
create_style_guide(initialize = default_style_guide_attributes, line_break = NULL, space = NULL, token = NULL, indention = NULL, use_raw_indention = FALSE, reindention = tidyverse_reindention()) | |||
create_style_guide(initialize = lst(default_style_guide_attributes), line_break = NULL, space = NULL, token = NULL, indention = NULL, use_raw_indention = FALSE, reindention = tidyverse_reindention()) |
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.
Should we use lst()
as a default in an exported function at all?
Unfortunately, there was an inconsistency in |
and convert initialize internally to a list of one function.
It looks more natural to accept a function for the |
Ok, agree. |
1311158
to
0780c41
Compare
Closes #303