Skip to content

Commit efaa00a

Browse files
Merge pull request #570 from jcken95/add-qmd
feat: lint .qmd docs
2 parents 21917fb + ea57e1a commit efaa00a

File tree

5 files changed

+28
-2
lines changed

5 files changed

+28
-2
lines changed

.pre-commit-hooks.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@
110110
description: check if a `.R` file is lint free (using {lintr})
111111
entry: Rscript inst/hooks/exported/lintr.R
112112
language: r
113-
files: '(\.[rR]profile|\.R|\.Rmd|\.Rnw|\.r|\.rmd|\.rnw)$'
113+
files: '(\.[rR]profile|\.R|\.Rmd|\.Rnw|\.r|\.rmd|\.rnw|\.[qQ]md)$'
114114
exclude: 'renv/activate\.R'
115115
minimum_pre_commit_version: "2.13.0"
116116
- id: pkgdown

inst/pre-commit-hooks.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@
110110
description: check if a `.R` file is lint free (using {lintr})
111111
entry: Rscript inst/hooks/exported/lintr.R
112112
language: r
113-
files: '(\.[rR]profile|\.R|\.Rmd|\.Rnw|\.r|\.rmd|\.rnw)$'
113+
files: '(\.[rR]profile|\.R|\.Rmd|\.Rnw|\.r|\.rmd|\.rnw|\.[qQ]md)$'
114114
exclude: 'renv/activate\.R'
115115
minimum_pre_commit_version: "2.13.0"
116116
- id: pkgdown

tests/testthat/in/lintr-fail.qmd

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
---
2+
title: "Test doc: fail lintr"
3+
format: html
4+
---
5+
6+
```{r}
7+
sum(1,2)
8+
```
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
---
2+
title: "Test doc: success lintr"
3+
format: html
4+
---
5+
6+
```{r}
7+
sum(1, 2)
8+
```

tests/testthat/test-hook-lintr.R

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# .R ----
2+
13
# success
24
run_test("lintr",
35
suffix = "-success.R",
@@ -12,3 +14,11 @@ run_test(
1214
"lintr",
1315
suffix = "-fail.R", cmd_args = "--warn_only", std_err = NULL
1416
)
17+
18+
# .qmd ----
19+
20+
# success
21+
run_test("lintr", suffix = "-success.qmd", std_err = NULL)
22+
23+
# failure
24+
run_test("lintr", suffix = "-fail.qmd", std_err = "not lint free")

0 commit comments

Comments
 (0)