[英]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.