当前位置:Gxlcms > 数据库问题 > FindBugs规则整理

FindBugs规则整理

时间:2021-07-01 10:21:17 帮助过:3人阅读

 

常见参数说明:
-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>

FindBugs规则整理

标签:

人气教程排行