简体   繁体   English

如何在SonarQube中检测未使用的集合?

[英]How do I detect unused collections in SonarQube?

We've found a bug in our code that I can't seem to find a SonarQube rule for. 我们在代码中发现了一个似乎无法找到SonarQube规则的错误。 I think it's an interesting one because IntelliJ's analysis will display a very helpful message: 我认为这很有趣,因为IntelliJ的分析将显示一条非常有用的信息:

Contents of collection 'XXXX' are updated, but never queried 集合“ XXXX”的内容已更新,但从未查询过

Reports collection fields or variables whose contents are either queried and not updated, or updated and not queried. 报告其内容被查询且未更新,或已更新且未查询的集合字段或变量。 Such mismatched queries and updates are pointless, and may indicate either dead code or a typographical error. 这样的不匹配查询和更新是毫无意义的,并且可能指示无效代码或印刷错误。

The warning identifier seems to be MismatchedQueryAndUpdateOfCollection . 警告标识符似乎是MismatchedQueryAndUpdateOfCollection

Is there any analogous warning in SonarQube? SonarQube中是否有类似的警告?

Thanks! 谢谢!

我刚刚在fb-contrib插件中找到了它:

fb-contrib:WOC_WRITE_ONLY_COLLECTION_FIELD

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM