代码静态分析工具使用
一、各种Eclipse插件安装
checkstyle插件的安装
Help --> Install New Software --> Add(checkstyle更新URL:https://www.sodocs.net/doc/176591967.html,/update)
findbugs插件的安装
Help --> Install New Software --> Add(findbugs更新URL:https://www.sodocs.net/doc/176591967.html,/eclipse)pmd插件的安装
Help --> Install New Software --> Add(pmd更新URL:https://www.sodocs.net/doc/176591967.html,/eclipse)
二、各种Eclipse插件配置和使用
checkstyle插件的配置和使用
1、Windows --> Preferences --> checkstyle --> New (OK) --> set as default
Type:Project Relative Conconfig
Name:checkstyle-checker
Location:/sample/codechecker/checkstyle-checker.xml
2、选中工程 --> Projects --> CheckStyle --> Configure中选择checkstyle-checker - (Global)
3、选中任意一个Java文件,右键CheckStyle-->check code with checkstyle
findbugs插件的配置和使用
1、Windows --> Preferences --> Java --> findbugs --> Filter files --> Add
Include Filter files:findbugs-include.xml
Exclude Filter files:findbugs-exclude.xml
2、选中任意一个Java文件,右键Find bugs --> Find bugs
pmd插件的配置和使用
1、Windows --> Preferences --> PMD --> Rules configration --> import rule set
/sample/codechecker/pmd-rules.xml
2、选中任意一个Java文件,右键PMD --> check code with PMD
edu/eclipse)
(Global)