Closed zappingseb closed 4 years ago
I can't reproduce this problem. When I run spell_check_package(".", vignettes = TRUE)
in a pkg dir, the results do not include words from the README.md or DESCRIPTION if those words are in the wordlist.
I find it very strange that inst/inst/WORDLIST
solves your problem. Are you running this inside a source package or installed package?
Hi. I created a repo to show our thing:
https://github.com/zappingseb/test_spelling
Inside this repo everything is fine on devtools::test()
but it fails in devtools::check()
We created a second branch with the duplicated inst
directory, where devtools::check
works fine.
You have a very broken test setup. You are using testthat in which you load devtools and then you call spelling.
Your code doesn't work at all because you are running it on the installed package, which doesn't have the source code for the manual pages.
Can you please try instead to use spell_check_setup()
to create the unit test? Or just copy the unit tests from any of the other packages that use spelling? So it looks like this: https://github.com/cran/curl/tree/master/tests
Thank you @jeroen
we noticed that our setup did not suite the spelling
package
We changed the setup to this:
pkg <- get_package_info(source = TRUE)
if (grepl("lib", pkg$path)) {
dir.create(file.path(pkg$path, "inst"))
file.copy(file.path(pkg$path, "WORDLIST"), file.path(pkg$path, "inst/WORDLIST"))
}
test_that("misspelling", {
spell_error <- spelling::spell_check_package(pkg, vignettes = TRUE, use_wordlist = TRUE)
expect(
nrow(spell_error) == 0,
failure_message = apply(
spell_error, 1,
function(word) paste0("\nmisspelled word '", word[1], "' in ", word[2])
) %>%
paste(collapse = "")
)
})
This allowed us working with installed packages without screwing with your package.
Sorry for the inconvenience
We created a test running:
In case this runs in
R CMD check
it fails on words which are obviously in the WORDLIST, This is the case for ourNEWS.md
andDESCRIPTION
file. Not for.Rd
files.We noticed upon creating
inst/inst/WORDLIST
this error disappears. Can you make the location of the wordlist flexible in the call ofspell_check_package
? We can insert an if clause to check the mode (test /R CMD check
) on our own.Thanks