Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: lint .qmd docs #570

Merged
merged 6 commits into from
May 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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")
Loading