我正在编写一个带有以下 lint 测试的 R 包:
context("Require no code style errors")
library(lintr)
test_that("Package has no lintr errors", {
lintr::expect_lint_free()
})
测试通过 `devtools::check():
$ Rscript -e "devtools::check()"
...
─ checking tests ...
✔ Running ‘testthat.R’ [61s/65s]
...
0 errors ✔ | 0 warnings ✔ | 0 notes ✔
并且无绒测试失败devtools::test()
:
$ Rscript -e "devtools::test()"
...
Testing PosteriorBootstrap
...
✖ | 0 1 | Require no code style errors [6.2 s]
────────────────────────────────────────────────────────────────────────────────
test_lintr.R:5: failure: Package has no lintr errors
Not lint free
tests/testthat/test_anpl.R:112:1: style: Trailing whitespace is superfluous.
^~
...
OK: 20
Failed: 1
Warnings: 0
Skipped: 0
问题是 Github 和 Travis 被设置为拒绝测试失败的拉取请求,如果我在devtools::test()
之后运行devtools::check()
,所有其他测试都会运行两次。
我怎样才能devtools::check()
运行lintr
测试?