首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Gitlab CI - lintr的管道

Gitlab CI - lintr的管道
EN

Stack Overflow用户
提问于 2021-11-30 15:56:31
回答 2查看 81关注 0票数 0

我想在gitlab中有一个使用lintr执行静态代码分析的管道。这是.gitlab-ci.yml:

代码语言:javascript
复制
image: r-base
variables:
  ALLOWED_WARNINGS: 0
  ALLOWED_NOTES: 0
  NO_IMPORTS: 0


check:
  script:
  - Rscript -e "Sys.setenv(GITHUB_PAT = 'my_pat')"
  - Rscript -e "install.packages(c('lintr', 'rcmdcheck', 'usethis', 'remotes'))"
  - Rscript -e "remotes::install_github('jumpingrivers/inteRgrate', auth_token = 'my_pat')"
  - Rscript -e "inteRgrate::check_lintr(path = '.')"

//EDIT但是我得到了这个错误信息:

代码语言:javascript
复制
Installing package into ‘/usr/local/lib/R/site-library’
(as ‘lib’ is unspecified)
ERROR: dependencies ‘lintr’, ‘rcmdcheck’, ‘usethis’ are not available for package ‘inteRgrate’
* removing ‘/usr/local/lib/R/site-library/inteRgrate’
There were 11 warnings (use warnings() to see them)
$ Rscript -e "inteRgrate::check_lintr(path = '.')"
Error in loadNamespace(x) : there is no package called ‘inteRgrate’
Calls: loadNamespace -> withRestarts -> withOneRestart -> doWithOneRestart
Execution halted
Cleaning up project directory and file based variables
00:01
ERROR: Job failed: exit code 1

执行此操作的正确方法是什么?

EN

回答 2

Stack Overflow用户

发布于 2021-11-30 17:30:39

应该只是一个“嵌套”双引号的问题。这些语法可以接受吗?

代码语言:javascript
复制
 - Rscript -e 'check_lintr(path = ".")'

代码语言:javascript
复制
 - Rscript -e "check_lintr(path = .)"

正如r2evans在注释中建议的那样,这应该是一个更简单的语法:

代码语言:javascript
复制
 - Rscript -e "check_lintr()"
票数 0
EN

Stack Overflow用户

发布于 2021-11-30 21:13:42

尝试向install.packages()添加verbose标志,这样就可以看到发生了什么。

票数 -1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/70172287

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档