【问题标题】:Use @SuppressWarnings with the sonar checkstyle plugin将@SuppressWarnings 与声纳检查样式插件一起使用
【发布时间】:2014-12-29 12:16:23
【问题描述】:

我想在声纳中启用@SuppressWarnings 的使用,如以下答案所述:How to disable a particular checkstyle rule for a particular line of code?

但我可以在声纳中配置 checkstyle 特定行为的唯一部分是在项目配置 -> 设置 -> Java -> Checkstyle 下

当我将此配置添加到过滤器文本框时:

<module name="TreeWalker">
  <module name="SuppressWarningsHolder" />
</module>
<module name="SuppressWarningsFilter" />

那么它不接受@SuppressWarnings。有没有办法在声纳中配置它?

【问题讨论】:

    标签: sonarqube checkstyle


    【解决方案1】:

    目前不可能:已创建票证来支持它:http://jira.codehaus.org/browse/SONARCHKST-22

    【讨论】:

    • Ticket 已在 SonarQube Checkstyle 插件 2.3 中实现。
    【解决方案2】:

    对于规则checkstyle:com.puppycrawl.tools.checkstyle.checks.naming.AbstractClassNameCheck 使用:

    @SuppressWarnings("checkstyle:abstractclassname")
    

    另见SONARCHKST-22 SupportSuppressWarningsFilter,如苯佐尼科的回答中所述。这是在 SonarQube Checkstyle 插件 2.3 版中实现的。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2016-08-11
      • 2011-10-05
      • 1970-01-01
      • 2013-11-22
      • 2014-10-24
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多