http://blog.csdn.net/jdsjlzx/article/details/21472253/
配置FindBugs和常見FindBugs錯誤 http://blog.csdn.net/aya19880214/article/details/41958445
http://wenku.baidu.com/link?url=r4KX6A37_GW1xHkb7ezYJ-2S_2wQ-E_nB9Yps_mkj35nsKaFnEizt7AqWck_diLRXRIvWquVPZ__9wC8jXFmCNjh6_r6I485H81oTBUQtoe
http://blog.csdn.net/zm_21/article/details/47276581
命令行方式
1
|
./findbugs -textui -low -html -output report.html ./findbugs/outputfiles/
|
常見參數說明:
-home 定義findbugs2軟件存放位置
-low 提交警告及任何級別以上報告
-medium 提交中,高級報告(默認)
-high 只提交高級警告
-xml 警告以 xml輸出
-html 警告以 html輸出
-output 定義輸出的文件名
-onlyAnalyze 只分析指定的 class/package
-exclude 忽略指定的 class/package (以xml定義過濾的命名)
-include 只輸出指定的 class/package (以xml定義過濾的命名)
過濾規則
示例文件:opencdk_exclude_filter.xml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
|
<?xml version="1.0" encoding="UTF-8"?>
<FindBugsFilter>
<!-- android-support-v4.jar:包過濾 -->
<Match>
<Package name="~android\.support\.v4.*" />
</Match>
<!-- 類過濾、方法 -->
<Match>
<Class name="com.opencdk.MusicActivity" />
<Method name="getMusicName" />
</Match>
<Match>
<Class name="com.opencdk.VideoActivity" />
</Match>
<!-- Match all doublecheck violations in these methods of "AnotherClass". -->
<Match>
<Class name="com.opencdk.AnotherClass" />
<Or>
<Method name="nonOverloadedMethod" />
<Method name="frob" params="int,java.lang.String" returns="void" />
<Method name="blat" params="" returns="boolean" />
</Or>
<Bug code="DC" />
</Match>
<!-- All bugs in test classes, except for JUnit-specific bugs -->
<Match>
<Class name="~.*\.*Test" />
<Not>
<Bug code="IJU" />
</Not>
</Match>
</FindBugsFilter>
|