Skip to content

Commit

Permalink
Merge dc3c099 into a3b69e4
Browse files Browse the repository at this point in the history
  • Loading branch information
IndrajeetPatil authored Aug 6, 2022
2 parents a3b69e4 + dc3c099 commit ff4eca7
Show file tree
Hide file tree
Showing 7 changed files with 19 additions and 11 deletions.
4 changes: 2 additions & 2 deletions API
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ default_style_guide_attributes(pd_flat)
specify_math_token_spacing(zero = "'^'", one = c("'+'", "'-'", "'*'", "'/'"))
specify_reindention(regex_pattern = NULL, indention = 0, comments_only = TRUE)
specify_transformers_drop(spaces = NULL, indention = NULL, line_breaks = NULL, tokens = NULL)
style_dir(path = ".", ..., style = tidyverse_style, transformers = style(...), filetype = c("R", "Rprofile"), recursive = TRUE, exclude_files = NULL, exclude_dirs = c("packrat", "renv"), include_roxygen_examples = TRUE, base_indention = 0, dry = "off")
style_dir(path = ".", ..., style = tidyverse_style, transformers = style(...), filetype = c("R", "Rprofile", "Rmd", "Rmarkdown", "Rnw", "Qmd"), recursive = TRUE, exclude_files = NULL, exclude_dirs = c("packrat", "renv"), include_roxygen_examples = TRUE, base_indention = 0, dry = "off")
style_file(path, ..., style = tidyverse_style, transformers = style(...), include_roxygen_examples = TRUE, base_indention = 0, dry = "off")
style_pkg(pkg = ".", ..., style = tidyverse_style, transformers = style(...), filetype = c("R", "Rprofile"), exclude_files = "R/RcppExports.R", exclude_dirs = c("packrat", "renv"), include_roxygen_examples = TRUE, base_indention = 0, dry = "off")
style_pkg(pkg = ".", ..., style = tidyverse_style, transformers = style(...), filetype = c("R", "Rprofile", "Rmd", "Rmarkdown", "Rnw", "Qmd"), exclude_files = "R/RcppExports.R", exclude_dirs = c("packrat", "renv"), include_roxygen_examples = TRUE, base_indention = 0, dry = "off")
style_text(text, ..., style = tidyverse_style, transformers = style(...), include_roxygen_examples = TRUE, base_indention = 0)
tidyverse_math_token_spacing()
tidyverse_reindention()
Expand Down
6 changes: 6 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,12 @@ editor_options:

# styler 1.7.0.9000 (Development version)

**Breaking Changes**

- `style_dir()` and `style_pkg()` now default to styling all supported file
formats (`.R`, `.Rmd`, `.Rmarkdown`, `.Rnw`, and `.qmd`) in the (package)
directory (\@IndrajeetPatil, #965).

**Features**

- `filetype` `.qmd` is now supported, but not turned on by default (#931).
Expand Down
4 changes: 2 additions & 2 deletions R/ui-styling.R
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ style_pkg <- function(pkg = ".",
...,
style = tidyverse_style,
transformers = style(...),
filetype = c("R", "Rprofile"),
filetype = c("R", "Rprofile", "Rmd", "Rmarkdown", "Rnw", "Qmd"),
exclude_files = "R/RcppExports.R",
exclude_dirs = c("packrat", "renv"),
include_roxygen_examples = TRUE,
Expand Down Expand Up @@ -255,7 +255,7 @@ style_dir <- function(path = ".",
...,
style = tidyverse_style,
transformers = style(...),
filetype = c("R", "Rprofile"),
filetype = c("R", "Rprofile", "Rmd", "Rmarkdown", "Rnw", "Qmd"),
recursive = TRUE,
exclude_files = NULL,
exclude_dirs = c("packrat", "renv"),
Expand Down
2 changes: 2 additions & 0 deletions inst/WORDLIST
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,9 @@ prefill
prettycode
PRs
purrr
qmd
questionr
Qmd
rcmdcheck
RcppExports
rds
Expand Down
2 changes: 1 addition & 1 deletion man/style_dir.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion man/style_pkg.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 5 additions & 5 deletions tests/testthat/test-public_api.R
Original file line number Diff line number Diff line change
Expand Up @@ -295,17 +295,17 @@ test_that("styler can style R and Rmd files via style_pkg()", {
expect_false(any(grepl("RcppExports.R", msg, fixed = TRUE)))
})

test_that("style_pkg() does not style qmd files by default", {
test_that("style_pkg() styles qmd files by default", {
msg <- capture_output(
style_pkg(testthat_file("public-api", "xyzpackage-qmd"))
)
expect_true(any(grepl("hello-world.R", msg, fixed = TRUE)))
expect_true(any(grepl("test-package-xyz.R", msg, fixed = TRUE)))
expect_false(any(grepl("random.Rmd", msg, fixed = TRUE)))
expect_false(any(grepl("random.Rmarkdown", msg, fixed = TRUE)))
expect_false(any(grepl("README.Rmd", msg, fixed = TRUE)))
expect_true(any(grepl("random.Rmd", msg, fixed = TRUE)))
expect_true(any(grepl("random.Rmarkdown", msg, fixed = TRUE)))
expect_true(any(grepl("README.Rmd", msg, fixed = TRUE)))
expect_false(any(grepl("RcppExports.R", msg, fixed = TRUE)))
expect_false(any(grepl("new.qmd", msg, fixed = TRUE)))
expect_true(any(grepl("new.qmd", msg, fixed = TRUE)))
})

test_that("style_pkg() can find qmd anywhere", {
Expand Down

0 comments on commit ff4eca7

Please sign in to comment.