|
6 | 6 | #' `DESCRIPTION` file. Use the [WORDLIST][get_wordlist] file to allow custom words in your |
7 | 7 | #' package, which will be added to the dictionary when spell checking. |
8 | 8 | #' |
9 | | -#' Use [spell_check_setup()] to add a unit test to your package which automatically |
| 9 | +#' The [spell_check_setup] function adds a unit test to your package which automatically |
10 | 10 | #' runs a spell check on documentation and vignettes during `R CMD check`. By default this |
11 | | -#' unit test will never fail; it merely prints potential spelling errors to the console. |
| 11 | +#' unit test never fails; it merely prints potential spelling errors to the console. |
12 | 12 | #' |
13 | 13 | #' Hunspell includes dictionaries for `en_US` and `en_GB` by default. Other languages |
14 | 14 | #' require installation of a custom dictionary, see [hunspell][hunspell::hunspell] for details. |
|
19 | 19 | #' @aliases spelling |
20 | 20 | #' @family spelling |
21 | 21 | #' @param pkg path to package root directory containing the `DESCRIPTION` file |
22 | | -#' @param vignettes spell check `rmd` and `rnw` files in the `vignettes` folder |
23 | | -#' @param lang string with dictionary language string for [hunspell::dictionary][hunspell::dictionary] |
24 | | -#' @param use_wordlist ignore words in the package `WORDLIST` file |
| 22 | +#' @param vignettes also check all `rmd` and `rnw` files in the pkg `vignettes` folder |
| 23 | +#' @param lang dictionary string for [hunspell][hunspell::dictionary], |
| 24 | +#' usually either `"en_US"` or `"en_GB"`. |
| 25 | +#' @param use_wordlist ignore words in the package [WORDLIST][get_wordlist] file |
25 | 26 | spell_check_package <- function(pkg = ".", vignettes = TRUE, lang = "en_US", use_wordlist = TRUE){ |
26 | 27 | # Get package info |
27 | 28 | pkg <- as_package(pkg) |
@@ -113,12 +114,12 @@ print.summary_spellcheck <- function(x, ...){ |
113 | 114 | #' @export |
114 | 115 | #' @aliases spell_check_test |
115 | 116 | #' @rdname spell_check_package |
116 | | -#' @param error if set to `TRUE`, makes `R CMD check` fail when an spelling error is found. |
117 | | -#' Default behavior is to only prints a note to the console. |
| 117 | +#' @param error make `R CMD check` fail when spelling errors are found. |
| 118 | +#' Default behavior only prints spelling errors to the console at the end of `CMD check`. |
118 | 119 | spell_check_setup <- function(pkg = ".", vignettes = TRUE, lang = "en_US", error = FALSE){ |
119 | 120 | # Get package info |
120 | 121 | pkg <- as_package(pkg) |
121 | | - update_wordlist(pkg$path) |
| 122 | + update_wordlist(pkg$path, vignettes = vignettes, lang = lang) |
122 | 123 | dir.create(file.path(pkg$path, "tests"), showWarnings = FALSE) |
123 | 124 | writeLines(sprintf("spelling::spell_check_test(vignettes = %s, lang = %s, error = %s)", |
124 | 125 | deparse(vignettes), deparse(lang), deparse(error)), file.path(pkg$path, "tests/spelling.R")) |
|
0 commit comments