我正在使用 SonarQube 5.4 并调查几个问题的抑制。我发现一旦我插入 @SuppressWarnings("common-java:DuplicatedBlocks")
,SonarQube 就没有检测到抑制规则 Source files should not have any duplicated blocks在文件的开头(文件无法编译)或在其中一个重复代码块的标记处。
我在 http://docs.sonarqube.org/display/PLUG/Java+FAQ 找到了信息声明如下:
The //NOSONAR tag is useful to deactivate all rules at a given line but is not suitable to deactivate all rules (or only a given rule) for all the lines of a method or a class. This is why support for @SuppressWarnings("all") has been added to SonarQube.
我使用的是 SonarQube Java 插件 3.13.1 版本。
我知道我可以将 SonarQube GUI 中的问题标记为误报,但这不会通过分支转移,这对我来说是必需的功能。
我应该如何使用 @SuppressWarnings
标签来禁用重复的代码块?
最佳答案
这是一项不受支持的功能:https://jira.sonarsource.com/browse/SONARJAVA-521
目前没有实现它的计划,但将来可能会解决这个问题。
关于java - 如何在 SonarQube 中抑制警告 'Source files should not have any duplicated blocks'?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36983618/