?? datamining.html
字號:
It can either be invoked with no files specified on the command line (in which case it reads from standard input)or with one file specified on the command line.</p><p>It generates a table with the following columns, and with onerow for the entire project, and one row for each package or class that contains at least4 warnings.</p><div class="table"><a name="defectDensityColumns"></a><p class="title"><b>Table 12.5. Columns in defectDensity output</b></p><div class="table-contents"><table summary="Columns in defectDensity output" border="1"><colgroup><col><col></colgroup><thead><tr><th align="left">Title</th><th align="left">Meaning</th></tr></thead><tbody><tr><td align="left">kind</td><td align="left">project, package or class</td></tr><tr><td align="left">name</td><td align="left">The name of the project, package or class</td></tr><tr><td align="left">density</td><td align="left">Number of warnings generated per 1000 lines of NCSS.</td></tr><tr><td align="left">bugs</td><td align="left">Number of warnings</td></tr><tr><td align="left">NCSS</td><td align="left">Calculated number of NCSS</td></tr></tbody></table></div></div><br class="table-break"></div><div class="sect2" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="convertXmlToText"></a>1.6. convertXmlToText</h3></div></div></div><p> This command converts a warning collection in XML format to a text format with one line per warning, or to HTML. </p><p>This functionality may also can be accessed from ant.First create a taskdef for <span><strong class="command">convertXmlToText</strong></span> in yourbuild file:</p><pre class="programlisting"><taskdef name="convertXmlToText" classname="edu.umd.cs.findbugs.anttask.ConvertXmlToTextTask"> <classpath refid="findbugs.lib" /></taskdef></pre><p>Attributes for this ant task are listed in the following table.</p><div class="table"><a name="convertXmlToTextTable"></a><p class="title"><b>Table 12.6. Options for convertXmlToText command</b></p><div class="table-contents"><table summary="Options for convertXmlToText command" border="1"><colgroup><col><col><col></colgroup><thead><tr><th align="left">Command-line option</th><th align="left">Ant attribute</th><th align="left">Meaning</th></tr></thead><tbody><tr><td align="left"> </td><td align="left">input="<filename>"</td><td align="left">use file as input</td></tr><tr><td align="left"> </td><td align="left">output="<filename>"</td><td align="left">output results to file</td></tr><tr><td align="left">-longBugCodes</td><td align="left">longBugCodes="[true|false]"</td><td align="left">use the full bug pattern code instead of two-letter abbreviation</td></tr><tr><td align="left"> </td><td align="left">format="text"</td><td align="left">generate plain text output with one bug per line (command-line default)</td></tr><tr><td align="left">-html[:stylesheet]</td><td align="left">format="html:<stylesheet>"</td><td align="left">generate output with specified stylesheet (see below), or default.xsl if unspecified</td></tr></tbody></table></div></div><br class="table-break"><p> You may specify plain.xsl, default.xsl, fancy.xsl, fancy-hist.xsl, or your own XSL stylesheet for the -html/format option. Despite the name of this option, you may specify a stylesheet that emits something other than html. When applying a stylesheet other than those included with FindBugs (listed above), the -html/format option should be used with a path or URL to the stylesheet. </p></div><div class="sect2" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="setBugDatabaseInfo"></a>1.7. setBugDatabaseInfo</h3></div></div></div><p> This command sets meta-information in a specified warning collection. It takes the following options: </p><p>This functionality may also can be accessed from ant.First create a taskdef for <span><strong class="command">setBugDatabaseInfo</strong></span> in yourbuild file:</p><pre class="programlisting"><taskdef name="setBugDatabaseInfo" classname="edu.umd.cs.findbugs.anttask.SetBugDatabaseInfoTask"> <classpath refid="findbugs.lib" /></taskdef></pre><p>Attributes for this ant task are listed in the following table.To specify an input file either use the <code class="literal">input</code>attribute or nest it inside the ant call with a<code class="literal"><datafile></code> element. For example:</p><pre class="programlisting"><setBugDatabaseInfo home="${findbugs.home}" ...> <datafile name="analyze.xml"/></setBugDatabaseInfo></pre><div class="table"><a name="setBugDatabaseInfoOptions"></a><p class="title"><b>Table 12.7. setBugDatabaseInfo Options</b></p><div class="table-contents"><table summary="setBugDatabaseInfo Options" border="1"><colgroup><col><col><col></colgroup><thead><tr><th align="left">Command-line option</th><th align="left">Ant attribute</th><th align="left">Meaning</th></tr></thead><tbody><tr><td align="left"> </td><td align="left">input="<file>"</td><td align="left">use file as input</td></tr><tr><td align="left"> </td><td align="left">output="<file>"</td><td align="left">write output to file</td></tr><tr><td align="left">-name <name></td><td align="left">name="<name>"</td><td align="left">set name for (last) revision</td></tr><tr><td align="left">-timestamp <when></td><td align="left">timestamp="<when>"</td><td align="left">set timestamp for (last) revision</td></tr><tr><td align="left">-source <directory></td><td align="left">source="<directory>"</td><td align="left">add specified directory to the source search path</td></tr><tr><td align="left">-findSource <directory></td><td align="left">findSource="<directory>"</td><td align="left">find and add all relevant source directions contained within specified directory</td></tr><tr><td align="left">-suppress <filter file></td><td align="left">suppress="<filter file>"</td><td align="left">suppress warnings matched by this file (replaces previous suppressions)</td></tr><tr><td align="left">-withMessages</td><td align="left">withMessages="[true|false]"</td><td align="left">add textual messages to XML</td></tr><tr><td align="left">-resetSource</td><td align="left">resetSource="[true|false]"</td><td align="left">remove all source search paths</td></tr></tbody></table></div></div><br class="table-break"></div><div class="sect2" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="listBugDatabaseInfo"></a>1.8. listBugDatabaseInfo</h3></div></div></div><p>This command takes a list of zero or more xml bug database filenames on the command line.If zero file names are provided, it reads from standard input and does not generatea table header.</p><p>There is only one option: <code class="option">-formatDates</code> renders dates in textual form. </p><p>The output is a table one row per bug database and the following columns:</p><div class="table"><a name="listBugDatabaseInfoColumns"></a><p class="title"><b>Table 12.8. listBugDatabaseInfo Columns</b></p><div class="table-contents"><table summary="listBugDatabaseInfo Columns" border="1"><colgroup><col><col></colgroup><thead><tr><th align="left">Column</th><th align="left">Meaning</th></tr></thead><tbody><tr><td align="left">version</td><td align="left">version name</td></tr><tr><td align="left">time</td><td align="left">Release timestamp</td></tr><tr><td align="left">classes</td><td align="left">Number of classes analyzed</td></tr><tr><td align="left">NCSS</td><td align="left">Non Commenting Source Statements analyzed</td></tr><tr><td align="left">total</td><td align="left">Total number of warnings of all kinds</td></tr><tr><td align="left">high</td><td align="left">Total number of high priority warnings of all kinds</td></tr><tr><td align="left">medium</td><td align="left">Total number of medium/normal priority warnings of all kinds</td></tr><tr><td align="left">low</td><td align="left">Total number of low priority warnings of all kinds</td></tr><tr><td align="left">filename</td><td align="left">filename of database</td></tr></tbody></table></div></div><br class="table-break"></div></div><div class="sect1" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="examples"></a>2. Examples</h2></div></div></div><div class="sect2" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="unixscriptsexamples"></a>2.1. Mining history using proveded shell scrips</h3></div></div></div><p>In all of the following, the commands are given in a directory that containsdirectories jdk1.6.0-b12, jdk1.6.0-b13, ..., jdk1.6.0-b60.</p><p>You can use the command:</p><pre class="screen">computeBugHistory jdk1.6.0-b* | filterBugs -bugPattern IL_ | mineBugHistory -formatDates</pre><p>to generate the following output:</p><pre class="screen">seq version time classes NCSS added newCode fixed removed retained dead active0 jdk1.6.0-b12 "Thu Nov 11 09:07:20 EST 2004" 13128 811569 0 4 0 0 0 0 41 jdk1.6.0-b13 "Thu Nov 18 06:02:06 EST 2004" 13128 811570 0 0 0 0 4 0 42 jdk1.6.0-b14 "Thu Dec 02 06:12:26 EST 2004" 13145 811786 0 0 2 0 2 0 23 jdk1.6.0-b15 "Thu Dec 09 06:07:04 EST 2004" 13174 811693 0 0 1 0 1 2 14 jdk1.6.0-b16 "Thu Dec 16 06:21:28 EST 2004" 13175 811715 0 0 0 0 1 3 15 jdk1.6.0-b17 "Thu Dec 23 06:27:22 EST 2004" 13176 811974 0 0 0 0 1 3 16 jdk1.6.0-b19 "Thu Jan 13 06:41:16 EST 2005" 13176 812011 0 0 0 0 1 3 17 jdk1.6.0-b21 "Thu Jan 27 05:57:52 EST 2005" 13177 812173 0 0 0 0 1 3 18 jdk1.6.0-b23 "Thu Feb 10 05:44:36 EST 2005" 13179 812188 0 0 0 0 1 3 19 jdk1.6.0-b26 "Thu Mar 03 06:04:02 EST 2005" 13199 811770 0 0 0 0 1 3 110 jdk1.6.0-b27 "Thu Mar 10 04:48:38 EST 2005" 13189 812440 0 0 0 0 1 3 111 jdk1.6.0-b28 "Thu Mar 17 02:54:22 EST 2005" 13185 812056 0 0 0 0 1 3 112 jdk1.6.0-b29 "Thu Mar 24 03:09:20 EST 2005" 13117 809468 0 0 0 0 1 3 113 jdk1.6.0-b30 "Thu Mar 31 02:53:32 EST 2005" 13118 809501 0 0 0 0 1 3 114 jdk1.6.0-b31 "Thu Apr 07 03:00:14 EDT 2005" 13117 809572 0 0 0 0 1 3 115 jdk1.6.0-b32 "Thu Apr 14 02:56:56 EDT 2005" 13169 811096 0 0 0 0 1 3 116 jdk1.6.0-b33 "Thu Apr 21 02:46:22 EDT 2005" 13187 811942 0 0 0 0 1 3 117 jdk1.6.0-b34 "Thu Apr 28 02:49:00 EDT 2005" 13195 813488 0 1 0 0 1 3 218 jdk1.6.0-b35 "Thu May 05 02:49:04 EDT 2005" 13457 829837 0 0 0 0 2 3 219 jdk1.6.0-b36 "Thu May 12 02:59:46 EDT 2005" 13462 831278 0 0 0 0 2 3 220 jdk1.6.0-b37 "Thu May 19 02:55:08 EDT 2005" 13464 831971 0 0 0 0 2 3 221 jdk1.6.0-b38 "Thu May 26 03:08:16 EDT 2005" 13564 836565 0 0 0 0 2 3 222 jdk1.6.0-b39 "Fri Jun 03 03:10:48 EDT 2005" 13856 849992 0 1 0 0 2 3 323 jdk1.6.0-b40 "Thu Jun 09 03:30:28 EDT 2005" 15972 959619 0 2 0 0 3 3 524 jdk1.6.0-b41 "Thu Jun 16 03:19:22 EDT 2005" 15972 959619 0 0 0 0 5 3 525 jdk1.6.0-b42 "Fri Jun 24 03:38:54 EDT 2005" 15966 958581 0 0 0 0 5 3 526 jdk1.6.0-b43 "Thu Jul 14 03:09:34 EDT 2005" 16041 960544 0 0 0 0 5 3 527 jdk1.6.0-b44 "Thu Jul 21 03:05:54 EDT 2005" 16041 960547 0 0 0 0 5 3 528 jdk1.6.0-b45 "Thu Jul 28 03:26:10 EDT 2005" 16037 960606 0 0 1 0 4 3 429 jdk1.6.0-b46 "Thu Aug 04 03:02:48 EDT 2005" 15936 951355 0 0 0 0 4 4 430 jdk1.6.0-b47 "Thu Aug 11 03:18:56 EDT 2005" 15964 952387 0 0 1 0 3 4 331 jdk1.6.0-b48 "Thu Aug 18 08:10:40 EDT 2005" 15970 953421 0 0 0 0 3 5 332 jdk1.6.0-b49 "Thu Aug 25 03:24:38 EDT 2005" 16048 958940 0 0 0 0 3 5 333 jdk1.6.0-b50 "Thu Sep 01 01:52:40 EDT 2005" 16287 974937 1 0 0 0 3 5 434 jdk1.6.0-b51 "Thu Sep 08 01:55:36 EDT 2005" 16362 979377 0 0 0 0 4 5 435 jdk1.6.0-b52 "Thu Sep 15 02:04:08 EDT 2005" 16477 979399 0 0 0 0 4 5 436 jdk1.6.0-b53 "Thu Sep 22 02:00:28 EDT 2005" 16019 957900 0 0 1 0 3 5 337 jdk1.6.0-b54 "Thu Sep 29 01:54:34 EDT 2005" 16019 957900 0 0 0 0 3 6 338 jdk1.6.0-b55 "Thu Oct 06 01:54:14 EDT 2005" 16051 959014 0 0 0 0 3 6 339 jdk1.6.0-b56 "Thu Oct 13 01:54:12 EDT 2005" 16211 970835 0 0 0 0 3 6 340 jdk1.6.0-b57 "Thu Oct 20 01:55:26 EDT 2005" 16279 971627 0 0 0 0 3 6 341 jdk1.6.0-b58 "Thu Oct 27 01:56:30 EDT 2005" 16283 971945 0 0 0 0 3 6 342 jdk1.6.0-b59 "Thu Nov 03 01:56:58 EST 2005" 16232 972193 0 0 0 0 3 6 343 jdk1.6.0-b60 "Thu Nov 10 01:54:18 EST 2005" 16235 972346 0 0 0 0 3 6 3</pre><p>We could also generate that information directly, without creating an intermediate db.xml file, using the command</p><pre class="screen">computeBugHistory jdk1.6.0-b*/jre/lib/rt.xml | filterBugs -bugPattern IL_ db.xml | mineBugHistory -formatDates</pre><p>We can then use that information to display a graph showing the number of infinite recursive loopsfound by FindBugs in each build of Sun's JDK1.6.0. The blue area indicates the number of infiniterecursive loops in that build, the red area above it indicates the number of infinite recursive loops that existedin some previous version but not in the current version (thus, the combined height of the red and blue areasis guaranteed to never decrease, and goes up whenever a new infinite recursive loop bug is introduced). The heightof the red area is computed as the sum of the fixed, removed and dead values for each version. The reductions in builds 13 and 14 came after Sun was notified about the bugs found by FindBugs in the JDK. </p><div class="mediaobject"><img src="infiniteRecursiveLoops.png"></div><p>Given the db.xml file that contains the results for all the jdk1.6.0 builds, the following command will show the history of high and medium priority correctness warnings:</p><pre class="screen">filterBugs -priority M -category C db.xml | mineBugHistory -formatDates</pre><p>generating the table:</p><pre class="screen">seq version time classes NCSS added newCode fixed removed retained dead active0 jdk1.6.0-b12 "Thu Nov 11 09:07:20 EST 2004" 13128 811569 0 1075 0 0 0 0 10751 jdk1.6.0-b13 "Thu Nov 18 06:02:06 EST 2004" 13128 811570 0 0 0 0 1075 0 10752 jdk1.6.0-b14 "Thu Dec 02 06:12:26 EST 2004" 13145 811786 3 0 6 0 1069 0 10723 jdk1.6.0-b15 "Thu Dec 09 06:07:04 EST 2004" 13174 811693 2 1 3 0 1069 6 10724 jdk1.6.0-b16 "Thu Dec 16 06:21:28 EST 2004" 13175 811715 0 0 1 0 1071 9 10715 jdk1.6.0-b17 "Thu Dec 23 06:27:22 EST 2004" 13176 811974 0 0 1 0 1070 10 10706 jdk1.6.0-b19 "Thu Jan 13 06:41:16 EST 2005" 13176 812011 0 0 0 0 1070 11 10707 jdk1.6.0-b21 "Thu Jan 27 05:57:52 EST 2005" 13177 812173 0 0 1 0 1069 11 10698 jdk1.6.0-b23 "Thu Feb 10 05:44:36 EST 2005" 13179 812188 0 0 0 0 1069 12 10699 jdk1.6.0-b26 "Thu Mar 03 06:04:02 EST 2005" 13199 811770 0 0 2 1 1066 12 106610 jdk1.6.0-b27 "Thu Mar 10 04:48:38 EST 2005" 13189 812440 1 0 1 1 1064 15 106511 jdk1.6.0-b28 "Thu Mar 17 02:54:22 EST 2005" 13185 812056 0 0 0 0 1065 17 106512 jdk1.6.0-b29 "Thu Mar 24 03:09:20 EST 2005" 13117 809468 3 0 8 26 1031 17 103413 jdk1.6.0-b30 "Thu Mar 31 02:53:32 EST 2005" 13118 809501 0 0 0 0 1034 51 103414 jdk1.6.0-b31 "Thu Apr 07 03:00:14 EDT 2005" 13117 809572 0 0 0 0 1034 51 103415 jdk1.6.0-b32 "Thu Apr 14 02:56:56 EDT 2005" 13169 811096 1 1 0 1 1033 51 103516 jdk1.6.0-b33 "Thu Apr 21 02:46:22 EDT 2005" 13187 811942 3 0 2 1 1032 52 103517 jdk1.6.0-b34 "Thu Apr 28 02:49:00 EDT 2005" 13195 813488 0 1 0 0 1035 55 103618 jdk1.6.0-b35 "Thu May 05 02:49:04 EDT 2005" 13457 829837 0 36 2 0 1034 55 107019 jdk1.6.0-b36 "Thu May 12 02:59:46 EDT 2005" 13462 831278 0 0 0 0 1070 57 107020 jdk1.6.0-b37 "Thu May 19 02:55:08 EDT 2005" 13464 831971 0 1 1 0 1069 57 107021 jdk1.6.0-b38 "Thu May 26 03:08:16 EDT 2005" 13564 836565 1 7 2 6 1062 58 107022 jdk1.6.0-b39 "Fri Jun 03 03:10:48 EDT 2005" 13856 849992 6 39 5 0 1065 66 111023 jdk1.6.0-b40 "Thu Jun 09 03:30:28 EDT 2005" 15972 959619 7 147 11 0 1099 71 1253
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -