Skip to content

Commit c7e7b70

Browse files
Merge pull request #676 from lorenzwalthert/issue-657
- Fix exclude_dirs for recursive case (#676).
2 parents 507e535 + 954863e commit c7e7b70

File tree

7 files changed

+22
-15
lines changed

7 files changed

+22
-15
lines changed

NEWS.md

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

2222
## Minor changes and fixes
2323

24+
- `style_dir()` and `style_pkg()` now apply directory exclusion recursively with
25+
`exclude_dirs` (#676).
2426
- cache is now correctly invalidated when style guide arguments change (#647).
2527
- empty lines are now removed between pipes (#645).
2628
- overhaul pgkdown site: Add search (#623), group function in Reference (#625).

R/ui-styling.R

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -89,9 +89,9 @@ style_pkg <- function(pkg = ".",
8989
#' standardization) are: "r", "rprofile", "rmd", "rnw".
9090
#' @param exclude_files Character vector with paths to files that should be
9191
#' excluded from styling.
92-
#' @param exclude_dirs Character vector with directories to exclude. Note that
93-
#' the default values were set for consistency with [style_dir()] and as
94-
#' these directories are anyways not styled.
92+
#' @param exclude_dirs Character vector with directories to exclude
93+
#' (recursively). Note that the default values were set for consistency with
94+
#' [style_dir()] and as these directories are anyways not styled.
9595
#' @inheritParams transform_files
9696
#' @keywords internal
9797
prettify_pkg <- function(transformers,
@@ -193,7 +193,8 @@ style_text <- function(text,
193193
#' @param path Path to a directory with files to transform.
194194
#' @param recursive A logical value indicating whether or not files in subdirectories
195195
#' of `path` should be styled as well.
196-
#' @param exclude_dirs Character vector with directories to exclude.
196+
#' @param exclude_dirs Character vector with directories to exclude
197+
#' (recursively).
197198
##' @inheritParams style_pkg
198199
#' @inheritSection transform_files Value
199200
#' @inheritSection style_pkg Warning
@@ -241,7 +242,9 @@ prettify_any <- function(transformers,
241242
base_indention = 0,
242243
dry) {
243244
exclude_files <- set_arg_paths(exclude_files)
244-
exclude_dirs <- set_arg_paths(exclude_dirs)
245+
exclude_dirs <- exclude_dirs %>%
246+
list.dirs(recursive = TRUE, full.names = TRUE) %>%
247+
set_arg_paths()
245248
files_root <- dir(
246249
path = ".", pattern = map_filetype_to_pattern(filetype),
247250
ignore.case = TRUE, recursive = FALSE, all.files = TRUE

man/prettify_any.Rd

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

man/prettify_pkg.Rd

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

man/style_dir.Rd

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

man/style_pkg.Rd

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
1

0 commit comments

Comments
 (0)