1

我正在尝试使用我的 checkstyle 规则 xml 在 Sonar 2.9 中创建新的规则配置文件。当我尝试导入配置了抑制过滤器的 checkstyle 规则文件时,声纳会给我以下消息:

Profile 'test2' created. Set it as default or link it to a project to use it for next measures.   [hide]
Checkstyle filters are not imported: SuppressionCommentFilter
Checkstyle filters are not imported: SuppressionFilter   [hide]

我现在不关心 SuppressionCommentFilter,但是如何启用 SuppressionFilter?如果不可能,是否有任何其他方法可以具有类似的功能,从 Sonar 的特定检查中排除特定文件?

4

1 回答 1

3

您可以手动设置抑制(评论)过滤器:转到配置 -> 常规设置 -> Java -> CheckStyle。有一个输入框。将 checkstyle.xml 文件中的定义粘贴<module>到输入框中。相对路径是从 .sonar 文件夹中解释的。此功能存在于您的 2.9 中,我认为它是在 2.3 中添加的。

就我的所有目的而言,这个功能就足够了。据我所知,实际导入过滤器模块定义是不可能的。可能是较新版本的声纳可以做到这一点。

于 2012-03-31T21:21:39.207 回答