简体   繁体   English

devtools::check_man() 给出错误但 devtools::check() 没有

[英]devtools::check_man() gives error but devtools::check() does not

I'm developing a package ( https://github.com/dpmcsuss/iGraphMatch/ ).我正在开发 package ( https://github.com/dpmcsuss/iGraphMatch/ )。

I just started using devtools::check() etc to check for issues.我刚开始使用devtools::check()等来检查问题。 Currently, I'm getting no errors, warnings, or notes (YAY).目前,我没有收到任何错误、警告或注释 (YAY)。

Unfortunately, sometimes I want to use devtools::check_man() to just check the documentation for issues since that should be much faster.不幸的是,有时我想使用devtools::check_man()来检查文档中的问题,因为这应该更快。 When I run this I get the following output.当我运行它时,我得到以下 output。

> devtools::check_man()
Updating iGraphMatch documentation
Loading iGraphMatch
Writing NAMESPACE
Writing NAMESPACE
Checking documentation...
Error: cannot source package code:
cannot add bindings to a locked environment

I've tried detaching the package, unloading the namespace, making sure files were not locked, uninstalling the package, .... Nothing seems to make a difference.我试过分离 package,卸载命名空间,确保文件没有被锁定,卸载 package,.... 似乎没有什么不同。

If I make a new package everything works fine.如果我制作一个新的 package 一切正常。 I realize this is far from a minimum working example but I'm pretty unsure about where to start looking.我意识到这远不是一个最小的工作示例,但我不确定从哪里开始寻找。 Any suggestions would be appreciated.任何建议,将不胜感激。 (One thing that I haven't explored yet is whether the order things are documented matters.) (我还没有探索过的一件事是事物的顺序是否记录在案。)

This looks like a bug in R.这看起来像是 R 中的错误。 If you delete all your code except for the setClass in matrix_list.R , you still get the error.如果删除matrix_list.R中的setClass之外的所有代码,您仍然会收到错误消息。 If you delete the matrix_list.R file and nothing else, you don't.如果您删除matrix_list.R文件而没有其他内容,则不会。

This happens if you use tools::checkDocStyle(dir = "iGraphMatch") , you don't need devtools involved at all.如果您使用tools::checkDocStyle(dir = "iGraphMatch") devtools发生这种情况,您根本不需要涉及开发工具。

I'd conclude that there's some incompatibility between the tools::checkDocStyle function and S4 methods::setClass .我得出的结论是 tools::checkDocStyle function 和 S4 methods::setClass之间存在一些不兼容。 I have no idea if there's a workaround.我不知道是否有解决方法。

Edited to add: There's a fairly simple workaround for this bug.编辑添加:这个错误有一个相当简单的解决方法。 Instead of using the code而不是使用代码

matrix_list <- setClass("matrix_list", contains = "list")

in the matrix_list.R file, use this nearly equivalent code:matrix_list.R文件中,使用这个几乎等效的代码:

setClass("matrix_list", contains = "list")

matrix_list <- function(...)
  new("matrix_list", ...)

This avoids triggering the bug in tools::checkDocStyle .这避免了触发tools::checkDocStyle中的错误。 It's not quite identical, because the original adds some extra attributes on the generator function, but it should probably be close enough.它并不完全相同,因为原版在生成器 function 上添加了一些额外的属性,但它可能应该足够接近。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 在另一个 package 中包含插入符号会在 devtools::check() 期间出现错误 - “没有 package 称为 'lattice'” - Including caret in another package gives error during devtools::check() - “there is no package called 'lattice'” 无法理解 devtools::check() 中的 1 个注释 - Unable to understand 1 note in devtools::check() devtools::check() - 没有 package 称为“矩阵” - devtools::check() - no package called ‘Matrix’ devtools :: check()错误:依赖包“ flextable”不可用 - devtools::check() Error: Dependency package(s) 'flextable' not available devtools :: test()有效,但devtools :: check()没有。 为什么? - devtools::test() works but devtools::check() doesn't. Why? lintr测试使用devtools :: check()传递,并使用devtools :: test()失败 - lintr test passes with devtools::check() and fails with devtools::test() "testthat 在 devtools::check 中失败,但在 devtools::test 中有效" - testthat fails within devtools::check but works in devtools::test devtools::check 因 cpp_object_initializer 而失败 - devtools::check fails with cpp_object_initializer devtools::check 由于小插图构建而失败 - devtools::check fails because of vignette building R CMD check (devtools:check()) with keep.source = TRUE 可能吗? - Is R CMD check (devtools:check()) with keep.source = TRUE possible?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM