说明:本文为了练习英语,有英文说明和中文翻译。想直接看中文,快速翻一页即可。
文章目录
什么是PMD?
PMD is an open source static source code analyzer
that reports on issues found within application code. PMD includes built-in rule sets
and supports the ability to write custom rules
. PMD does not report compilation errors, as it only can process well-formed source files. Issues reported by PMD are rather inefficient code, or bad programming habits, which can reduce the performance and maintainability of the program if they accumulate. It can analyze files written in Java, JavaScript, Apex and Visualforce, PLSQL, Apache Velocity, XML, and XSL.
While PMD does not officially stand for anything, it has several unofficial names, the most appropriate probably being Programming Mistake Detector.
PMD是一款静态代码分析器,可以报告程序代码的问题。PMD包含内建的规则和支持自定义规则。PMD不支持报告编译错误
,因此可以很好的处理源代码文件。PMD报告的问题都是一些低效率代码
,或坏的编程习惯
,可能导致性能或者维护困难的代码
。它可以处理Java
,JavaScript
,Apex
,Visualforece
,PLSQL
,Apache
,和SQL文件
。但是PMD并没有官方的名字,有一些非官方称呼,最著名的莫过于:Programming Mistake Detector.
参考:PMD wiki
什么是FindBugs?
FindBugs is an open-source static code analyser created by Bill Pugh and David Hovemeyer which detects possible bugs in Java programs. Potential errors are classified in four ranks: (i) scariest, (ii) scary, (iii) troubling and (iv) of concern. This is a hint to the developer about their possible impact or severity. FindBugs operates on Java bytecode, rather than source code. The software is distributed as a stand-alone GUIapplication. There are also plug-ins available for Eclipse, NetBeans, IntelliJIDEA, Gradle, Hudson,Maven, Bamboo and Jenkins.
Additional rule sets can be plugged in FindBugs to increase the set of checks performed.
A successor to FindBugs, called SpotBugs, has been created.
FindBugs 是一款静态代码检查器
,由 Bill Pugh
和 David Hovemeyer
创建的,它可以检查java代码可能出现的bug,潜在错误分为4个等级:
- (i) 可怕的(scariest)
- (ii) 吓人的(scary)
- (iii) 问题(troubling)
- (iv) of 令人担心(concern)
这是隐藏在开发中的隐患,FindBugs操作针对的是Java字节码
,比源码更深入。它有GUI版本
。Eclipse, NetBeans, IntelliJIDEA, Gradle, Hudson,Maven, Bamboo and Jenkins
有对应插件。FindBugs中也有一系列的规则
。
FindBugs,有一款继任者–SpotBugs
。
补充一个Android插件,集成了Lint、KtLint、UnitTest、Checkstyle、Findbugs、Pmd.