Skip to content

Commit 8f42440

Browse files
Merge pull request #634 from lorenzwalthert/issue-633
- Allow for dry run (#634).
2 parents 3b94f31 + 06603fd commit 8f42440

File tree

6 files changed

+14
-9
lines changed

6 files changed

+14
-9
lines changed

NEWS.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44

55
- blank lines in function calls and headers are now removed, for the former only
66
when there are no comments before or after the blank line (#629, #630, #635).
7+
- `style_file()` and friends gain argument `dry` to control if changes should
8+
be applied to files or not (#634).
79

810
## Minor chnages and fixes
911

R/io.R

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,10 @@ transform_utf8_one <- function(path, fun, dry) {
3333
if (!identical) {
3434
if (dry == "fail") {
3535
rlang::abort(
36-
paste0("File `", path, "` would be modified by styler and `dry` = 'fail'."),
36+
paste0(
37+
"File `", path, "` would be modified by styler and argument dry",
38+
" is set to 'fail'."
39+
),
3740
class = "dryError"
3841
)
3942
} else if (dry == "on") {

R/ui-styling.R

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@ NULL
2222
#' @inheritParams prettify_pkg
2323
#' @section Warning:
2424
#' This function overwrites files (if styling results in a change of the
25-
#' code to be formatted). It is strongly suggested to only style files
26-
#' that are under version control or to create a backup copy.
25+
#' code to be formatted and `dry = "off"`). It is strongly suggested to only
26+
#' style files that are under version control or to create a backup copy.
2727
#'
2828
#' We suggest to first style with `scope < "tokens"` and inspect and commit
2929
#' changes, because these changes are guaranteed to leave the abstract syntax

man/style_dir.Rd

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

man/style_file.Rd

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

man/style_pkg.Rd

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)