可查找未彻底覆盖异常状态的代码片段的工具

发布于 2024-11-07 12:17:49 字数 104 浏览 3 评论 0原文

我想找到一个好的工具来分析我的代码并发现丢失异常状态处理可能出现的问题,例如空检查、数字溢出等。

有什么建议吗?

编辑:这也与测试有关,即如何找到测试弱覆盖的点。

I would like to find a good tool that will analyze my code and find possible problems with missing exceptional states handling, like null checking, numerical overflows ect..

Any recommendations?

Edit: this was retlated to testing too i.e. how to find spots that are weakly covered by tests.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

百变从容 2024-11-14 12:17:49

就我个人而言,我使用 PMD 和 Findbugs:

这两者之间有很多重叠,但是您可以为两者配置自定义规则集和规则他们,如果需要,您还可以编写自己的规则。

不幸的是,任何静态分析工具在发现异常状态的潜在问题方面所能做的事情都是有限的。话虽如此,这两个工具都指出了我所处理的代码中的问题,如果客户在我们发布后发现问题,那么这些问题将浪费大量时间进行调试。

[编辑] 要覆盖代码的动态部分,请使用 EclEmma 和单元测试。 EclEmma 在内部使用 Emma ,您也可以在没有 Eclipse 的情况下使用它。

Personally, I use PMD and Findbugs:

There's a lot of overlap between those two, but you can configure custom rulesets and rules for both of them, and you can also code your own rules if you want.

Unfortunately, what any static analysis tools can do with regards to finding potential problems with exceptional states is somewhat limited. Having said that, both of these tools has pointed out problems in code I've worked on that would have wasted a lot of time to debug if a client had found the problem after we released.

[EDIT] To cover the dynamic part of the code, use EclEmma and unit tests. EclEmma uses Emma internally, which you could use without Eclipse as well.

北城挽邺 2024-11-14 12:17:49

像 Netbeans 或 Eclipse 这样的优秀 IDE 应该尽可能广泛地做到这一点。编译器消息也应该有所帮助。

剩下的就取决于你了(这意味着:测试、测试、再测试)。

A good IDE like Netbeans or Eclipse should do that as wide as it's possible. The Compilers messages should help, too.

The rest is up to you (that means: testing, testing and testing).

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文