diff options
author | Kristen Kozak <sebright@google.com> | 2018-03-23 15:14:29 -0700 |
---|---|---|
committer | Kristen Kozak <sebright@google.com> | 2018-03-23 19:41:50 -0700 |
commit | cc7c7e1dbc516b57122e61284aebbc385cbecca1 (patch) | |
tree | 317c94889e4313a5033e37b8194dd7ff0868ace8 /findbugs-exclude.xml | |
parent | 63fb16f6cb331d4020fc3f6b8eec7006385cd32e (diff) | |
download | opencensus-java-cc7c7e1dbc516b57122e61284aebbc385cbecca1.tar.gz |
Enable FindBugs in tests.
This would have caught the unused variable that was fixed by #1082.
Changes in this commit:
- Enable FindBugs in tests in build.gradle.
- Fix some existing minor FindBugs issues in tests.
- Suppress some warnings in all test classes that are less important in test
code, such as requiring nested classes to be static whenever possible.
- Enable nullness-related FindBugs warnings in tests, since we don't run the
Checker Framework on test code.
Diffstat (limited to 'findbugs-exclude.xml')
-rw-r--r-- | findbugs-exclude.xml | 43 |
1 files changed, 41 insertions, 2 deletions
diff --git a/findbugs-exclude.xml b/findbugs-exclude.xml index afa47549..c6658d9d 100644 --- a/findbugs-exclude.xml +++ b/findbugs-exclude.xml @@ -23,15 +23,54 @@ <Class name="io.opencensus.trace.internal.BaseMessageEventUtil" /> </Match> - <!-- Suppress all FindBugs warnings about NullPointerExceptions. They are redundant with the --> - <!-- Checker Framework's warnings, and they sometimes conflict. --> + <!-- Suppress some FindBugs warnings related to performance or robustness --> + <!-- in test classes, where those issues are less important. --> + <Match> + <!-- Reason: Only needed for performance. --> + <Bug pattern="SIC_INNER_SHOULD_BE_STATIC_ANON"/> + <Source name="~.*Test\.java" /> + </Match> + <Match> + <!-- Reason: Only needed for performance. --> + <Bug pattern="WMI_WRONG_MAP_ITERATOR"/> + <Source name="~.*Test\.java" /> + </Match> + <Match> + <!-- Reason: Only needed for performance. --> + <Bug pattern="UM_UNNECESSARY_MATH"/> + <Source name="~.*Test\.java" /> + </Match> + <Match> + <!-- Reason: This is less important in a test environment. --> + <Bug pattern="DP_CREATE_CLASSLOADER_INSIDE_DO_PRIVILEGED"/> + <Source name="~.*Test\.java" /> + </Match> + <Match> + <!-- Reason: Many classes initialize fields in @Before methods. --> + <Bug pattern="UWF_FIELD_NOT_INITIALIZED_IN_CONSTRUCTOR"/> + <Source name="~.*Test\.java" /> + </Match> + + <!-- Suppress all FindBugs warnings about NullPointerExceptions in --> + <!-- non-test code. They are redundant with the Checker Framework's --> + <!-- warnings, and they sometimes conflict. These warnings are still --> + <!-- useful in test code, where we don't use the Checker Framework. --> <Match> <Bug code="NP"/> + <Not> + <Source name="~.*Test\.java" /> + </Not> </Match> <Match> <Bug pattern="UR_UNINIT_READ"/> + <Not> + <Source name="~.*Test\.java" /> + </Not> </Match> <Match> <Bug pattern="UWF_FIELD_NOT_INITIALIZED_IN_CONSTRUCTOR"/> + <Not> + <Source name="~.*Test\.java" /> + </Not> </Match> </FindBugsFilter> |