English 中文(简体)
PMD与FindBugs之间的差别如何?
原标题:What are the differences between PMD and FindBugs?

有一个?question comparing PMD and CheckStyle。 然而,我看不到有关PMD和FindBugs之间差异/相似之处的细微。 我认为,一个关键区别是,PMD在源代码上工作,而FindBugs则在编集的密码档案上工作。 但是,在能力方面,它是否是选择还是相互补充?

最佳回答

两者都使用。 我认为两者相辅相成。

如你所说,PMD在源代码上开展工作,因此发现的问题有:违反命名公约、缺乏可治愈的薄膜、错误检查、长期参数清单、不必要建筑商、开关等。 PMD还告诉你,我觉得非常有帮助的贵国法典的Cyclomatic diversity(FindBugs确实没有告诉你有关气旋的复杂性)。

FindBugs。 FindBugs 发现,PMD 有一些问题:等同方法在子类中失败,布林法可能退回无效,参照Boolelean的价值观,不可能投放,有32条轨道上的转移,其数额不在0-31之间,这种收集本身含有平等的方法,总是真实的,是无限的 lo。

通常,其中每一个国家都发现不同的问题。 两者都使用。 这些工具向我教授了许多如何撰写好 Java法。

问题回答

PMD的最佳特征是XPath Rules,与一名规则设计师联手,使你能够方便地从代码样本(类似于RegEx和XPath GUI建筑商)中制定新规则。 FindBugs从箱子中更强大,但制定项目具体规则和模式非常重要。

例如,我遇到一个表现问题,涉及2个 lo,导致奥(n^2)运行时间,很容易避免。 我利用PMD建造了ad-hoc query,以审查其他为休息而设的例子——/ForStatement/Statement//ForStatement。 这又指出了这一问题的两例。 这不是一条通用规则。

PMD

  • famous
  • used widely in industry
  • you can add your rules in xml
  • gives you detailed analysis in Errors levels and warning levels
  • you can also scan your code for "copy and paste lines". Duplicate code. This gives good idea about implementing java oops.




相关问题
Spring Properties File

Hi have this j2ee web application developed using spring framework. I have a problem with rendering mnessages in nihongo characters from the properties file. I tried converting the file to ascii using ...

Logging a global ID in multiple components

I have a system which contains multiple applications connected together using JMS and Spring Integration. Messages get sent along a chain of applications. [App A] -> [App B] -> [App C] We set a ...

Java Library Size

If I m given two Java Libraries in Jar format, 1 having no bells and whistles, and the other having lots of them that will mostly go unused.... my question is: How will the larger, mostly unused ...

How to get the Array Class for a given Class in Java?

I have a Class variable that holds a certain type and I need to get a variable that holds the corresponding array class. The best I could come up with is this: Class arrayOfFooClass = java.lang....

SQLite , Derby vs file system

I m working on a Java desktop application that reads and writes from/to different files. I think a better solution would be to replace the file system by a SQLite database. How hard is it to migrate ...

热门标签