aboutsummaryrefslogtreecommitdiff
path: root/findbugs-exclude.xml
blob: 014f9a9bf0763e6eb1d790653b5081f34a4cf20d (plain)
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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
<FindBugsFilter>
  <Match>
    <!-- Reason: Null has a different meaning than a zero-length array in this case. -->
    <Bug pattern="PZLA_PREFER_ZERO_LENGTH_ARRAYS"/>
    <Class name="io.opencensus.stats.MutableDistribution"/>
    <Method name="getInternalBucketCountsArray"/>
  </Match>
  <Match>
    <!-- Reason: Equal is implemented in the AutoValue generated class. -->
    <Bug pattern="EQ_COMPARETO_USE_OBJECT_EQUALS"/>
    <Class name="io.opencensus.common.Timestamp"/>
    <Method name="compareTo"/>
  </Match>
  <Match>
    <!-- Reason: Equal is implemented in the AutoValue generated class. -->
    <Bug pattern="EQ_COMPARETO_USE_OBJECT_EQUALS"/>
    <Class name="io.opencensus.common.Duration"/>
    <Method name="compareTo"/>
  </Match>
  <Match>
    <!-- Reason: BaseMessageEvent only has two visible subclasses. -->
    <Bug pattern="BC_UNCONFIRMED_CAST"/>
    <Class name="io.opencensus.trace.internal.BaseMessageEventUtils"/>
  </Match>
  <Match>
    <!-- Reason: This test is testing for a NPE. -->
    <Bug pattern="NP_NONNULL_PARAM_VIOLATION"/>
    <Class name="io.opencensus.internal.UtilsTest"/>
    <Method name="checkNotNull"/>
  </Match>
  <Match>
    <!-- Reason: This test is testing for a NPE. -->
    <Bug pattern="NP_NONNULL_PARAM_VIOLATION"/>
    <Class name="io.opencensus.internal.UtilsTest"/>
    <Method name="checkNotNull_NullErrorMessage"/>
  </Match>
  <Match>
    <!-- Reason: It seems like FindBugs incorrectly assumes that all -->
    <!-- Throwables are subclasses of Error or Exception. -->
    <Bug pattern="BC_VACUOUS_INSTANCEOF"/>
    <Class name="io.opencensus.trace.CurrentSpanUtils$CallableInSpan"/>
    <Method name="call"/>
  </Match>
  <Match>
    <!-- Reason: Protobuf auto-generated code. -->
    <Bug pattern="UCF_USELESS_CONTROL_FLOW"/>
    <Class name="io.opencensus.contrib.appengine.standard.util.TraceIdProto$Builder"/>
    <Method name="maybeForceBuilderInitialization"/>
  </Match>
  <Match>
    <!-- Reason: The synchronization in the setState is for the side effects not for the state. -->
    <Bug pattern="UG_SYNC_SET_UNSYNC_GET"/>
    <Class name="io.opencensus.implcore.stats.StatsComponentImplBase"/>
  </Match>

  <!-- 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>