我得到了下面的代码:如何抑制Scalastyle警告?
string match {
case Regex(_, "1", "0", _, _) =>
case Regex(_, "1", "1", null, _) =>
}
Scalastyle抱怨不能避免在这里空的使用。 任何方式我可以压制这条线的警告?
我得到了下面的代码:如何抑制Scalastyle警告?
string match {
case Regex(_, "1", "0", _, _) =>
case Regex(_, "1", "1", null, _) =>
}
Scalastyle抱怨不能避免在这里空的使用。 任何方式我可以压制这条线的警告?
Scalastyle理解抑制评论:
// scalastyle:off <rule id>
...
// scalastyle:on <rule id>
该文档为每个规则的ID:http://www.scalastyle.org/rules-0.4.0.html
在你的情况下,ID只是一个空:
// scalastyle:off null
...
// scalastyle:on null
对于单行线,你只是追加// scalastyle:ignore <rule-id>
到最后,就像这样:
string match {
case Regex(_, "1", "0", _, _) =>
case Regex(_, "1", "1", null, _) => // scalastyle:ignore null
}
如果很明显你想Scalastyle忽略,你可以通过省略规则的编号禁用当前行所有检查什么(正如你可以为开/关评论一样):
string match {
case Regex(_, "1", "0", _, _) =>
case Regex(_, "1", "1", null, _) => // scalastyle:ignore
}