Skip to content

Commit d9d0760

Browse files
committed
Check suggests field in description
1 parent c20a15e commit d9d0760

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

R/spell-check.R

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ spell_check_setup <- function(pkg = ".", vignettes = TRUE, lang = "en_GB", error
124124
writeLines(sprintf("spelling::spell_check_test(vignettes = %s, lang = %s, error = %s)",
125125
deparse(vignettes), deparse(lang), deparse(error)), file.path(pkg$path, "tests/spelling.R"))
126126
cat(sprintf("Updated %s\n", file.path(pkg$path, "tests/spelling.R")))
127-
try(add_to_description(file.path(pkg$path, "DESCRIPTION")))
127+
try(add_to_description(pkg))
128128
}
129129

130130
#' @export
@@ -162,9 +162,10 @@ spell_check_test <- function(vignettes = TRUE, lang = "en_GB", error = FALSE){
162162
cat("All Done!\n")
163163
}
164164

165-
add_to_description <- function(desc){
166-
lines <- readLines(desc, warn = FALSE)
167-
if(!any(grepl("spelling", lines))){
165+
add_to_description <- function(pkg){
166+
if(!grepl("spelling", pkg$suggests)){
167+
desc <- normalizePath(file.path(pkg$path, "DESCRIPTION"), mustWork = TRUE)
168+
lines <- readLines(desc, warn = FALSE)
168169
out <- if(!any(grepl("^Suggests", lines))){
169170
c(lines, "Suggests:\n spelling")
170171
} else {

0 commit comments

Comments
 (0)