diff --git a/API b/API index b497e5795..4d8c093ed 100644 --- a/API +++ b/API @@ -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() diff --git a/NEWS.md b/NEWS.md index 847839be5..086c9eaba 100644 --- a/NEWS.md +++ b/NEWS.md @@ -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** diff --git a/R/ui-styling.R b/R/ui-styling.R index f77ed8d4b..8e8387ae8 100644 --- a/R/ui-styling.R +++ b/R/ui-styling.R @@ -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 @@ -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, diff --git a/inst/WORDLIST b/inst/WORDLIST index 0fb9d4363..52dd0e54d 100644 --- a/inst/WORDLIST +++ b/inst/WORDLIST @@ -28,8 +28,10 @@ config CONST coventions covr +cpp cran cre +cynkra datastructures dec deps @@ -95,6 +97,7 @@ ixmypi ized Jupyterlab Kirill +kirill knitr krlmlr labelled @@ -128,6 +131,7 @@ nph NUM oldrel oneliner +ORCID os ourself packagemanager @@ -149,8 +153,8 @@ prettycode PRs purrr qmd -questionr Qmd +questionr rcmdcheck RcppExports rds diff --git a/man/style_dir.Rd b/man/style_dir.Rd index 3208bab17..c09a7bec8 100644 --- a/man/style_dir.Rd +++ b/man/style_dir.Rd @@ -21,10 +21,11 @@ style_dir( \arguments{ \item{path}{Path to a directory with files to transform.} -\item{...}{Arguments passed on to the \code{style} function.} +\item{...}{Arguments passed on to the \code{style} function, +see \code{\link[=tidyverse_style]{tidyverse_style()}} for the default argument.} \item{style}{A function that creates a style guide to use, by default -\code{\link[=tidyverse_style]{tidyverse_style()}} (without the parentheses). Not used +\code{\link{tidyverse_style}}. Not used further except to construct the argument \code{transformers}. See \code{\link[=style_guides]{style_guides()}} for details.} diff --git a/man/style_file.Rd b/man/style_file.Rd index fbfa0cc7b..04eca0fee 100644 --- a/man/style_file.Rd +++ b/man/style_file.Rd @@ -18,10 +18,11 @@ style_file( \item{path}{A character vector with paths to files to style. Supported extensions: \code{.R}, \code{.Rmd}, \code{.Rmarkdown}, \code{.qmd} and \code{.Rnw}.} -\item{...}{Arguments passed on to the \code{style} function.} +\item{...}{Arguments passed on to the \code{style} function, +see \code{\link[=tidyverse_style]{tidyverse_style()}} for the default argument.} \item{style}{A function that creates a style guide to use, by default -\code{\link[=tidyverse_style]{tidyverse_style()}} (without the parentheses). Not used +\code{\link{tidyverse_style}}. Not used further except to construct the argument \code{transformers}. See \code{\link[=style_guides]{style_guides()}} for details.} diff --git a/man/style_pkg.Rd b/man/style_pkg.Rd index 342f1fa51..18392ac05 100644 --- a/man/style_pkg.Rd +++ b/man/style_pkg.Rd @@ -10,7 +10,7 @@ style_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, @@ -20,10 +20,11 @@ style_pkg( \arguments{ \item{pkg}{Path to a (subdirectory of an) R package.} -\item{...}{Arguments passed on to the \code{style} function.} +\item{...}{Arguments passed on to the \code{style} function, +see \code{\link[=tidyverse_style]{tidyverse_style()}} for the default argument.} \item{style}{A function that creates a style guide to use, by default -\code{\link[=tidyverse_style]{tidyverse_style()}} (without the parentheses). Not used +\code{\link{tidyverse_style}}. Not used further except to construct the argument \code{transformers}. See \code{\link[=style_guides]{style_guides()}} for details.} @@ -59,9 +60,8 @@ styling are not identical.} } \description{ Performs various substitutions in all \code{.R} files in a package -(code and tests). One can also (optionally) style \code{.Rmd}, \code{.Rmarkdown} and/or -\code{.qmd}, \code{.Rnw} files (vignettes and readme) by changing the \code{filetype} -argument. +(code and tests), \code{.Rmd}, \code{.Rmarkdown} and/or +\code{.qmd}, \code{.Rnw} files (vignettes and readme). Carefully examine the results after running this function! } \section{Warning}{ diff --git a/man/style_text.Rd b/man/style_text.Rd index 6824c0ac6..b8f2e7516 100644 --- a/man/style_text.Rd +++ b/man/style_text.Rd @@ -16,10 +16,11 @@ style_text( \arguments{ \item{text}{A character vector with text to style.} -\item{...}{Arguments passed on to the \code{style} function.} +\item{...}{Arguments passed on to the \code{style} function, +see \code{\link[=tidyverse_style]{tidyverse_style()}} for the default argument.} \item{style}{A function that creates a style guide to use, by default -\code{\link[=tidyverse_style]{tidyverse_style()}} (without the parentheses). Not used +\code{\link{tidyverse_style}}. Not used further except to construct the argument \code{transformers}. See \code{\link[=style_guides]{style_guides()}} for details.}