ruby - W: Lint/Void: Lital <<-DOC 在 void 上下文中使用
问题描述
代码如下:
def stratified_subsampling(arr, n_strata, n_points, srand)
<<-DOC
The function samples "n_points" points from an array "arr".
It preserves the original distribution of the data. "n_strata"
is the number of strata to devide the values in. Have to find a
trade-off for this value, but I think that as a rule of thumb,
10 bins should be fair enough in most cases.
DOC
vs = arr.sort
...
Rubocop 说:
W: Lint/Void: Literal <<-DOC used in void context.
<<-DOC
^^^^^^
我不明白这意味着什么以及我应该如何解决它。
谢谢!
解决方案
这意味着您在这里有一个字符串文字,您绝对不会做任何事情。它需要是字符串文字吗?评论应该很好。
推荐阅读
- sql-server - 是否有总索引碎片的指标?
- php - 如果另一种交付方式可用,则隐藏一种交付方式 Woocommerce
- python - 找不到`protoc`命令
- amazon-web-services - EC2 多应用程序实例 - 某些端口无法访问
- wordpress - 如何在我的 wordpress 主题中制作预订表格
- javascript - 套接字挂断后nodejs api不起作用并自动解决
- mysql - 仅允许一行用于特定值,但不允许其他值
- javascript - 有没有办法从 URL 导入脚本包?
- c# - 重复事件未在通知中返回实际 ID
- c# - 错误请求错误 400:使用 mime 请求使用 web 服务