Skip to content

Commit

Permalink
Merge pull request #570 from jcken95/add-qmd
Browse files Browse the repository at this point in the history
feat: lint .qmd docs
  • Loading branch information
lorenzwalthert authored May 22, 2024
2 parents 21917fb + ea57e1a commit efaa00a
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 2 deletions.
2 changes: 1 addition & 1 deletion .pre-commit-hooks.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@
description: check if a `.R` file is lint free (using {lintr})
entry: Rscript inst/hooks/exported/lintr.R
language: r
files: '(\.[rR]profile|\.R|\.Rmd|\.Rnw|\.r|\.rmd|\.rnw)$'
files: '(\.[rR]profile|\.R|\.Rmd|\.Rnw|\.r|\.rmd|\.rnw|\.[qQ]md)$'
exclude: 'renv/activate\.R'
minimum_pre_commit_version: "2.13.0"
- id: pkgdown
Expand Down
2 changes: 1 addition & 1 deletion inst/pre-commit-hooks.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@
description: check if a `.R` file is lint free (using {lintr})
entry: Rscript inst/hooks/exported/lintr.R
language: r
files: '(\.[rR]profile|\.R|\.Rmd|\.Rnw|\.r|\.rmd|\.rnw)$'
files: '(\.[rR]profile|\.R|\.Rmd|\.Rnw|\.r|\.rmd|\.rnw|\.[qQ]md)$'
exclude: 'renv/activate\.R'
minimum_pre_commit_version: "2.13.0"
- id: pkgdown
Expand Down
8 changes: 8 additions & 0 deletions tests/testthat/in/lintr-fail.qmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
title: "Test doc: fail lintr"
format: html
---

```{r}
sum(1,2)
```
8 changes: 8 additions & 0 deletions tests/testthat/in/lintr-success.qmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
title: "Test doc: success lintr"
format: html
---

```{r}
sum(1, 2)
```
10 changes: 10 additions & 0 deletions tests/testthat/test-hook-lintr.R
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# .R ----

# success
run_test("lintr",
suffix = "-success.R",
Expand All @@ -12,3 +14,11 @@ run_test(
"lintr",
suffix = "-fail.R", cmd_args = "--warn_only", std_err = NULL
)

# .qmd ----

# success
run_test("lintr", suffix = "-success.qmd", std_err = NULL)

# failure
run_test("lintr", suffix = "-fail.qmd", std_err = "not lint free")

0 comments on commit efaa00a

Please sign in to comment.