OLD | NEW |
1 # Introduction | 1 # Use FindBugs for Android |
2 | 2 |
3 [FindBugs](http://findbugs.sourceforge.net) is an open source static analysis to
ol from the University of Maryland that looks for potential bugs in Java class f
iles. We have some scripts to run it over the Java code at build time. | 3 [FindBugs](http://findbugs.sourceforge.net) is an open source static analysis |
| 4 tool from the University of Maryland that looks for potential bugs in Java class |
| 5 files. We have some scripts to run it over the Java code at build time. |
4 | 6 |
5 # How To Run | 7 ## How To Run |
6 | 8 |
7 For gyp builds, add `run_findbugs=1` to your `GYP_DEFINES`. | 9 For gyp builds, add `run_findbugs=1` to your `GYP_DEFINES`. |
8 | 10 |
9 For gn builds, add `run_findbugs=true` to the args you pass to `gn gen`: | 11 For gn builds, add `run_findbugs=true` to the args you pass to `gn gen`: |
10 | 12 |
11 ``` | 13 gn gen --args='target_os="android" run_findbugs=true' |
12 gn gen --args='target_os="android" run_findbugs=true' | |
13 ``` | |
14 | 14 |
15 Note that running findbugs will add time to your build. The amount of additional
time required depends on the number of targets on which findbugs runs, though i
t will usually be between 1-10 minutes. | 15 Note that running findbugs will add time to your build. The amount of additional |
| 16 time required depends on the number of targets on which findbugs runs, though it |
| 17 will usually be between 1-10 minutes. |
16 | 18 |
17 Some of the warnings are false positives. In general, they should be suppressed
using [@SuppressFBWarnings](https://code.google.com/p/chromium/codesearch#chromi
um/src/base/android/java/src/org/chromium/base/annotations/SuppressFBWarnings.ja
va). In the rare event that a warning should be suppressed across the entire cod
e base, it should be added to the [exclusion file](https://code.google.com/p/chr
omium/codesearch#chromium/src/build/android/findbugs_filter/findbugs_exclude.xml
) instead. If you modify this file: | 19 Some of the warnings are false positives. In general, they should be suppressed |
| 20 using |
| 21 [@SuppressFBWarnings](https://code.google.com/p/chromium/codesearch#chromium/src
/base/android/java/src/org/chromium/base/annotations/SuppressFBWarnings.java). |
| 22 In the rare event that a warning should be suppressed across the entire |
| 23 code base, it should be added to the |
| 24 [exclusion file](https://code.google.com/p/chromium/codesearch#chromium/src/buil
d/android/findbugs_filter/findbugs_exclude.xml) |
| 25 instead. If you modify this file: |
18 | 26 |
19 * Include a comment that says what you're suppressing and why. | 27 * Include a comment that says what you're suppressing and why. |
20 * The existing suppressions should give you an idea of the syntax. See also th
e FindBugs documentation. Note that the documentation doesn't seem totally accur
ate (there's probably some version skew between the online docs and the version
of FindBugs we're using) so you may have to experiment a little. | 28 * The existing suppressions should give you an idea of the syntax. See also |
| 29 the FindBugs documentation. Note that the documentation doesn't seem totally |
| 30 accurate (there's probably some version skew between the online docs and the |
| 31 version of FindBugs we're using) so you may have to experiment a little. |
21 | 32 |
22 # Chromium's [FindBugs](http://findbugs.sourceforge.net) plugin | 33 # Chromium's [FindBugs](http://findbugs.sourceforge.net) plugin |
23 | 34 |
24 We have [FindBugs plugin](https://code.google.com/p/chromium/codesearch#chromium
/src/tools/android/findbugs_plugin/) to enforce chromium specific Java rules. It
currently detects: | 35 We have |
25 * Synchronized method | 36 [FindBugs plugin](https://code.google.com/p/chromium/codesearch#chromium/src/too
ls/android/findbugs_plugin/) |
26 * Synchronized this | 37 to enforce chromium specific Java rules. It currently detects: |
| 38 |
| 39 * Synchronized method |
| 40 * Synchronized this |
27 | 41 |
28 # [FindBugs](http://findbugs.sourceforge.net) on the Bots | 42 # [FindBugs](http://findbugs.sourceforge.net) on the Bots |
29 | 43 |
30 [FindBugs](http://findbugs.sourceforge.net) is configured to run on: | 44 [FindBugs](http://findbugs.sourceforge.net) is configured to run on: |
31 * [android\_clang\_dbg\_recipe](http://build.chromium.org/p/tryserver.chromium
.linux/builders/android_clang_dbg_recipe) on the commit queue | 45 |
32 * [Android Clang Builder (dbg)](http://build.chromium.org/p/chromium.linux/bui
lders/Android%20Clang%20Builder%20(dbg)) on the main waterfall | 46 * [android_clang_dbg_recipe](http://build.chromium.org/p/tryserver.chromium.li
nux/builders/android_clang_dbg_recipe) |
| 47 on the commit queue |
| 48 * [Android Clang Builder (dbg)](http://build.chromium.org/p/chromium.linux/bui
lders/Android%20Clang%20Builder%20\(dbg\)) |
| 49 on the main waterfall |
OLD | NEW |