java - 如何在 SonarQube 中抑制警告 'Source files should not have any duplicated blocks'?

标签 java sonarqube

我正在使用 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/

相关文章:

MySQLNonTransientConnectionException : Communications link failure during commit(). 事务解析未知

android - 是否可以使用 SonarQube 分析 Android Kotlin 代码覆盖率?

maven - 分支机构项目分析( Sonar 报告)

javascript - Sonarqube 不从 LCOV 检索我的 JavaScript 覆盖率

java - 尝试初始化 ApnsServiceBuilder 时出现异常

java - ical4j 有类型化包装吗?

java - java中如何获取词干后的符号

java - Sonar : How do I use gradle to inspect an android project

java - 需要更改我的 Android 应用程序中的日期格式

java - 用于不同类型子对象的 Libgdx 池