Repository navigation
Roundtrip and CLI - #289
Conversation
…son) and the scope is > "line_breaks"
- use cli package for nicer formatting. - Print a summary at the end of styling - Use cat(), not message() to avoid red font. - return tibble with information on what was formatted instead of vector. - don't show info for style_text()
| #' @inheritParams can_verify_roundtrip | ||
| communicate_warning <- function(changed, transformers) { | ||
| if (any(changed, na.rm = TRUE) & !can_verify_roundtrip(transformers)) { | ||
| cat("Please review the changes carefully!") |
There was a problem hiding this comment.
Is it ok to use cat() or do you prefer warning()? I just felt red is not the right color.
There was a problem hiding this comment.
We can add color with crayon if necessary.
Codecov Report
@@ Coverage Diff @@
## master #289 +/- ##
==========================================
+ Coverage 90.62% 90.91% +0.29%
==========================================
Files 28 29 +1
Lines 1280 1299 +19
==========================================
+ Hits 1160 1181 +21
+ Misses 120 118 -2
Continue to review full report at Codecov.
|
|
Any ideas why the appveyor build fails at the point where it compares the printed console output With a reference value? I guess it has to do with the encoding. But using class |
krlmlr
left a comment
There was a problem hiding this comment.
Thanks. I haven't seen the output yet, but we can merge anyway.
| #' @param old_text The initial expression in its character representation. | ||
| #' @param new_text The styled expression in its character representation. | ||
| expressions_are_identical <- function(old_text, new_text) { | ||
| identical( |
| #' @inheritParams can_verify_roundtrip | ||
| communicate_warning <- function(changed, transformers) { | ||
| if (any(changed, na.rm = TRUE) & !can_verify_roundtrip(transformers)) { | ||
| cat("Please review the changes carefully!") |
There was a problem hiding this comment.
We can add color with crayon if necessary.
| max_char <- min(max(nchar(files), 0), 80) | ||
| if (length(files) > 0) { | ||
| message("Styling ", length(files), " files:") | ||
| if (length(files) < 1) { |
There was a problem hiding this comment.
Please check the comparison operator.
There was a problem hiding this comment.
uups, thanks.
| changed <- map_lgl(path, | ||
| style_file_one, ..., style = style, transformers = transformers | ||
| ) | ||
| invisible(tibble(file = path, changed = changed)) |
There was a problem hiding this comment.
Is this return value used anywhere?
There was a problem hiding this comment.
No, I just found style_file_one() is redundant anyways with the current implementation of transform_files(). Must have overlooked that at some point. I will make the changes in transform_files()
| #' been changed. | ||
| #' @inheritParams can_verify_roundtrip | ||
| communicate_warning <- function(changed, transformers) { | ||
| if (any(changed, na.rm = TRUE) & !can_verify_roundtrip(transformers)) { |
There was a problem hiding this comment.
&& better communicates intent here.
|
Would you like to change the default scope to something weaker than |
|
I am not sure. Would you? It took us quite a while to implement everything as it is now and if we lower the default scope, I think a lot of people will not take the time to set it manually to |
a57c213 to
076b75c
Compare
|
I value the effort that it took to patch the parse data. However, if we don't change tokens, we can automatically verify correctness. This gives us an extra safety net. I'm fine either way, please decide. |
|
AppVeyor: Checking Unicode symbols against known output on Windows is a pain. It's ok to just skip these tests on Windows. |
|
I am wondering about how good of an idea it is to set the default to |
1a4c038 to
472a661
Compare
472a661 to
1da5a74
Compare
- Remove `regex_none()`, document `NULL` default. - `style_dir()` and `style_pkg()` now also handle `.Rmd` files (#292, @jonmcalder). - Add test for styling `.Rmd` files. - Better error message for styling new files via the RStudio addin (#295). - Spelling via devtools::spell_check() (#294). - Roundtrip and CLI (#289).
|
Reference: #368. |
Closes #288, implements #287 (comment).