【问题标题】:Sonar 2.9 does not import SuppressionFilterSonar 2.9 不导入 SuppressionFilter
【发布时间】:2011-12-24 05:57:07
【问题描述】:

我正在尝试使用我的 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 的特定检查中排除特定文件?

【问题讨论】:

    标签: sonarqube checkstyle static-code-analysis


    【解决方案1】:

    您可以set the Suppression(Comment)Filters manually: 转到配置 -> 常规设置 -> Java -> CheckStyle。有一个输入框。将 checkstyle.xml 文件中的 <module> 定义粘贴到输入框中。相对路径是从 .sonar 文件夹中解释的。您的 2.9 中存在此功能,我认为它是在 2.3 中添加的。

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

    【讨论】:

    • 感谢托马斯的回答。只是一个更正,我认为路径是相对于当前目录的,在大多数情况下是项目的父目录。从您的回答中得到提示,我在配置中手动提到了 .sonar 文件夹中的路径,这样当前目录看起来更干净..! :)
    猜你喜欢
    • 1970-01-01
    • 2014-10-30
    • 2017-09-01
    • 2015-09-24
    • 1970-01-01
    • 1970-01-01
    • 2013-10-30
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多