Skip to content
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

Tweaks to style_pkg() #977

Merged
merged 3 commits into from
Aug 21, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion API
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ 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", "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", "Rmd", "Rmarkdown", "Rnw", "Qmd"), 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 = c("R/RcppExports.R", "R/cpp11.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
1 change: 1 addition & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ editor_options:
- `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).
- `style_pkg()` now excludes the auto-generated `R/cpp11.R` file (#977).

**Features**

Expand Down
12 changes: 6 additions & 6 deletions R/ui-styling.R
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,15 @@ NULL
#' Prettify R source code
#'
#' Performs various substitutions in all `.R` files in a package
#' (code and tests). One can also (optionally) style `.Rmd`, `.Rmarkdown` and/or
#' `.qmd`, `.Rnw` files (vignettes and readme) by changing the `filetype`
#' argument.
#' (code and tests), `.Rmd`, `.Rmarkdown` and/or
#' `.qmd`, `.Rnw` files (vignettes and readme).
#' Carefully examine the results after running this function!
#'
#' @param pkg Path to a (subdirectory of an) R package.
#' @param ... Arguments passed on to the `style` function.
#' @param ... Arguments passed on to the `style` function,
#' see [tidyverse_style()] for the default argument.
#' @param style A function that creates a style guide to use, by default
#' [tidyverse_style()] (without the parentheses). Not used
#' [`tidyverse_style`]. Not used
#' further except to construct the argument `transformers`. See
#' [style_guides()] for details.
#' @param transformers A set of transformer functions. This argument is most
Expand Down Expand Up @@ -76,7 +76,7 @@ style_pkg <- function(pkg = ".",
style = tidyverse_style,
transformers = style(...),
filetype = c("R", "Rprofile", "Rmd", "Rmarkdown", "Rnw", "Qmd"),
exclude_files = "R/RcppExports.R",
exclude_files = c("R/RcppExports.R", "R/cpp11.R"),
exclude_dirs = c("packrat", "renv"),
include_roxygen_examples = TRUE,
base_indention = 0,
Expand Down
6 changes: 5 additions & 1 deletion inst/WORDLIST
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,10 @@ config
CONST
coventions
covr
cpp
cran
cre
cynkra
datastructures
dec
deps
Expand Down Expand Up @@ -95,6 +97,7 @@ ixmypi
ized
Jupyterlab
Kirill
kirill
knitr
krlmlr
labelled
Expand Down Expand Up @@ -128,6 +131,7 @@ nph
NUM
oldrel
oneliner
ORCID
os
ourself
packagemanager
Expand All @@ -149,8 +153,8 @@ prettycode
PRs
purrr
qmd
questionr
Qmd
questionr
rcmdcheck
RcppExports
rds
Expand Down
5 changes: 3 additions & 2 deletions man/style_dir.Rd

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

5 changes: 3 additions & 2 deletions man/style_file.Rd

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

12 changes: 6 additions & 6 deletions man/style_pkg.Rd

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

5 changes: 3 additions & 2 deletions man/style_text.Rd

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