FindBugs
FindBugs, a program which uses static analysis to look for bugs in Java code. It is free software, distributed under the terms of the Lesser GNU Public License. The name FindBugs™ and the FindBugs logo are trademarked by The University of Maryland. FindBugs has been downloaded more than a million times.
- FindBugs:http://findbugs.sourceforge.net/
- spotbugs(FindBugs繼承者): https://spotbugs.github.io/
- FindBugs Bug Descriptions:http://findbugs.sourceforge.net/bugDescriptions.html
- FindBugs詳解: http://www.cnblogs.com/jiangxinnju/p/6582404.html
- FindBugs Maven Plugin(for Maven 1.x): http://maven-plugins.sourceforge.net/maven-findbugs-plugin/
- FindBugs Maven Plugin(for Maven 2.0+): https://gleclaire.github.io/findbugs-maven-plugin/
CheckStyle
Checkstyle is a development tool to help programmers write Java code that adheres to a coding standard. It automates the process of checking Java code to spare humans of this boring (but important) task. This makes it ideal for projects that want to enforce a coding standard.
- CheckStyle:http://checkstyle.sourceforge.net/
- Eclipse Checkstyle Plug-in: https://sourceforge.net/projects/eclipse-cs/
- Checkclipse: https://sourceforge.net/projects/checkclipse/
- maven-checkstyle-plugin: http://maven.apache.org/plugins/maven-checkstyle-plugin/
PMD
PMD is a source code analyzer. It finds common programming flaws like unused variables, empty catch blocks, unnecessary object creation, and so forth. It supports Java, JavaScript, Salesforce.com Apex and Visualforce, PLSQL, Apache Velocity, XML, XSL.
Additionally it includes CPD, the copy-paste-detector. CPD finds duplicated code in Java, C, C++, C#, Groovy, PHP, Ruby, Fortran, JavaScript, PLSQL, Apache Velocity, Scala, Objective C, Matlab, Python, Go, Swift and Salesforce.com Apex and Visualforce.
- PMD:https://pmd.github.io/
- PMD Rules: https://pmd.github.io/pmd-5.3.6/pmd-java/rules/index.html
- maven-pmd-plugin: http://maven.apache.org/plugins/maven-pmd-plugin/
Jdepend
JDepend traverses Java class file directories and generates design quality metrics for each Java package. JDepend allows you to automatically measure the quality of a design in terms of its extensibility, reusability, and maintainability to manage package dependencies effectively.
- Jdepend:http://www.clarkware.com/software/JDepend.html
- JDepend4Eclipse:http://marketplace.eclipse.org/content/jdepend4eclipse
- JDepend Maven Plugin: http://www.mojohaus.org/jdepend-maven-plugin/index.html
Emma
a free Java code coverage tool
- Emma:http://emma.sourceforge.net/
- eclemma(Emma Eclipse Plugin, 開始基於Emma後來基於JaCoCo):http://www.eclemma.org/
- maven-emma-plugin(for Maven 1.x): http://emma.sourceforge.net/maven-emma-plugin/
- emma-maven-plugin(for Maven 2.0+): https://github.com/jiangxincode/emma-maven-plugin
- JaCoCo: https://www.eclemma.org/jacoco/index.html
- Getting “Skipping JaCoCo execution due to missing execution data file” upon executing JaCoCo? https://stackoverflow.com/questions/18107375/getting-skipping-jacoco-execution-due-to-missing-execution-data-file-upon-exec
- Testng, Emma, Cobertura, coverage and JDK 7 result in ClassFormatError and VerifyError: https://stackoverflow.com/questions/7010665/testng-emma-cobertura-coverage-and-jdk-7-result-in-classformaterror-and-verif
- Java 6 -> 7 migration ClassFormatError: Illegal local variable table length: https://stackoverflow.com/questions/21917985/java-6-7-migration-classformaterror-illegal-local-variable-table-length
Cobertura
Cobertura is a free Java code coverage reporting tool.
- Cobertura: https://github.com/christ66/cobertura
- eCobertura(Cobertura Eclipse Plugin):http://ecobertura.johoop.de/
- cobertura-maven-plugin: http://www.mojohaus.org/cobertura-maven-plugin/
- 學習Maven之Cobertura Maven Plugin: https://www.cnblogs.com/qyf404/archive/2015/12/12/5040593.html
JavaNCSS
JavaNCSS - A Source Measurement Suite for Java
- JavaNCSS: http://www.kclee.de/clemens/java/javancss/
- javancss-maven-plugin: http://www.mojohaus.org/javancss-maven-plugin/usage.html
Simian
Simian (Similarity Analyser) identifies duplication in Java, C#, C, C++, COBOL, Ruby, JSP, ASP, HTML, XML, Visual Basic, Groovy source code and even plain text files. In fact, simian can be used on any human readable files such as ini files, deployment descriptors, you name it.
- Simian:http://www.harukizaemon.com/simian/
- maven-simian-plugin(for Maven 1.x): http://maven.apache.org/archives/maven-1.x/plugins/simian/
- simian-maven-plugin(for Maven 2.0+): https://github.com/jiangxincode/simian-maven-plugin
注:If you like simian-maven-plugin, you can vote for my answer on http://stackoverflow.com/questions/1077700/how-do-you-use-the-maven-simian-plugin-in-maven2
SourceMonitor
SourceMonitor lets you see inside your software source code to find out how much code you have and to identify the relative complexity of your modules. For example, you can use SourceMonitor to identify the code that is most likely to contain defects and thus warrants formal review.
- SourceMonitor: http://www.campwoodsw.com/
- 代碼度量工具——SourceMonitor的學習和使用:http://www.cnblogs.com/bangerlee/archive/2011/09/18/2178172.html
cloc
cloc counts blank lines, comment lines, and physical lines of source code in many programming languages.
額外閱讀
- 淺淡靜態代碼分析工具:http://www.cnblogs.com/hyddd/archive/2008/12/16/1356310.html
- 七款代碼味道識別工具【簡介】:http://blog.csdn.net/lovelion/article/details/18467149
- 以上工具的輸出報告可見:https://jiangxincode.github.io/ApkToolBoxGUI/project-reports.html
歡迎和大家交流技術相關問題: