Checkstyle与PMD [英] Checkstyle vs. PMD

查看:86
本文介绍了Checkstyle与PMD的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们将静态分析工具引入到我们的Java产品的构建系统中。我们正在使用Maven2,因此 Checkstyle PMD 集成免费提供。然而,就强制执行基本样式规则而言,这两个工具之间的功能似乎存在很大的重叠。

We are introducing static analysis tools into the build system for our Java product. We are using Maven2 so Checkstyle and PMD integration come for free. However it looks like there is a large overlap in functionality between these two tools, in terms of enforcing basic style rules.

利用这两者是否有好处?我不想维护2个工具,如果一个工作。如果我们选择一个,我们应该使用哪个以及为什么?

Is there a benefit from utilizing both of these? I don't want to maintain 2 tools if one will work. If we choose one, which one should we use and why?

我们还计划使用FindBugs。我们应该看看其他静态分析工具吗?

We are also planning on using FindBugs. Are there other static analysis tools we should look at?

更新:共识似乎是PMD比CheckStyle更受欢迎。我没有看到使用两者的可靠理由,我不想维护两组规则文件,因此我们可能会专门针对PMD。我们还将引入FindBugs,也许最终会引入Macker来强制执行架构规则。

Update: Consensus seems to be that PMD is preferred over CheckStyle. I don't see a solid reason to use both, and I don't want to maintain 2 sets of rule files, so we will probably aim for PMD exclusively. We'll also be bringing in FindBugs, and perhaps, eventually, Macker to enforce architectural rules.

推荐答案

你一定要使用< a href =http://findbugs.sourceforge.net/ =noreferrer> FindBugs 。根据我的经验,假阳性率非常低,即使是最不重要的警告也值得在一定程度上解决。

You should definitely use FindBugs. In my experience, the false-positive rate is very low, and even the least-critical warnings it reports are worth addressing to some extent.

至于Checkstyle vs. PMD ,我不会使用Checkstyle,因为它几乎只关注风格。根据我的经验,Checkstyle将报告大量完全不相关的事情。另一方面,PMD也能够指出可疑的编码实践,其输出通常更具相关性和实用性。

As for Checkstyle vs. PMD, I would not use Checkstyle since it is pretty much only concerned with style. In my experience, Checkstyle will report on a ton of things that are completely irrelevant. PMD on the other hand is also able to point out questionable coding practices and its output is generally more relevant and useful.

这篇关于Checkstyle与PMD的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆