首页 > 解决方案 > 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
  ^^^^^^   

我不明白这意味着什么以及我应该如何解决它。

谢谢!

标签: ruby

解决方案


这意味着您在这里有一个字符串文字,您绝对不会做任何事情。它需要是字符串文字吗?评论应该很好。


推荐阅读