Skip to content

Commit c0c667e

Browse files
committed
#101 update spellcheck workflow to check R instead of qmd
1 parent 4f47c6d commit c0c667e

1 file changed

Lines changed: 13 additions & 26 deletions

File tree

.github/workflows/spellcheck.yml

Lines changed: 13 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -18,38 +18,25 @@ jobs:
1818
if (!require("testthat")) install.packages("testthat")
1919
shell: Rscript {0}
2020

21-
- name: Remove links from .qmd files (Bash)
22-
run: |
23-
find . -type f -name "*.qmd" -print0 | while IFS= read -r -d '' file; do
24-
sed -i -E '
25-
s/\[([^\]]+)\]\((https?:\/\/[^)]+)\)/\1/g; # Remove Markdown links, keep text
26-
s#https?://[a-zA-Z0-9./?=_-]+(\#[a-zA-Z0-9_-]*)?##g # Remove standalone URLs, including fragments
27-
' "$file"
28-
echo "Processed: $file"
29-
done
30-
shell: bash
31-
3221
- name: Check spelling
3322
run: |
3423
library(spelling)
35-
library(readr)
36-
37-
qmd_files <- list.files(pattern = ".*\\.qmd$", recursive = TRUE)
38-
39-
words <- spelling::spell_check_files(
40-
qmd_files,
41-
ignore = read_lines("inst/WORDLIST")
42-
)
43-
24+
25+
# Check the entire package (R files, documentation, vignettes, etc.)
26+
words <- spelling::spell_check_package()
27+
4428
print(words)
45-
29+
4630
testthat::test_that(desc = "Check spelling", code = {
4731
testthat::expect_equal(
48-
object = words,
49-
expected = spelling::spell_check_files(
50-
path = "inst/WORDLIST",
51-
ignore = read_lines("inst/WORDLIST")
52-
)
32+
object = nrow(words),
33+
expected = 0,
34+
info = if (nrow(words) > 0) {
35+
paste("Spelling errors found:\n",
36+
paste(capture.output(print(words)), collapse = "\n"))
37+
} else {
38+
"No spelling errors"
39+
}
5340
)
5441
})
5542
shell: Rscript {0}

0 commit comments

Comments
 (0)