Skip to content

Commit c93c159

Browse files
author
Ben Straub
authored
Merge pull request #116 from pharmaverse/101-set-up-styling-links-and-spelling-checks
Closes #101 set up styling links and spelling checks
2 parents e8f46f4 + 040825f commit c93c159

19 files changed

Lines changed: 1622 additions & 1437 deletions

.github/workflows/link_check.yml

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
name: Links (Fail Fast)
2+
3+
on:
4+
pull_request:
5+
branches:
6+
- main
7+
8+
jobs:
9+
linkChecker:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- uses: actions/checkout@v4
13+
14+
- name: Set up R # Install R from CRAN
15+
uses: r-lib/actions/setup-r@v2
16+
with:
17+
r-version: '4.4.3' # You can specify a different R version if needed
18+
19+
- name: Install R packages
20+
run: |
21+
Rscript -e 'install.packages("fs")'
22+
shell: bash
23+
24+
- name: Link Checker
25+
uses: lycheeverse/lychee-action@v1.8.0
26+
with:
27+
fail: true
28+
env:
29+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/spellcheck.yml

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
name: Spellcheck
2+
on:
3+
pull_request:
4+
branches: ['main']
5+
jobs:
6+
Spelling:
7+
runs-on: ubuntu-latest
8+
container:
9+
image: "rocker/tidyverse:4.3.1"
10+
steps:
11+
- name: Checkout repo
12+
uses: actions/checkout@v4
13+
14+
- name: Install packages
15+
run: |
16+
if (!require("roxygen2")) install.packages("roxygen2")
17+
if (!require("spelling")) install.packages("spelling")
18+
if (!require("testthat")) install.packages("testthat")
19+
shell: Rscript {0}
20+
21+
- name: Check spelling
22+
run: |
23+
library(spelling)
24+
25+
# Check the entire package (R files, documentation, vignettes, etc.)
26+
words <- spelling::spell_check_package()
27+
28+
print(words)
29+
30+
testthat::test_that(desc = "Check spelling", code = {
31+
testthat::expect_equal(
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+
}
40+
)
41+
})
42+
shell: Rscript {0}

.github/workflows/style_check.yml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
name: Style
2+
on:
3+
pull_request: {branches: ['main']}
4+
5+
jobs:
6+
Style:
7+
runs-on: ubuntu-latest
8+
container: {image: "rocker/tidyverse:4.2.1"}
9+
steps:
10+
- name: Checkout repo
11+
uses: actions/checkout@v4
12+
- name: Install styler
13+
run: install.packages("styler")
14+
shell: Rscript {0}
15+
- name: styler version
16+
run: packageVersion("styler")
17+
shell: Rscript {0}
18+
- name: Run styler
19+
run: styler::style_dir(dry = "fail")
20+
shell: Rscript {0}

0 commit comments

Comments
 (0)