Skip to content

Commit a0af819

Browse files
committed
Update documentation
1 parent 883ac73 commit a0af819

File tree

6 files changed

+42
-25
lines changed

6 files changed

+42
-25
lines changed

R/spell-check.R

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@
66
#' `DESCRIPTION` file. Use the [WORDLIST][get_wordlist] file to allow custom words in your
77
#' package, which will be added to the dictionary when spell checking.
88
#'
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
1010
#' 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.
1212
#'
1313
#' Hunspell includes dictionaries for `en_US` and `en_GB` by default. Other languages
1414
#' require installation of a custom dictionary, see [hunspell][hunspell::hunspell] for details.
@@ -19,9 +19,10 @@
1919
#' @aliases spelling
2020
#' @family spelling
2121
#' @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
2526
spell_check_package <- function(pkg = ".", vignettes = TRUE, lang = "en_US", use_wordlist = TRUE){
2627
# Get package info
2728
pkg <- as_package(pkg)
@@ -113,12 +114,12 @@ print.summary_spellcheck <- function(x, ...){
113114
#' @export
114115
#' @aliases spell_check_test
115116
#' @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`.
118119
spell_check_setup <- function(pkg = ".", vignettes = TRUE, lang = "en_US", error = FALSE){
119120
# Get package info
120121
pkg <- as_package(pkg)
121-
update_wordlist(pkg$path)
122+
update_wordlist(pkg$path, vignettes = vignettes, lang = lang)
122123
dir.create(file.path(pkg$path, "tests"), showWarnings = FALSE)
123124
writeLines(sprintf("spelling::spell_check_test(vignettes = %s, lang = %s, error = %s)",
124125
deparse(vignettes), deparse(lang), deparse(error)), file.path(pkg$path, "tests/spelling.R"))

R/wordlist.R

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,14 @@
11
#' The WORDLIST file
22
#'
3-
#' Read and update the wordlist included with a package. The wordlist is stored in
4-
#' the file `inst/WORDLIST` in the source package and is used to allow custom words
5-
#' which will be added to the dictionary when spell checking.
3+
#' The package wordlist file is used to allow custom words which will be added to the
4+
#' dictionary when spell checking. It is stored in `inst/WORDLIST` in the source package
5+
#' and must contain one word per line in UTF-8 encoded text.
6+
#'
7+
#' The [update_wordlist] function runs a full spell check on a package, shows the results,
8+
#' and then prompts to add the found words to the package wordlist. Obviously you should
9+
#' check closely that these legitimate words and not actual spelling errors. It also
10+
#' removes words from the wordlist that no longer appear as spelling errors, either because
11+
#' they have been removed from the documentation or added to the `lang` dictionary.
612
#'
713
#' @rdname wordlist
814
#' @name wordlist

inst/WORDLIST

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
CMD
2-
Hunspell
2+
hunspell
33
Parsers
44
rmd
55
rnw

man/spell_check_files.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/spell_check_package.Rd

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

man/wordlist.Rd

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

0 commit comments

Comments
 (0)