【发布时间】:2019-05-22 10:08:40
【问题描述】:
我是 writing an R package,接受以下 lint 测试:
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::check() 之后运行 devtools::test(),所有其他测试都会运行两次。
如何让devtools::check() 运行lintr 测试?
【问题讨论】: