如何为特定文件/目录指定特定的Scala样式规则?

问题描述 投票:0回答:2

我有一些黄瓜stepDef步骤,长度超过120个字符,我想从Scala风格警告中排除所有stepDef文件。

有没有一种方法可以排除特定的文件/目录,仅使用 xml 标签来满足

FileLineLengthChecker
条件?

scala sbt scalastyle
2个回答
1
投票

将整个文件包含在以下注释过滤器中实际上会将该文件从

FileLineLengthChecker
规则中排除:

// scalastyle:off line.size.limit
val foobar = 134
// scalastyle:on line.size.limit

line.size.limit
FileLineLengthChecker
规则的 ID。

可以像这样同时关闭多个规则

// scalastyle:off line.size.limit
// scalastyle:off line.contains.tab
// ...

0
投票

scalastyle必须配对使用

// scalastyle:off line.size.limit

_FUNC_(str, regexp) - Searches a string for a regular expression and returns an integer that indicates the beginning position of the matched substring. Positions are 1-based, not 0-based. If no match is found, returns 0.

// scalastyle:on line.size.limit

© www.soinside.com 2019 - 2024. All rights reserved.