blob: b61505b6b4d9f35ebf25a1bf551ecbc42ff9e442 [file] [log] [blame]
Marco Nelissen594375d2009-07-14 09:04:04 -07001#!/usr/bin/env python
Marco Nelissen8e201962010-03-10 16:16:02 -08002# This file uses the following encoding: utf-8
Marco Nelissen594375d2009-07-14 09:04:04 -07003
Ian Rogersf3829732016-05-10 12:06:01 -07004import argparse
Marco Nelissen594375d2009-07-14 09:04:04 -07005import sys
6import re
7
Ian Rogersf3829732016-05-10 12:06:01 -07008parser = argparse.ArgumentParser(description='Convert a build log into HTML')
9parser.add_argument('--url',
10 help='Root URL of an Android source code tree prefixed '
11 'before files in warnings')
12parser.add_argument('--separator',
13 help='Separator between the end of a URL and the line '
14 'number argument. e.g. #')
15parser.add_argument(dest='buildlog', metavar='build.log',
16 help='Path to build.log file')
17args = parser.parse_args()
Marco Nelissen594375d2009-07-14 09:04:04 -070018
19# if you add another level, don't forget to give it a color below
20class severity:
21 UNKNOWN=0
22 SKIP=100
23 FIXMENOW=1
24 HIGH=2
25 MEDIUM=3
26 LOW=4
Chih-Hung Hsieh90d46192016-03-29 15:33:11 -070027 TIDY=5
28 HARMLESS=6
Marco Nelissen594375d2009-07-14 09:04:04 -070029
30def colorforseverity(sev):
31 if sev == severity.FIXMENOW:
32 return 'fuchsia'
33 if sev == severity.HIGH:
34 return 'red'
35 if sev == severity.MEDIUM:
36 return 'orange'
37 if sev == severity.LOW:
38 return 'yellow'
Chih-Hung Hsieh90d46192016-03-29 15:33:11 -070039 if sev == severity.TIDY:
40 return 'peachpuff'
Marco Nelissen594375d2009-07-14 09:04:04 -070041 if sev == severity.HARMLESS:
42 return 'limegreen'
43 if sev == severity.UNKNOWN:
Chih-Hung Hsieha9be47e2016-03-21 14:11:03 -070044 return 'lightblue'
Marco Nelissen594375d2009-07-14 09:04:04 -070045 return 'grey'
46
Chih-Hung Hsieha9be47e2016-03-21 14:11:03 -070047def headerforseverity(sev):
48 if sev == severity.FIXMENOW:
49 return 'Critical warnings, fix me now'
50 if sev == severity.HIGH:
51 return 'High severity warnings'
52 if sev == severity.MEDIUM:
53 return 'Medium severity warnings'
54 if sev == severity.LOW:
55 return 'Low severity warnings'
56 if sev == severity.HARMLESS:
57 return 'Harmless warnings'
Chih-Hung Hsieh90d46192016-03-29 15:33:11 -070058 if sev == severity.TIDY:
59 return 'Clang-Tidy warnings'
Chih-Hung Hsieha9be47e2016-03-21 14:11:03 -070060 if sev == severity.UNKNOWN:
61 return 'Unknown warnings'
62 return 'Unhandled warnings'
63
Marco Nelissen594375d2009-07-14 09:04:04 -070064warnpatterns = [
65 { 'category':'make', 'severity':severity.MEDIUM, 'members':[], 'option':'',
66 'description':'make: overriding commands/ignoring old commands',
67 'patterns':[r".*: warning: overriding commands for target .+",
68 r".*: warning: ignoring old commands for target .+"] },
69 { 'category':'C/C++', 'severity':severity.HIGH, 'members':[], 'option':'-Wimplicit-function-declaration',
70 'description':'Implicit function declaration',
71 'patterns':[r".*: warning: implicit declaration of function .+"] },
72 { 'category':'C/C++', 'severity':severity.SKIP, 'members':[], 'option':'',
73 'description':'',
74 'patterns':[r".*: warning: conflicting types for '.+'"] },
75 { 'category':'C/C++', 'severity':severity.HIGH, 'members':[], 'option':'-Wtype-limits',
76 'description':'Expression always evaluates to true or false',
Chih-Hung Hsiehf8aaf602016-03-16 12:18:16 -070077 'patterns':[r".*: warning: comparison is always .+ due to limited range of data type",
Chih-Hung Hsiehba0ddcd2016-03-21 11:28:30 -070078 r".*: warning: comparison of unsigned .*expression .+ is always true",
79 r".*: warning: comparison of unsigned .*expression .+ is always false"] },
Chih-Hung Hsiehf8aaf602016-03-16 12:18:16 -070080 { 'category':'C/C++', 'severity':severity.HIGH, 'members':[], 'option':'',
81 'description':'Potential leak of memory, bad free, use after free',
82 'patterns':[r".*: warning: Potential leak of memory",
83 r".*: warning: Potential memory leak",
84 r".*: warning: Memory allocated by .+ should be deallocated by .+ not .+",
85 r".*: warning: 'delete' applied to a pointer that was allocated",
86 r".*: warning: Use of memory after it is freed",
87 r".*: warning: Argument to .+ is the address of .+ variable",
88 r".*: warning: Argument to free\(\) is offset by .+ of memory allocated by",
89 r".*: warning: Attempt to .+ released memory"] },
90 { 'category':'C/C++', 'severity':severity.HIGH, 'members':[], 'option':'',
91 'description':'Return address of stack memory',
Chih-Hung Hsiehba0ddcd2016-03-21 11:28:30 -070092 'patterns':[r".*: warning: Address of stack memory .+ returned to caller",
93 r".*: warning: Address of stack memory .+ will be a dangling reference"] },
Chih-Hung Hsiehf8aaf602016-03-16 12:18:16 -070094 { 'category':'C/C++', 'severity':severity.HIGH, 'members':[], 'option':'',
95 'description':'Problem with vfork',
96 'patterns':[r".*: warning: This .+ is prohibited after a successful vfork",
97 r".*: warning: Call to function 'vfork' is insecure "] },
98 { 'category':'C/C++', 'severity':severity.HIGH, 'members':[], 'option':'infinite-recursion',
99 'description':'Infinite recursion',
100 'patterns':[r".*: warning: all paths through this function will call itself"] },
101 { 'category':'C/C++', 'severity':severity.HIGH, 'members':[], 'option':'',
102 'description':'Potential buffer overflow',
103 'patterns':[r".*: warning: Size argument is greater than .+ the destination buffer",
104 r".*: warning: Potential buffer overflow.",
105 r".*: warning: String copy function overflows destination buffer"] },
Marco Nelissen594375d2009-07-14 09:04:04 -0700106 { 'category':'C/C++', 'severity':severity.MEDIUM, 'members':[], 'option':'',
107 'description':'Incompatible pointer types',
108 'patterns':[r".*: warning: assignment from incompatible pointer type",
Marco Nelissen8e201962010-03-10 16:16:02 -0800109 r".*: warning: return from incompatible pointer type",
Marco Nelissen594375d2009-07-14 09:04:04 -0700110 r".*: warning: passing argument [0-9]+ of '.*' from incompatible pointer type",
111 r".*: warning: initialization from incompatible pointer type"] },
112 { 'category':'C/C++', 'severity':severity.HIGH, 'members':[], 'option':'-fno-builtin',
113 'description':'Incompatible declaration of built in function',
114 'patterns':[r".*: warning: incompatible implicit declaration of built-in function .+"] },
115 { 'category':'C/C++', 'severity':severity.MEDIUM, 'members':[], 'option':'-Wunused-parameter',
116 'description':'Unused parameter',
117 'patterns':[r".*: warning: unused parameter '.*'"] },
118 { 'category':'C/C++', 'severity':severity.MEDIUM, 'members':[], 'option':'-Wunused',
119 'description':'Unused function, variable or label',
Marco Nelissen8e201962010-03-10 16:16:02 -0800120 'patterns':[r".*: warning: '.+' defined but not used",
Chih-Hung Hsiehba0ddcd2016-03-21 11:28:30 -0700121 r".*: warning: unused function '.+'",
Chih-Hung Hsieh90d46192016-03-29 15:33:11 -0700122 r".*: warning: private field '.+' is not used",
Marco Nelissen8e201962010-03-10 16:16:02 -0800123 r".*: warning: unused variable '.+'"] },
Marco Nelissen594375d2009-07-14 09:04:04 -0700124 { 'category':'C/C++', 'severity':severity.MEDIUM, 'members':[], 'option':'-Wunused-value',
Chih-Hung Hsieh90d46192016-03-29 15:33:11 -0700125 'description':'Statement with no effect or result unused',
126 'patterns':[r".*: warning: statement with no effect",
127 r".*: warning: expression result unused"] },
128 { 'category':'C/C++', 'severity':severity.MEDIUM, 'members':[], 'option':'-Wunused-result',
129 'description':'Ignoreing return value of function',
130 'patterns':[r".*: warning: ignoring return value of function .+Wunused-result"] },
Marco Nelissen594375d2009-07-14 09:04:04 -0700131 { 'category':'C/C++', 'severity':severity.MEDIUM, 'members':[], 'option':'-Wmissing-field-initializers',
132 'description':'Missing initializer',
133 'patterns':[r".*: warning: missing initializer"] },
134 { 'category':'cont.', 'severity':severity.SKIP, 'members':[], 'option':'',
135 'description':'',
136 'patterns':[r".*: warning: \(near initialization for '.+'\)"] },
137 { 'category':'C/C++', 'severity':severity.MEDIUM, 'members':[], 'option':'-Wformat',
138 'description':'Format string does not match arguments',
Chih-Hung Hsiehf8aaf602016-03-16 12:18:16 -0700139 'patterns':[r".*: warning: format '.+' expects type '.+', but argument [0-9]+ has type '.+'",
140 r".*: warning: more '%' conversions than data arguments",
141 r".*: warning: data argument not used by format string",
142 r".*: warning: incomplete format specifier",
143 r".*: warning: format .+ expects .+ but argument .+Wformat=",
144 r".*: warning: field precision should have .+ but argument has .+Wformat",
Chih-Hung Hsiehba0ddcd2016-03-21 11:28:30 -0700145 r".*: warning: format specifies type .+ but the argument has .*type .+Wformat"] },
Marco Nelissen594375d2009-07-14 09:04:04 -0700146 { 'category':'C/C++', 'severity':severity.MEDIUM, 'members':[], 'option':'-Wformat-extra-args',
147 'description':'Too many arguments for format string',
148 'patterns':[r".*: warning: too many arguments for format"] },
Chih-Hung Hsiehf8aaf602016-03-16 12:18:16 -0700149 { 'category':'C/C++', 'severity':severity.MEDIUM, 'members':[], 'option':'-Wformat-invalid-specifier',
150 'description':'Invalid format specifier',
151 'patterns':[r".*: warning: invalid .+ specifier '.+'.+format-invalid-specifier"] },
Marco Nelissen594375d2009-07-14 09:04:04 -0700152 { 'category':'C/C++', 'severity':severity.MEDIUM, 'members':[], 'option':'-Wsign-compare',
153 'description':'Comparison between signed and unsigned',
154 'patterns':[r".*: warning: comparison between signed and unsigned",
155 r".*: warning: comparison of promoted \~unsigned with unsigned",
156 r".*: warning: signed and unsigned type in conditional expression"] },
Marco Nelissen8e201962010-03-10 16:16:02 -0800157 { 'category':'C/C++', 'severity':severity.MEDIUM, 'members':[], 'option':'',
158 'description':'Comparison between enum and non-enum',
159 'patterns':[r".*: warning: enumeral and non-enumeral type in conditional expression"] },
Marco Nelissen594375d2009-07-14 09:04:04 -0700160 { 'category':'libpng', 'severity':severity.MEDIUM, 'members':[], 'option':'',
161 'description':'libpng: zero area',
162 'patterns':[r".*libpng warning: Ignoring attempt to set cHRM RGB triangle with zero area"] },
163 { 'category':'aapt', 'severity':severity.MEDIUM, 'members':[], 'option':'',
164 'description':'aapt: no comment for public symbol',
165 'patterns':[r".*: warning: No comment for public symbol .+"] },
166 { 'category':'C/C++', 'severity':severity.MEDIUM, 'members':[], 'option':'-Wmissing-braces',
167 'description':'Missing braces around initializer',
168 'patterns':[r".*: warning: missing braces around initializer.*"] },
169 { 'category':'C/C++', 'severity':severity.HARMLESS, 'members':[], 'option':'',
170 'description':'No newline at end of file',
171 'patterns':[r".*: warning: no newline at end of file"] },
172 { 'category':'C/C++', 'severity':severity.MEDIUM, 'members':[], 'option':'-Wcast-qual',
173 'description':'Qualifier discarded',
174 'patterns':[r".*: warning: passing argument [0-9]+ of '.+' discards qualifiers from pointer target type",
175 r".*: warning: assignment discards qualifiers from pointer target type",
Chih-Hung Hsiehba0ddcd2016-03-21 11:28:30 -0700176 r".*: warning: passing .+ to parameter of type .+ discards qualifiers",
177 r".*: warning: assigning to .+ from .+ discards qualifiers",
Marco Nelissen594375d2009-07-14 09:04:04 -0700178 r".*: warning: return discards qualifiers from pointer target type"] },
179 { 'category':'C/C++', 'severity':severity.MEDIUM, 'members':[], 'option':'-Wattributes',
180 'description':'Attribute ignored',
181 'patterns':[r".*: warning: '_*packed_*' attribute ignored"] },
182 { 'category':'C/C++', 'severity':severity.MEDIUM, 'members':[], 'option':'-Wattributes',
183 'description':'Visibility mismatch',
184 'patterns':[r".*: warning: '.+' declared with greater visibility than the type of its field '.+'"] },
185 { 'category':'C/C++', 'severity':severity.MEDIUM, 'members':[], 'option':'',
186 'description':'Shift count greater than width of type',
187 'patterns':[r".*: warning: (left|right) shift count >= width of type"] },
188 { 'category':'C/C++', 'severity':severity.MEDIUM, 'members':[], 'option':'',
189 'description':'extern <foo> is initialized',
190 'patterns':[r".*: warning: '.+' initialized and declared 'extern'"] },
191 { 'category':'C/C++', 'severity':severity.MEDIUM, 'members':[], 'option':'-Wold-style-declaration',
192 'description':'Old style declaration',
193 'patterns':[r".*: warning: 'static' is not at beginning of declaration"] },
194 { 'category':'C/C++', 'severity':severity.MEDIUM, 'members':[], 'option':'-Wuninitialized',
195 'description':'Variable may be used uninitialized',
196 'patterns':[r".*: warning: '.+' may be used uninitialized in this function"] },
197 { 'category':'C/C++', 'severity':severity.HIGH, 'members':[], 'option':'-Wuninitialized',
198 'description':'Variable is used uninitialized',
Chih-Hung Hsiehf8aaf602016-03-16 12:18:16 -0700199 'patterns':[r".*: warning: '.+' is used uninitialized in this function",
200 r".*: warning: variable '.+' is uninitialized when used here"] },
Marco Nelissen594375d2009-07-14 09:04:04 -0700201 { 'category':'ld', 'severity':severity.MEDIUM, 'members':[], 'option':'-fshort-enums',
202 'description':'ld: possible enum size mismatch',
203 'patterns':[r".*: warning: .* uses variable-size enums yet the output is to use 32-bit enums; use of enum values across objects may fail"] },
204 { 'category':'C/C++', 'severity':severity.MEDIUM, 'members':[], 'option':'-Wpointer-sign',
205 'description':'Pointer targets differ in signedness',
206 'patterns':[r".*: warning: pointer targets in initialization differ in signedness",
207 r".*: warning: pointer targets in assignment differ in signedness",
208 r".*: warning: pointer targets in return differ in signedness",
209 r".*: warning: pointer targets in passing argument [0-9]+ of '.+' differ in signedness"] },
210 { 'category':'C/C++', 'severity':severity.MEDIUM, 'members':[], 'option':'-Wstrict-overflow',
211 'description':'Assuming overflow does not occur',
212 'patterns':[r".*: warning: assuming signed overflow does not occur when assuming that .* is always (true|false)"] },
213 { 'category':'C/C++', 'severity':severity.MEDIUM, 'members':[], 'option':'-Wempty-body',
214 'description':'Suggest adding braces around empty body',
215 'patterns':[r".*: warning: suggest braces around empty body in an 'if' statement",
216 r".*: warning: empty body in an if-statement",
217 r".*: warning: suggest braces around empty body in an 'else' statement",
218 r".*: warning: empty body in an else-statement"] },
219 { 'category':'C/C++', 'severity':severity.MEDIUM, 'members':[], 'option':'-Wparentheses',
220 'description':'Suggest adding parentheses',
221 'patterns':[r".*: warning: suggest explicit braces to avoid ambiguous 'else'",
222 r".*: warning: suggest parentheses around arithmetic in operand of '.+'",
223 r".*: warning: suggest parentheses around comparison in operand of '.+'",
Chih-Hung Hsiehba0ddcd2016-03-21 11:28:30 -0700224 r".*: warning: logical not is only applied to the left hand side of this comparison",
225 r".*: warning: using the result of an assignment as a condition without parentheses",
226 r".*: warning: .+ has lower precedence than .+ be evaluated first .+Wparentheses",
Marco Nelissen594375d2009-07-14 09:04:04 -0700227 r".*: warning: suggest parentheses around '.+?' .+ '.+?'",
228 r".*: warning: suggest parentheses around assignment used as truth value"] },
229 { 'category':'C/C++', 'severity':severity.MEDIUM, 'members':[], 'option':'',
230 'description':'Static variable used in non-static inline function',
231 'patterns':[r".*: warning: '.+' is static but used in inline function '.+' which is not static"] },
232 { 'category':'C/C++', 'severity':severity.MEDIUM, 'members':[], 'option':'-Wimplicit int',
233 'description':'No type or storage class (will default to int)',
234 'patterns':[r".*: warning: data definition has no type or storage class"] },
Chih-Hung Hsiehf8aaf602016-03-16 12:18:16 -0700235 { 'category':'C/C++', 'severity':severity.MEDIUM, 'members':[], 'option':'',
236 'description':'Null pointer',
237 'patterns':[r".*: warning: Dereference of null pointer",
238 r".*: warning: Called .+ pointer is null",
239 r".*: warning: Forming reference to null pointer",
240 r".*: warning: Returning null reference",
241 r".*: warning: Null pointer passed as an argument to a 'nonnull' parameter",
242 r".*: warning: .+ results in a null pointer dereference",
243 r".*: warning: Access to .+ results in a dereference of a null pointer",
244 r".*: warning: Null pointer argument in"] },
Marco Nelissen594375d2009-07-14 09:04:04 -0700245 { 'category':'cont.', 'severity':severity.SKIP, 'members':[], 'option':'',
246 'description':'',
247 'patterns':[r".*: warning: type defaults to 'int' in declaration of '.+'"] },
248 { 'category':'cont.', 'severity':severity.SKIP, 'members':[], 'option':'',
249 'description':'',
250 'patterns':[r".*: warning: parameter names \(without types\) in function declaration"] },
251 { 'category':'C/C++', 'severity':severity.MEDIUM, 'members':[], 'option':'-Wstrict-aliasing',
252 'description':'Dereferencing <foo> breaks strict aliasing rules',
253 'patterns':[r".*: warning: dereferencing .* break strict-aliasing rules"] },
254 { 'category':'C/C++', 'severity':severity.MEDIUM, 'members':[], 'option':'-Wpointer-to-int-cast',
255 'description':'Cast from pointer to integer of different size',
256 'patterns':[r".*: warning: cast from pointer to integer of different size"] },
257 { 'category':'C/C++', 'severity':severity.MEDIUM, 'members':[], 'option':'-Wint-to-pointer-cast',
258 'description':'Cast to pointer from integer of different size',
259 'patterns':[r".*: warning: cast to pointer from integer of different size"] },
260 { 'category':'C/C++', 'severity':severity.MEDIUM, 'members':[], 'option':'',
261 'description':'Symbol redefined',
262 'patterns':[r".*: warning: "".+"" redefined"] },
263 { 'category':'cont.', 'severity':severity.SKIP, 'members':[], 'option':'',
264 'description':'',
265 'patterns':[r".*: warning: this is the location of the previous definition"] },
266 { 'category':'ld', 'severity':severity.MEDIUM, 'members':[], 'option':'',
267 'description':'ld: type and size of dynamic symbol are not defined',
268 'patterns':[r".*: warning: type and size of dynamic symbol `.+' are not defined"] },
269 { 'category':'C/C++', 'severity':severity.MEDIUM, 'members':[], 'option':'',
270 'description':'Pointer from integer without cast',
271 'patterns':[r".*: warning: assignment makes pointer from integer without a cast"] },
272 { 'category':'C/C++', 'severity':severity.MEDIUM, 'members':[], 'option':'',
273 'description':'Pointer from integer without cast',
274 'patterns':[r".*: warning: passing argument [0-9]+ of '.+' makes pointer from integer without a cast"] },
275 { 'category':'C/C++', 'severity':severity.MEDIUM, 'members':[], 'option':'',
276 'description':'Integer from pointer without cast',
277 'patterns':[r".*: warning: assignment makes integer from pointer without a cast"] },
278 { 'category':'C/C++', 'severity':severity.MEDIUM, 'members':[], 'option':'',
279 'description':'Integer from pointer without cast',
280 'patterns':[r".*: warning: passing argument [0-9]+ of '.+' makes integer from pointer without a cast"] },
281 { 'category':'C/C++', 'severity':severity.MEDIUM, 'members':[], 'option':'',
282 'description':'Integer from pointer without cast',
283 'patterns':[r".*: warning: return makes integer from pointer without a cast"] },
284 { 'category':'C/C++', 'severity':severity.MEDIUM, 'members':[], 'option':'-Wunknown-pragmas',
285 'description':'Ignoring pragma',
286 'patterns':[r".*: warning: ignoring #pragma .+"] },
287 { 'category':'C/C++', 'severity':severity.MEDIUM, 'members':[], 'option':'-Wclobbered',
288 'description':'Variable might be clobbered by longjmp or vfork',
289 'patterns':[r".*: warning: variable '.+' might be clobbered by 'longjmp' or 'vfork'"] },
290 { 'category':'C/C++', 'severity':severity.MEDIUM, 'members':[], 'option':'-Wclobbered',
291 'description':'Argument might be clobbered by longjmp or vfork',
292 'patterns':[r".*: warning: argument '.+' might be clobbered by 'longjmp' or 'vfork'"] },
293 { 'category':'C/C++', 'severity':severity.MEDIUM, 'members':[], 'option':'-Wredundant-decls',
294 'description':'Redundant declaration',
295 'patterns':[r".*: warning: redundant redeclaration of '.+'"] },
296 { 'category':'cont.', 'severity':severity.SKIP, 'members':[], 'option':'',
297 'description':'',
298 'patterns':[r".*: warning: previous declaration of '.+' was here"] },
299 { 'category':'C/C++', 'severity':severity.MEDIUM, 'members':[], 'option':'-Wswitch-enum',
300 'description':'Enum value not handled in switch',
Chih-Hung Hsiehba0ddcd2016-03-21 11:28:30 -0700301 'patterns':[r".*: warning: .*enumeration value.* not handled in switch.+Wswitch"] },
Marco Nelissen594375d2009-07-14 09:04:04 -0700302 { 'category':'java', 'severity':severity.MEDIUM, 'members':[], 'option':'-encoding',
303 'description':'Java: Non-ascii characters used, but ascii encoding specified',
304 'patterns':[r".*: warning: unmappable character for encoding ascii"] },
305 { 'category':'java', 'severity':severity.MEDIUM, 'members':[], 'option':'',
306 'description':'Java: Non-varargs call of varargs method with inexact argument type for last parameter',
307 'patterns':[r".*: warning: non-varargs call of varargs method with inexact argument type for last parameter"] },
Chih-Hung Hsiehba0ddcd2016-03-21 11:28:30 -0700308 { 'category':'java', 'severity':severity.MEDIUM, 'members':[], 'option':'',
309 'description':'Java: Unchecked method invocation',
310 'patterns':[r".*: warning: \[unchecked\] unchecked method invocation: .+ in class .+"] },
311 { 'category':'java', 'severity':severity.MEDIUM, 'members':[], 'option':'',
312 'description':'Java: Unchecked conversion',
313 'patterns':[r".*: warning: \[unchecked\] unchecked conversion"] },
Ian Rogers32bb9bd2016-05-09 23:19:42 -0700314
Ian Rogers6e520032016-05-13 08:59:00 -0700315 # Warnings from Error Prone.
316 {'category': 'java',
317 'severity': severity.MEDIUM,
318 'members': [],
319 'option': '',
320 'description': 'Java: Use of deprecated member',
321 'patterns': [r'.*: warning: \[deprecation\] .+']},
322 {'category': 'java',
323 'severity': severity.MEDIUM,
324 'members': [],
325 'option': '',
326 'description': 'Java: Unchecked conversion',
327 'patterns': [r'.*: warning: \[unchecked\] .+']},
Ian Rogers32bb9bd2016-05-09 23:19:42 -0700328
Ian Rogers6e520032016-05-13 08:59:00 -0700329 # Warnings from Error Prone (auto generated list).
330 {'category': 'java',
331 'severity': severity.LOW,
332 'members': [],
333 'option': '',
334 'description':
335 'Java: Deprecated item is not annotated with @Deprecated',
336 'patterns': [r".*: warning: \[DepAnn\] .+"]},
337 {'category': 'java',
338 'severity': severity.LOW,
339 'members': [],
340 'option': '',
341 'description':
342 'Java: Fallthrough warning suppression has no effect if warning is suppressed',
343 'patterns': [r".*: warning: \[FallthroughSuppression\] .+"]},
344 {'category': 'java',
345 'severity': severity.LOW,
346 'members': [],
347 'option': '',
348 'description':
349 'Java: Prefer \'L\' to \'l\' for the suffix to long literals',
350 'patterns': [r".*: warning: \[LongLiteralLowerCaseSuffix\] .+"]},
351 {'category': 'java',
352 'severity': severity.LOW,
353 'members': [],
354 'option': '',
355 'description':
356 'Java: @Binds is a more efficient and declaritive mechanism for delegating a binding.',
357 'patterns': [r".*: warning: \[UseBinds\] .+"]},
358 {'category': 'java',
359 'severity': severity.MEDIUM,
360 'members': [],
361 'option': '',
362 'description':
363 'Java: Assertions may be disabled at runtime and do not guarantee that execution will halt here; consider throwing an exception instead',
364 'patterns': [r".*: warning: \[AssertFalse\] .+"]},
365 {'category': 'java',
366 'severity': severity.MEDIUM,
367 'members': [],
368 'option': '',
369 'description':
370 'Java: Classes that implement Annotation must override equals and hashCode. Consider using AutoAnnotation instead of implementing Annotation by hand.',
371 'patterns': [r".*: warning: \[BadAnnotationImplementation\] .+"]},
372 {'category': 'java',
373 'severity': severity.MEDIUM,
374 'members': [],
375 'option': '',
376 'description':
377 'Java: BigDecimal(double) and BigDecimal.valueOf(double) may lose precision, prefer BigDecimal(String) or BigDecimal(long)',
378 'patterns': [r".*: warning: \[BigDecimalLiteralDouble\] .+"]},
379 {'category': 'java',
380 'severity': severity.MEDIUM,
381 'members': [],
382 'option': '',
383 'description':
384 'Java: Mockito cannot mock final classes',
385 'patterns': [r".*: warning: \[CannotMockFinalClass\] .+"]},
386 {'category': 'java',
387 'severity': severity.MEDIUM,
388 'members': [],
389 'option': '',
390 'description':
391 'Java: This code, which counts elements using a loop, can be replaced by a simpler library method',
392 'patterns': [r".*: warning: \[ElementsCountedInLoop\] .+"]},
393 {'category': 'java',
394 'severity': severity.MEDIUM,
395 'members': [],
396 'option': '',
397 'description':
398 'Java: Empty top-level type declaration',
399 'patterns': [r".*: warning: \[EmptyTopLevelDeclaration\] .+"]},
400 {'category': 'java',
401 'severity': severity.MEDIUM,
402 'members': [],
403 'option': '',
404 'description':
405 'Java: Classes that override equals should also override hashCode.',
406 'patterns': [r".*: warning: \[EqualsHashCode\] .+"]},
407 {'category': 'java',
408 'severity': severity.MEDIUM,
409 'members': [],
410 'option': '',
411 'description':
412 'Java: An equality test between objects with incompatible types always returns false',
413 'patterns': [r".*: warning: \[EqualsIncompatibleType\] .+"]},
414 {'category': 'java',
415 'severity': severity.MEDIUM,
416 'members': [],
417 'option': '',
418 'description':
419 'Java: If you return or throw from a finally, then values returned or thrown from the try-catch block will be ignored. Consider using try-with-resources instead.',
420 'patterns': [r".*: warning: \[Finally\] .+"]},
421 {'category': 'java',
422 'severity': severity.MEDIUM,
423 'members': [],
424 'option': '',
425 'description':
426 'Java: This annotation has incompatible modifiers as specified by its @IncompatibleModifiers annotation',
427 'patterns': [r".*: warning: \[IncompatibleModifiers\] .+"]},
428 {'category': 'java',
429 'severity': severity.MEDIUM,
430 'members': [],
431 'option': '',
432 'description':
433 'Java: Class should not implement both `Iterable` and `Iterator`',
434 'patterns': [r".*: warning: \[IterableAndIterator\] .+"]},
435 {'category': 'java',
436 'severity': severity.MEDIUM,
437 'members': [],
438 'option': '',
439 'description':
440 'Java: Floating-point comparison without error tolerance',
441 'patterns': [r".*: warning: \[JUnit3FloatingPointComparisonWithoutDelta\] .+"]},
442 {'category': 'java',
443 'severity': severity.MEDIUM,
444 'members': [],
445 'option': '',
446 'description':
447 'Java: Test class inherits from JUnit 3\'s TestCase but has JUnit 4 @Test annotations.',
448 'patterns': [r".*: warning: \[JUnitAmbiguousTestClass\] .+"]},
449 {'category': 'java',
450 'severity': severity.MEDIUM,
451 'members': [],
452 'option': '',
453 'description':
454 'Java: Enum switch statement is missing cases',
455 'patterns': [r".*: warning: \[MissingCasesInEnumSwitch\] .+"]},
456 {'category': 'java',
457 'severity': severity.MEDIUM,
458 'members': [],
459 'option': '',
460 'description':
461 'Java: Not calling fail() when expecting an exception masks bugs',
462 'patterns': [r".*: warning: \[MissingFail\] .+"]},
463 {'category': 'java',
464 'severity': severity.MEDIUM,
465 'members': [],
466 'option': '',
467 'description':
468 'Java: method overrides method in supertype; expected @Override',
469 'patterns': [r".*: warning: \[MissingOverride\] .+"]},
470 {'category': 'java',
471 'severity': severity.MEDIUM,
472 'members': [],
473 'option': '',
474 'description':
475 'Java: Source files should not contain multiple top-level class declarations',
476 'patterns': [r".*: warning: \[MultipleTopLevelClasses\] .+"]},
477 {'category': 'java',
478 'severity': severity.MEDIUM,
479 'members': [],
480 'option': '',
481 'description':
482 'Java: This update of a volatile variable is non-atomic',
483 'patterns': [r".*: warning: \[NonAtomicVolatileUpdate\] .+"]},
484 {'category': 'java',
485 'severity': severity.MEDIUM,
486 'members': [],
487 'option': '',
488 'description':
489 'Java: Static import of member uses non-canonical name',
490 'patterns': [r".*: warning: \[NonCanonicalStaticMemberImport\] .+"]},
491 {'category': 'java',
492 'severity': severity.MEDIUM,
493 'members': [],
494 'option': '',
495 'description':
496 'Java: equals method doesn\'t override Object.equals',
497 'patterns': [r".*: warning: \[NonOverridingEquals\] .+"]},
498 {'category': 'java',
499 'severity': severity.MEDIUM,
500 'members': [],
501 'option': '',
502 'description':
503 'Java: Constructors should not be annotated with @Nullable since they cannot return null',
504 'patterns': [r".*: warning: \[NullableConstructor\] .+"]},
505 {'category': 'java',
506 'severity': severity.MEDIUM,
507 'members': [],
508 'option': '',
509 'description':
510 'Java: @Nullable should not be used for primitive types since they cannot be null',
511 'patterns': [r".*: warning: \[NullablePrimitive\] .+"]},
512 {'category': 'java',
513 'severity': severity.MEDIUM,
514 'members': [],
515 'option': '',
516 'description':
517 'Java: void-returning methods should not be annotated with @Nullable, since they cannot return null',
518 'patterns': [r".*: warning: \[NullableVoid\] .+"]},
519 {'category': 'java',
520 'severity': severity.MEDIUM,
521 'members': [],
522 'option': '',
523 'description':
524 'Java: Package names should match the directory they are declared in',
525 'patterns': [r".*: warning: \[PackageLocation\] .+"]},
526 {'category': 'java',
527 'severity': severity.MEDIUM,
528 'members': [],
529 'option': '',
530 'description':
531 'Java: Second argument to Preconditions.* is a call to String.format(), which can be unwrapped',
532 'patterns': [r".*: warning: \[PreconditionsErrorMessageEagerEvaluation\] .+"]},
533 {'category': 'java',
534 'severity': severity.MEDIUM,
535 'members': [],
536 'option': '',
537 'description':
538 'Java: Preconditions only accepts the %s placeholder in error message strings',
539 'patterns': [r".*: warning: \[PreconditionsInvalidPlaceholder\] .+"]},
540 {'category': 'java',
541 'severity': severity.MEDIUM,
542 'members': [],
543 'option': '',
544 'description':
545 'Java: Passing a primitive array to a varargs method is usually wrong',
546 'patterns': [r".*: warning: \[PrimitiveArrayPassedToVarargsMethod\] .+"]},
547 {'category': 'java',
548 'severity': severity.MEDIUM,
549 'members': [],
550 'option': '',
551 'description':
552 'Java: Protobuf fields cannot be null, so this check is redundant',
553 'patterns': [r".*: warning: \[ProtoFieldPreconditionsCheckNotNull\] .+"]},
554 {'category': 'java',
555 'severity': severity.MEDIUM,
556 'members': [],
557 'option': '',
558 'description':
559 'Java: This annotation is missing required modifiers as specified by its @RequiredModifiers annotation',
560 'patterns': [r".*: warning: \[RequiredModifiers\] .+"]},
561 {'category': 'java',
562 'severity': severity.MEDIUM,
563 'members': [],
564 'option': '',
565 'description':
566 'Java: A static variable or method should not be accessed from an object instance',
567 'patterns': [r".*: warning: \[StaticAccessedFromInstance\] .+"]},
568 {'category': 'java',
569 'severity': severity.MEDIUM,
570 'members': [],
571 'option': '',
572 'description':
573 'Java: String comparison using reference equality instead of value equality',
574 'patterns': [r".*: warning: \[StringEquality\] .+"]},
575 {'category': 'java',
576 'severity': severity.MEDIUM,
577 'members': [],
578 'option': '',
579 'description':
580 'Java: Declaring a type parameter that is only used in the return type is a misuse of generics: operations on the type parameter are unchecked, it hides unsafe casts at invocations of the method, and it interacts badly with method overload resolution.',
581 'patterns': [r".*: warning: \[TypeParameterUnusedInFormals\] .+"]},
582 {'category': 'java',
583 'severity': severity.MEDIUM,
584 'members': [],
585 'option': '',
586 'description':
587 'Java: Using static imports for types is unnecessary',
588 'patterns': [r".*: warning: \[UnnecessaryStaticImport\] .+"]},
589 {'category': 'java',
590 'severity': severity.MEDIUM,
591 'members': [],
592 'option': '',
593 'description':
594 'Java: Unsynchronized method overrides a synchronized method.',
595 'patterns': [r".*: warning: \[UnsynchronizedOverridesSynchronized\] .+"]},
596 {'category': 'java',
597 'severity': severity.MEDIUM,
598 'members': [],
599 'option': '',
600 'description':
601 'Java: Non-constant variable missing @Var annotation',
602 'patterns': [r".*: warning: \[Var\] .+"]},
603 {'category': 'java',
604 'severity': severity.MEDIUM,
605 'members': [],
606 'option': '',
607 'description':
608 'Java: Because of spurious wakeups, Object.wait() and Condition.await() must always be called in a loop',
609 'patterns': [r".*: warning: \[WaitNotInLoop\] .+"]},
610 {'category': 'java',
611 'severity': severity.MEDIUM,
612 'members': [],
613 'option': '',
614 'description':
615 'Java: Subclasses of Fragment must be instantiable via Class#newInstance(): the class must be public, static and have a public nullary constructor',
616 'patterns': [r".*: warning: \[FragmentNotInstantiable\] .+"]},
617 {'category': 'java',
618 'severity': severity.MEDIUM,
619 'members': [],
620 'option': '',
621 'description':
622 'Java: Hardcoded reference to /sdcard',
623 'patterns': [r".*: warning: \[HardCodedSdCardPath\] .+"]},
624 {'category': 'java',
625 'severity': severity.MEDIUM,
626 'members': [],
627 'option': '',
628 'description':
629 'Java: Incompatible type as argument to Object-accepting Java collections method',
630 'patterns': [r".*: warning: \[CollectionIncompatibleType\] .+"]},
631 {'category': 'java',
632 'severity': severity.MEDIUM,
633 'members': [],
634 'option': '',
635 'description':
636 'Java: @AssistedInject and @Inject should not be used on different constructors in the same class.',
637 'patterns': [r".*: warning: \[AssistedInjectAndInjectOnConstructors\] .+"]},
638 {'category': 'java',
639 'severity': severity.MEDIUM,
640 'members': [],
641 'option': '',
642 'description':
643 'Java: Although Guice allows injecting final fields, doing so is not recommended because the injected value may not be visible to other threads.',
644 'patterns': [r".*: warning: \[GuiceInjectOnFinalField\] .+"]},
645 {'category': 'java',
646 'severity': severity.MEDIUM,
647 'members': [],
648 'option': '',
649 'description':
650 'Java: This method is not annotated with @Inject, but it overrides a method that is annotated with @com.google.inject.Inject. Guice will inject this method, and it is recommended to annotate it explicitly.',
651 'patterns': [r".*: warning: \[OverridesGuiceInjectableMethod\] .+"]},
652 {'category': 'java',
653 'severity': severity.MEDIUM,
654 'members': [],
655 'option': '',
656 'description':
657 'Java: Double-checked locking on non-volatile fields is unsafe',
658 'patterns': [r".*: warning: \[DoubleCheckedLocking\] .+"]},
659 {'category': 'java',
660 'severity': severity.MEDIUM,
661 'members': [],
662 'option': '',
663 'description':
664 'Java: Writes to static fields should not be guarded by instance locks',
665 'patterns': [r".*: warning: \[StaticGuardedByInstance\] .+"]},
666 {'category': 'java',
667 'severity': severity.MEDIUM,
668 'members': [],
669 'option': '',
670 'description':
671 'Java: Synchronizing on non-final fields is not safe: if the field is ever updated, different threads may end up locking on different objects.',
672 'patterns': [r".*: warning: \[SynchronizeOnNonFinalField\] .+"]},
673 {'category': 'java',
674 'severity': severity.HIGH,
675 'members': [],
676 'option': '',
677 'description':
678 'Java: Reference equality used to compare arrays',
679 'patterns': [r".*: warning: \[ArrayEquals\] .+"]},
680 {'category': 'java',
681 'severity': severity.HIGH,
682 'members': [],
683 'option': '',
684 'description':
685 'Java: hashcode method on array does not hash array contents',
686 'patterns': [r".*: warning: \[ArrayHashCode\] .+"]},
687 {'category': 'java',
688 'severity': severity.HIGH,
689 'members': [],
690 'option': '',
691 'description':
692 'Java: Calling toString on an array does not provide useful information',
693 'patterns': [r".*: warning: \[ArrayToString.*\] .+"]},
694 {'category': 'java',
695 'severity': severity.HIGH,
696 'members': [],
697 'option': '',
698 'description':
699 'Java: Arrays.asList does not autobox primitive arrays, as one might expect.',
700 'patterns': [r".*: warning: \[ArraysAsListPrimitiveArray\] .+"]},
701 {'category': 'java',
702 'severity': severity.HIGH,
703 'members': [],
704 'option': '',
705 'description':
706 'Java: AsyncCallable should not return a null Future, only a Future whose result is null.',
707 'patterns': [r".*: warning: \[AsyncCallableReturnsNull\] .+"]},
708 {'category': 'java',
709 'severity': severity.HIGH,
710 'members': [],
711 'option': '',
712 'description':
713 'Java: AsyncFunction should not return a null Future, only a Future whose result is null.',
714 'patterns': [r".*: warning: \[AsyncFunctionReturnsNull\] .+"]},
715 {'category': 'java',
716 'severity': severity.HIGH,
717 'members': [],
718 'option': '',
719 'description':
720 'Java: Possible sign flip from narrowing conversion',
721 'patterns': [r".*: warning: \[BadComparable\] .+"]},
722 {'category': 'java',
723 'severity': severity.HIGH,
724 'members': [],
725 'option': '',
726 'description':
727 'Java: Shift by an amount that is out of range',
728 'patterns': [r".*: warning: \[BadShiftAmount\] .+"]},
729 {'category': 'java',
730 'severity': severity.HIGH,
731 'members': [],
732 'option': '',
733 'description':
734 'Java: valueOf provides better time and space performance',
735 'patterns': [r".*: warning: \[BoxedPrimitiveConstructor\] .+"]},
736 {'category': 'java',
737 'severity': severity.HIGH,
738 'members': [],
739 'option': '',
740 'description':
741 'Java: The called constructor accepts a parameter with the same name and type as one of its caller\'s parameters, but its caller doesn\'t pass that parameter to it. It\'s likely that it was intended to.',
742 'patterns': [r".*: warning: \[ChainingConstructorIgnoresParameter\] .+"]},
743 {'category': 'java',
744 'severity': severity.HIGH,
745 'members': [],
746 'option': '',
747 'description':
748 'Java: Ignored return value of method that is annotated with @CheckReturnValue',
749 'patterns': [r".*: warning: \[CheckReturnValue\] .+"]},
750 {'category': 'java',
751 'severity': severity.HIGH,
752 'members': [],
753 'option': '',
754 'description':
755 'Java: Inner class is non-static but does not reference enclosing class',
756 'patterns': [r".*: warning: \[ClassCanBeStatic\] .+"]},
757 {'category': 'java',
758 'severity': severity.HIGH,
759 'members': [],
760 'option': '',
761 'description':
762 'Java: The source file name should match the name of the top-level class it contains',
763 'patterns': [r".*: warning: \[ClassName\] .+"]},
764 {'category': 'java',
765 'severity': severity.HIGH,
766 'members': [],
767 'option': '',
768 'description':
769 'Java: This comparison method violates the contract',
770 'patterns': [r".*: warning: \[ComparisonContractViolated\] .+"]},
771 {'category': 'java',
772 'severity': severity.HIGH,
773 'members': [],
774 'option': '',
775 'description':
776 'Java: Comparison to value that is out of range for the compared type',
777 'patterns': [r".*: warning: \[ComparisonOutOfRange\] .+"]},
778 {'category': 'java',
779 'severity': severity.HIGH,
780 'members': [],
781 'option': '',
782 'description':
783 'Java: Non-compile-time constant expression passed to parameter with @CompileTimeConstant type annotation.',
784 'patterns': [r".*: warning: \[CompileTimeConstant\] .+"]},
785 {'category': 'java',
786 'severity': severity.HIGH,
787 'members': [],
788 'option': '',
789 'description':
790 'Java: Exception created but not thrown',
791 'patterns': [r".*: warning: \[DeadException\] .+"]},
792 {'category': 'java',
793 'severity': severity.HIGH,
794 'members': [],
795 'option': '',
796 'description':
797 'Java: Division by integer literal zero',
798 'patterns': [r".*: warning: \[DivZero\] .+"]},
799 {'category': 'java',
800 'severity': severity.HIGH,
801 'members': [],
802 'option': '',
803 'description':
804 'Java: Empty statement after if',
805 'patterns': [r".*: warning: \[EmptyIf\] .+"]},
806 {'category': 'java',
807 'severity': severity.HIGH,
808 'members': [],
809 'option': '',
810 'description':
811 'Java: == NaN always returns false; use the isNaN methods instead',
812 'patterns': [r".*: warning: \[EqualsNaN\] .+"]},
813 {'category': 'java',
814 'severity': severity.HIGH,
815 'members': [],
816 'option': '',
817 'description':
818 'Java: Method annotated @ForOverride must be protected or package-private and only invoked from declaring class',
819 'patterns': [r".*: warning: \[ForOverride\] .+"]},
820 {'category': 'java',
821 'severity': severity.HIGH,
822 'members': [],
823 'option': '',
824 'description':
825 'Java: Futures.getChecked requires a checked exception type with a standard constructor.',
826 'patterns': [r".*: warning: \[FuturesGetCheckedIllegalExceptionType\] .+"]},
827 {'category': 'java',
828 'severity': severity.HIGH,
829 'members': [],
830 'option': '',
831 'description':
832 'Java: Calling getClass() on an object of type Class returns the Class object for java.lang.Class; you probably meant to operate on the object directly',
833 'patterns': [r".*: warning: \[GetClassOnClass\] .+"]},
834 {'category': 'java',
835 'severity': severity.HIGH,
836 'members': [],
837 'option': '',
838 'description':
839 'Java: An object is tested for equality to itself using Guava Libraries',
840 'patterns': [r".*: warning: \[GuavaSelfEquals\] .+"]},
841 {'category': 'java',
842 'severity': severity.HIGH,
843 'members': [],
844 'option': '',
845 'description':
846 'Java: contains() is a legacy method that is equivalent to containsValue()',
847 'patterns': [r".*: warning: \[HashtableContains\] .+"]},
848 {'category': 'java',
849 'severity': severity.HIGH,
850 'members': [],
851 'option': '',
852 'description':
853 'Java: Cipher.getInstance() is invoked using either the default settings or ECB mode',
854 'patterns': [r".*: warning: \[InsecureCipherMode\] .+"]},
855 {'category': 'java',
856 'severity': severity.HIGH,
857 'members': [],
858 'option': '',
859 'description':
860 'Java: Invalid syntax used for a regular expression',
861 'patterns': [r".*: warning: \[InvalidPatternSyntax\] .+"]},
862 {'category': 'java',
863 'severity': severity.HIGH,
864 'members': [],
865 'option': '',
866 'description':
867 'Java: The argument to Class#isInstance(Object) should not be a Class',
868 'patterns': [r".*: warning: \[IsInstanceOfClass\] .+"]},
869 {'category': 'java',
870 'severity': severity.HIGH,
871 'members': [],
872 'option': '',
873 'description':
874 'Java: jMock tests must have a @RunWith(JMock.class) annotation, or the Mockery field must have a @Rule JUnit annotation',
875 'patterns': [r".*: warning: \[JMockTestWithoutRunWithOrRuleAnnotation\] .+"]},
876 {'category': 'java',
877 'severity': severity.HIGH,
878 'members': [],
879 'option': '',
880 'description':
881 'Java: Test method will not be run; please prefix name with "test"',
882 'patterns': [r".*: warning: \[JUnit3TestNotRun\] .+"]},
883 {'category': 'java',
884 'severity': severity.HIGH,
885 'members': [],
886 'option': '',
887 'description':
888 'Java: setUp() method will not be run; Please add a @Before annotation',
889 'patterns': [r".*: warning: \[JUnit4SetUpNotRun\] .+"]},
890 {'category': 'java',
891 'severity': severity.HIGH,
892 'members': [],
893 'option': '',
894 'description':
895 'Java: tearDown() method will not be run; Please add an @After annotation',
896 'patterns': [r".*: warning: \[JUnit4TearDownNotRun\] .+"]},
897 {'category': 'java',
898 'severity': severity.HIGH,
899 'members': [],
900 'option': '',
901 'description':
902 'Java: Test method will not be run; please add @Test annotation',
903 'patterns': [r".*: warning: \[JUnit4TestNotRun\] .+"]},
904 {'category': 'java',
905 'severity': severity.HIGH,
906 'members': [],
907 'option': '',
908 'description':
909 'Java: Printf-like format string does not match its arguments',
910 'patterns': [r".*: warning: \[MalformedFormatString\] .+"]},
911 {'category': 'java',
912 'severity': severity.HIGH,
913 'members': [],
914 'option': '',
915 'description':
916 'Java: Use of "YYYY" (week year) in a date pattern without "ww" (week in year). You probably meant to use "yyyy" (year) instead.',
917 'patterns': [r".*: warning: \[MisusedWeekYear\] .+"]},
918 {'category': 'java',
919 'severity': severity.HIGH,
920 'members': [],
921 'option': '',
922 'description':
923 'Java: A bug in Mockito will cause this test to fail at runtime with a ClassCastException',
924 'patterns': [r".*: warning: \[MockitoCast\] .+"]},
925 {'category': 'java',
926 'severity': severity.HIGH,
927 'members': [],
928 'option': '',
929 'description':
930 'Java: Missing method call for verify(mock) here',
931 'patterns': [r".*: warning: \[MockitoUsage\] .+"]},
932 {'category': 'java',
933 'severity': severity.HIGH,
934 'members': [],
935 'option': '',
936 'description':
937 'Java: Modifying a collection with itself',
938 'patterns': [r".*: warning: \[ModifyingCollectionWithItself\] .+"]},
939 {'category': 'java',
940 'severity': severity.HIGH,
941 'members': [],
942 'option': '',
943 'description':
944 'Java: Compound assignments to bytes, shorts, chars, and floats hide dangerous casts',
945 'patterns': [r".*: warning: \[NarrowingCompoundAssignment\] .+"]},
946 {'category': 'java',
947 'severity': severity.HIGH,
948 'members': [],
949 'option': '',
950 'description':
951 'Java: @NoAllocation was specified on this method, but something was found that would trigger an allocation',
952 'patterns': [r".*: warning: \[NoAllocation\] .+"]},
953 {'category': 'java',
954 'severity': severity.HIGH,
955 'members': [],
956 'option': '',
957 'description':
958 'Java: Static import of type uses non-canonical name',
959 'patterns': [r".*: warning: \[NonCanonicalStaticImport\] .+"]},
960 {'category': 'java',
961 'severity': severity.HIGH,
962 'members': [],
963 'option': '',
964 'description':
965 'Java: @CompileTimeConstant parameters should be final',
966 'patterns': [r".*: warning: \[NonFinalCompileTimeConstant\] .+"]},
967 {'category': 'java',
968 'severity': severity.HIGH,
969 'members': [],
970 'option': '',
971 'description':
972 'Java: Calling getAnnotation on an annotation that is not retained at runtime.',
973 'patterns': [r".*: warning: \[NonRuntimeAnnotation\] .+"]},
974 {'category': 'java',
975 'severity': severity.HIGH,
976 'members': [],
977 'option': '',
978 'description':
979 'Java: Numeric comparison using reference equality instead of value equality',
980 'patterns': [r".*: warning: \[NumericEquality\] .+"]},
981 {'category': 'java',
982 'severity': severity.HIGH,
983 'members': [],
984 'option': '',
985 'description':
986 'Java: Comparison using reference equality instead of value equality',
987 'patterns': [r".*: warning: \[OptionalEquality\] .+"]},
988 {'category': 'java',
989 'severity': severity.HIGH,
990 'members': [],
991 'option': '',
992 'description':
993 'Java: Varargs doesn\'t agree for overridden method',
994 'patterns': [r".*: warning: \[Overrides\] .+"]},
995 {'category': 'java',
996 'severity': severity.HIGH,
997 'members': [],
998 'option': '',
999 'description':
1000 'Java: Literal passed as first argument to Preconditions.checkNotNull() can never be null',
1001 'patterns': [r".*: warning: \[PreconditionsCheckNotNull\] .+"]},
1002 {'category': 'java',
1003 'severity': severity.HIGH,
1004 'members': [],
1005 'option': '',
1006 'description':
1007 'Java: First argument to `Preconditions.checkNotNull()` is a primitive rather than an object reference',
1008 'patterns': [r".*: warning: \[PreconditionsCheckNotNullPrimitive\] .+"]},
1009 {'category': 'java',
1010 'severity': severity.HIGH,
1011 'members': [],
1012 'option': '',
1013 'description':
1014 'Java: Protobuf fields cannot be null',
1015 'patterns': [r".*: warning: \[ProtoFieldNullComparison\] .+"]},
1016 {'category': 'java',
1017 'severity': severity.HIGH,
1018 'members': [],
1019 'option': '',
1020 'description':
1021 'Java: Comparing protobuf fields of type String using reference equality',
1022 'patterns': [r".*: warning: \[ProtoStringFieldReferenceEquality\] .+"]},
1023 {'category': 'java',
1024 'severity': severity.HIGH,
1025 'members': [],
1026 'option': '',
1027 'description':
1028 'Java: Check for non-whitelisted callers to RestrictedApiChecker.',
1029 'patterns': [r".*: warning: \[RestrictedApiChecker\] .+"]},
1030 {'category': 'java',
1031 'severity': severity.HIGH,
1032 'members': [],
1033 'option': '',
1034 'description':
1035 'Java: Return value of this method must be used',
1036 'patterns': [r".*: warning: \[ReturnValueIgnored\] .+"]},
1037 {'category': 'java',
1038 'severity': severity.HIGH,
1039 'members': [],
1040 'option': '',
1041 'description':
1042 'Java: Variable assigned to itself',
1043 'patterns': [r".*: warning: \[SelfAssignment\] .+"]},
1044 {'category': 'java',
1045 'severity': severity.HIGH,
1046 'members': [],
1047 'option': '',
1048 'description':
1049 'Java: An object is compared to itself',
1050 'patterns': [r".*: warning: \[SelfComparision\] .+"]},
1051 {'category': 'java',
1052 'severity': severity.HIGH,
1053 'members': [],
1054 'option': '',
1055 'description':
1056 'Java: Variable compared to itself',
1057 'patterns': [r".*: warning: \[SelfEquality\] .+"]},
1058 {'category': 'java',
1059 'severity': severity.HIGH,
1060 'members': [],
1061 'option': '',
1062 'description':
1063 'Java: An object is tested for equality to itself',
1064 'patterns': [r".*: warning: \[SelfEquals\] .+"]},
1065 {'category': 'java',
1066 'severity': severity.HIGH,
1067 'members': [],
1068 'option': '',
1069 'description':
1070 'Java: Comparison of a size >= 0 is always true, did you intend to check for non-emptiness?',
1071 'patterns': [r".*: warning: \[SizeGreaterThanOrEqualsZero\] .+"]},
1072 {'category': 'java',
1073 'severity': severity.HIGH,
1074 'members': [],
1075 'option': '',
1076 'description':
1077 'Java: Calling toString on a Stream does not provide useful information',
1078 'patterns': [r".*: warning: \[StreamToString\] .+"]},
1079 {'category': 'java',
1080 'severity': severity.HIGH,
1081 'members': [],
1082 'option': '',
1083 'description':
1084 'Java: StringBuilder does not have a char constructor; this invokes the int constructor.',
1085 'patterns': [r".*: warning: \[StringBuilderInitWithChar\] .+"]},
1086 {'category': 'java',
1087 'severity': severity.HIGH,
1088 'members': [],
1089 'option': '',
1090 'description':
1091 'Java: Suppressing "deprecated" is probably a typo for "deprecation"',
1092 'patterns': [r".*: warning: \[SuppressWarningsDeprecated\] .+"]},
1093 {'category': 'java',
1094 'severity': severity.HIGH,
1095 'members': [],
1096 'option': '',
1097 'description':
1098 'Java: throwIfUnchecked(knownCheckedException) is a no-op.',
1099 'patterns': [r".*: warning: \[ThrowIfUncheckedKnownChecked\] .+"]},
1100 {'category': 'java',
1101 'severity': severity.HIGH,
1102 'members': [],
1103 'option': '',
1104 'description':
1105 'Java: Catching Throwable/Error masks failures from fail() or assert*() in the try block',
1106 'patterns': [r".*: warning: \[TryFailThrowable\] .+"]},
1107 {'category': 'java',
1108 'severity': severity.HIGH,
1109 'members': [],
1110 'option': '',
1111 'description':
1112 'Java: Type parameter used as type qualifier',
1113 'patterns': [r".*: warning: \[TypeParameterQualifier\] .+"]},
1114 {'category': 'java',
1115 'severity': severity.HIGH,
1116 'members': [],
1117 'option': '',
1118 'description':
1119 'Java: Non-generic methods should not be invoked with type arguments',
1120 'patterns': [r".*: warning: \[UnnecessaryTypeArgument\] .+"]},
1121 {'category': 'java',
1122 'severity': severity.HIGH,
1123 'members': [],
1124 'option': '',
1125 'description':
1126 'Java: Instance created but never used',
1127 'patterns': [r".*: warning: \[UnusedAnonymousClass\] .+"]},
1128 {'category': 'java',
1129 'severity': severity.HIGH,
1130 'members': [],
1131 'option': '',
1132 'description':
1133 'Java: Use of wildcard imports is forbidden',
1134 'patterns': [r".*: warning: \[WildcardImport\] .+"]},
1135 {'category': 'java',
1136 'severity': severity.HIGH,
1137 'members': [],
1138 'option': '',
1139 'description':
1140 'Java: Method parameter has wrong package',
1141 'patterns': [r".*: warning: \[ParameterPackage\] .+"]},
1142 {'category': 'java',
1143 'severity': severity.HIGH,
1144 'members': [],
1145 'option': '',
1146 'description':
1147 'Java: Certain resources in `android.R.string` have names that do not match their content',
1148 'patterns': [r".*: warning: \[MislabeledAndroidString\] .+"]},
1149 {'category': 'java',
1150 'severity': severity.HIGH,
1151 'members': [],
1152 'option': '',
1153 'description':
1154 'Java: Return value of android.graphics.Rect.intersect() must be checked',
1155 'patterns': [r".*: warning: \[RectIntersectReturnValueIgnored\] .+"]},
1156 {'category': 'java',
1157 'severity': severity.HIGH,
1158 'members': [],
1159 'option': '',
1160 'description':
1161 'Java: Invalid printf-style format string',
1162 'patterns': [r".*: warning: \[FormatString\] .+"]},
1163 {'category': 'java',
1164 'severity': severity.HIGH,
1165 'members': [],
1166 'option': '',
1167 'description':
1168 'Java: @AssistedInject and @Inject cannot be used on the same constructor.',
1169 'patterns': [r".*: warning: \[AssistedInjectAndInjectOnSameConstructor\] .+"]},
1170 {'category': 'java',
1171 'severity': severity.HIGH,
1172 'members': [],
1173 'option': '',
1174 'description':
1175 'Java: Injected constructors cannot be optional nor have binding annotations',
1176 'patterns': [r".*: warning: \[InjectedConstructorAnnotations\] .+"]},
1177 {'category': 'java',
1178 'severity': severity.HIGH,
1179 'members': [],
1180 'option': '',
1181 'description':
1182 'Java: The target of a scoping annotation must be set to METHOD and/or TYPE.',
1183 'patterns': [r".*: warning: \[InjectInvalidTargetingOnScopingAnnotation\] .+"]},
1184 {'category': 'java',
1185 'severity': severity.HIGH,
1186 'members': [],
1187 'option': '',
1188 'description':
1189 'Java: Abstract methods are not injectable with javax.inject.Inject.',
1190 'patterns': [r".*: warning: \[JavaxInjectOnAbstractMethod\] .+"]},
1191 {'category': 'java',
1192 'severity': severity.HIGH,
1193 'members': [],
1194 'option': '',
1195 'description':
1196 'Java: @javax.inject.Inject cannot be put on a final field.',
1197 'patterns': [r".*: warning: \[JavaxInjectOnFinalField\] .+"]},
1198 {'category': 'java',
1199 'severity': severity.HIGH,
1200 'members': [],
1201 'option': '',
1202 'description':
1203 'Java: A class may not have more than one injectable constructor.',
1204 'patterns': [r".*: warning: \[MoreThanOneInjectableConstructor\] .+"]},
1205 {'category': 'java',
1206 'severity': severity.HIGH,
1207 'members': [],
1208 'option': '',
1209 'description':
1210 'Java: Using more than one qualifier annotation on the same element is not allowed.',
1211 'patterns': [r".*: warning: \[InjectMoreThanOneQualifier\] .+"]},
1212 {'category': 'java',
1213 'severity': severity.HIGH,
1214 'members': [],
1215 'option': '',
1216 'description':
1217 'Java: A class can be annotated with at most one scope annotation',
1218 'patterns': [r".*: warning: \[InjectMoreThanOneScopeAnnotationOnClass\] .+"]},
1219 {'category': 'java',
1220 'severity': severity.HIGH,
1221 'members': [],
1222 'option': '',
1223 'description':
1224 'Java: Annotations cannot be both Qualifiers/BindingAnnotations and Scopes',
1225 'patterns': [r".*: warning: \[OverlappingQualifierAndScopeAnnotation\] .+"]},
1226 {'category': 'java',
1227 'severity': severity.HIGH,
1228 'members': [],
1229 'option': '',
1230 'description':
1231 'Java: Scope annotation on an interface or abstact class is not allowed',
1232 'patterns': [r".*: warning: \[InjectScopeAnnotationOnInterfaceOrAbstractClass\] .+"]},
1233 {'category': 'java',
1234 'severity': severity.HIGH,
1235 'members': [],
1236 'option': '',
1237 'description':
1238 'Java: Scoping and qualifier annotations must have runtime retention.',
1239 'patterns': [r".*: warning: \[InjectScopeOrQualifierAnnotationRetention\] .+"]},
1240 {'category': 'java',
1241 'severity': severity.HIGH,
1242 'members': [],
1243 'option': '',
1244 'description':
1245 'Java: Dagger @Provides methods may not return null unless annotated with @Nullable',
1246 'patterns': [r".*: warning: \[DaggerProvidesNull\] .+"]},
1247 {'category': 'java',
1248 'severity': severity.HIGH,
1249 'members': [],
1250 'option': '',
1251 'description':
1252 'Java: Scope annotation on implementation class of AssistedInject factory is not allowed',
1253 'patterns': [r".*: warning: \[GuiceAssistedInjectScoping\] .+"]},
1254 {'category': 'java',
1255 'severity': severity.HIGH,
1256 'members': [],
1257 'option': '',
1258 'description':
1259 'Java: A constructor cannot have two @Assisted parameters of the same type unless they are disambiguated with named @Assisted annotations. ',
1260 'patterns': [r".*: warning: \[GuiceAssistedParameters\] .+"]},
1261 {'category': 'java',
1262 'severity': severity.HIGH,
1263 'members': [],
1264 'option': '',
1265 'description':
1266 'Java: This method is not annotated with @Inject, but it overrides a method that is annotated with @javax.inject.Inject.',
1267 'patterns': [r".*: warning: \[OverridesJavaxInjectableMethod\] .+"]},
1268 {'category': 'java',
1269 'severity': severity.HIGH,
1270 'members': [],
1271 'option': '',
1272 'description':
1273 'Java: Checks for unguarded accesses to fields and methods with @GuardedBy annotations',
1274 'patterns': [r".*: warning: \[GuardedByChecker\] .+"]},
1275 {'category': 'java',
1276 'severity': severity.HIGH,
1277 'members': [],
1278 'option': '',
1279 'description':
1280 'Java: Invalid @GuardedBy expression',
1281 'patterns': [r".*: warning: \[GuardedByValidator\] .+"]},
1282 {'category': 'java',
1283 'severity': severity.HIGH,
1284 'members': [],
1285 'option': '',
1286 'description':
1287 'Java: Type declaration annotated with @Immutable is not immutable',
1288 'patterns': [r".*: warning: \[Immutable\] .+"]},
1289 {'category': 'java',
1290 'severity': severity.HIGH,
1291 'members': [],
1292 'option': '',
1293 'description':
1294 'Java: This method does not acquire the locks specified by its @LockMethod annotation',
1295 'patterns': [r".*: warning: \[LockMethodChecker\] .+"]},
1296 {'category': 'java',
1297 'severity': severity.HIGH,
1298 'members': [],
1299 'option': '',
1300 'description':
1301 'Java: This method does not acquire the locks specified by its @UnlockMethod annotation',
1302 'patterns': [r".*: warning: \[UnlockMethod\] .+"]},
Ian Rogers32bb9bd2016-05-09 23:19:42 -07001303
Ian Rogers6e520032016-05-13 08:59:00 -07001304 {'category': 'java',
1305 'severity': severity.UNKNOWN,
1306 'members': [],
1307 'option': '',
1308 'description': 'Java: Unclassified/unrecognized warnings',
1309 'patterns': [r".*: warning: \[.+\] .+"]},
Ian Rogers32bb9bd2016-05-09 23:19:42 -07001310
Marco Nelissen594375d2009-07-14 09:04:04 -07001311 { 'category':'aapt', 'severity':severity.MEDIUM, 'members':[], 'option':'',
Marco Nelissen8e201962010-03-10 16:16:02 -08001312 'description':'aapt: No default translation',
1313 'patterns':[r".*: warning: string '.+' has no default translation in .*"] },
1314 { 'category':'aapt', 'severity':severity.MEDIUM, 'members':[], 'option':'',
1315 'description':'aapt: Missing default or required localization',
1316 'patterns':[r".*: warning: \*\*\*\* string '.+' has no default or required localization for '.+' in .+"] },
1317 { 'category':'aapt', 'severity':severity.MEDIUM, 'members':[], 'option':'',
Marco Nelissen594375d2009-07-14 09:04:04 -07001318 'description':'aapt: String marked untranslatable, but translation exists',
1319 'patterns':[r".*: warning: string '.+' in .* marked untranslatable but exists in locale '??_??'"] },
1320 { 'category':'aapt', 'severity':severity.MEDIUM, 'members':[], 'option':'',
1321 'description':'aapt: empty span in string',
1322 'patterns':[r".*: warning: empty '.+' span found in text '.+"] },
1323 { 'category':'C/C++', 'severity':severity.MEDIUM, 'members':[], 'option':'',
1324 'description':'Taking address of temporary',
1325 'patterns':[r".*: warning: taking address of temporary"] },
1326 { 'category':'C/C++', 'severity':severity.MEDIUM, 'members':[], 'option':'',
1327 'description':'Possible broken line continuation',
1328 'patterns':[r".*: warning: backslash and newline separated by space"] },
1329 { 'category':'C/C++', 'severity':severity.MEDIUM, 'members':[], 'option':'-Warray-bounds',
1330 'description':'Array subscript out of bounds',
Marco Nelissen8e201962010-03-10 16:16:02 -08001331 'patterns':[r".*: warning: array subscript is above array bounds",
Chih-Hung Hsiehba0ddcd2016-03-21 11:28:30 -07001332 r".*: warning: Array subscript is undefined",
Marco Nelissen8e201962010-03-10 16:16:02 -08001333 r".*: warning: array subscript is below array bounds"] },
Marco Nelissen594375d2009-07-14 09:04:04 -07001334 { 'category':'C/C++', 'severity':severity.MEDIUM, 'members':[], 'option':'',
Chih-Hung Hsiehba0ddcd2016-03-21 11:28:30 -07001335 'description':'Excess elements in initializer',
1336 'patterns':[r".*: warning: excess elements in .+ initializer"] },
1337 { 'category':'C/C++', 'severity':severity.MEDIUM, 'members':[], 'option':'',
Marco Nelissen594375d2009-07-14 09:04:04 -07001338 'description':'Decimal constant is unsigned only in ISO C90',
1339 'patterns':[r".*: warning: this decimal constant is unsigned only in ISO C90"] },
1340 { 'category':'C/C++', 'severity':severity.MEDIUM, 'members':[], 'option':'-Wmain',
1341 'description':'main is usually a function',
1342 'patterns':[r".*: warning: 'main' is usually a function"] },
1343 { 'category':'C/C++', 'severity':severity.MEDIUM, 'members':[], 'option':'',
1344 'description':'Typedef ignored',
1345 'patterns':[r".*: warning: 'typedef' was ignored in this declaration"] },
1346 { 'category':'C/C++', 'severity':severity.HIGH, 'members':[], 'option':'-Waddress',
1347 'description':'Address always evaluates to true',
1348 'patterns':[r".*: warning: the address of '.+' will always evaluate as 'true'"] },
1349 { 'category':'C/C++', 'severity':severity.FIXMENOW, 'members':[], 'option':'',
1350 'description':'Freeing a non-heap object',
1351 'patterns':[r".*: warning: attempt to free a non-heap object '.+'"] },
1352 { 'category':'C/C++', 'severity':severity.MEDIUM, 'members':[], 'option':'-Wchar-subscripts',
1353 'description':'Array subscript has type char',
Chih-Hung Hsiehf8aaf602016-03-16 12:18:16 -07001354 'patterns':[r".*: warning: array subscript .+ type 'char'.+Wchar-subscripts"] },
Marco Nelissen594375d2009-07-14 09:04:04 -07001355 { 'category':'C/C++', 'severity':severity.MEDIUM, 'members':[], 'option':'',
1356 'description':'Constant too large for type',
1357 'patterns':[r".*: warning: integer constant is too large for '.+' type"] },
1358 { 'category':'C/C++', 'severity':severity.MEDIUM, 'members':[], 'option':'-Woverflow',
1359 'description':'Constant too large for type, truncated',
1360 'patterns':[r".*: warning: large integer implicitly truncated to unsigned type"] },
1361 { 'category':'C/C++', 'severity':severity.MEDIUM, 'members':[], 'option':'-Woverflow',
1362 'description':'Overflow in implicit constant conversion',
1363 'patterns':[r".*: warning: overflow in implicit constant conversion"] },
1364 { 'category':'C/C++', 'severity':severity.MEDIUM, 'members':[], 'option':'',
1365 'description':'Declaration does not declare anything',
1366 'patterns':[r".*: warning: declaration 'class .+' does not declare anything"] },
1367 { 'category':'C/C++', 'severity':severity.MEDIUM, 'members':[], 'option':'-Wreorder',
1368 'description':'Initialization order will be different',
Chih-Hung Hsiehba0ddcd2016-03-21 11:28:30 -07001369 'patterns':[r".*: warning: '.+' will be initialized after",
1370 r".*: warning: field .+ will be initialized after .+Wreorder"] },
Marco Nelissen594375d2009-07-14 09:04:04 -07001371 { 'category':'cont.', 'severity':severity.SKIP, 'members':[], 'option':'',
1372 'description':'',
1373 'patterns':[r".*: warning: '.+'"] },
1374 { 'category':'cont.', 'severity':severity.SKIP, 'members':[], 'option':'',
1375 'description':'',
Marco Nelissen8e201962010-03-10 16:16:02 -08001376 'patterns':[r".*: warning: base '.+'"] },
1377 { 'category':'cont.', 'severity':severity.SKIP, 'members':[], 'option':'',
1378 'description':'',
Marco Nelissen594375d2009-07-14 09:04:04 -07001379 'patterns':[r".*: warning: when initialized here"] },
1380 { 'category':'C/C++', 'severity':severity.MEDIUM, 'members':[], 'option':'-Wmissing-parameter-type',
1381 'description':'Parameter type not specified',
1382 'patterns':[r".*: warning: type of '.+' defaults to 'int'"] },
1383 { 'category':'gcc', 'severity':severity.MEDIUM, 'members':[], 'option':'',
1384 'description':'Invalid option for C file',
1385 'patterns':[r".*: warning: command line option "".+"" is valid for C\+\+\/ObjC\+\+ but not for C"] },
1386 { 'category':'C/C++', 'severity':severity.MEDIUM, 'members':[], 'option':'',
1387 'description':'User warning',
1388 'patterns':[r".*: warning: #warning "".+"""] },
1389 { 'category':'C/C++', 'severity':severity.MEDIUM, 'members':[], 'option':'-Wextra',
1390 'description':'Dereferencing void*',
1391 'patterns':[r".*: warning: dereferencing 'void \*' pointer"] },
1392 { 'category':'C/C++', 'severity':severity.MEDIUM, 'members':[], 'option':'-Wextra',
1393 'description':'Comparison of pointer to zero',
1394 'patterns':[r".*: warning: ordered comparison of pointer with integer zero"] },
1395 { 'category':'C/C++', 'severity':severity.MEDIUM, 'members':[], 'option':'-Wwrite-strings',
1396 'description':'Conversion of string constant to non-const char*',
1397 'patterns':[r".*: warning: deprecated conversion from string constant to '.+'"] },
1398 { 'category':'C/C++', 'severity':severity.MEDIUM, 'members':[], 'option':'-Wstrict-prototypes',
1399 'description':'Function declaration isn''t a prototype',
1400 'patterns':[r".*: warning: function declaration isn't a prototype"] },
1401 { 'category':'C/C++', 'severity':severity.MEDIUM, 'members':[], 'option':'-Wignored-qualifiers',
1402 'description':'Type qualifiers ignored on function return value',
Chih-Hung Hsiehf8aaf602016-03-16 12:18:16 -07001403 'patterns':[r".*: warning: type qualifiers ignored on function return type",
1404 r".*: warning: .+ type qualifier .+ has no effect .+Wignored-qualifiers"] },
Marco Nelissen594375d2009-07-14 09:04:04 -07001405 { 'category':'C/C++', 'severity':severity.MEDIUM, 'members':[], 'option':'',
1406 'description':'<foo> declared inside parameter list, scope limited to this definition',
1407 'patterns':[r".*: warning: '.+' declared inside parameter list"] },
1408 { 'category':'cont.', 'severity':severity.SKIP, 'members':[], 'option':'',
1409 'description':'',
1410 'patterns':[r".*: warning: its scope is only this definition or declaration, which is probably not what you want"] },
1411 { 'category':'C/C++', 'severity':severity.LOW, 'members':[], 'option':'-Wcomment',
1412 'description':'Line continuation inside comment',
1413 'patterns':[r".*: warning: multi-line comment"] },
Marco Nelissen8e201962010-03-10 16:16:02 -08001414 { 'category':'C/C++', 'severity':severity.LOW, 'members':[], 'option':'-Wcomment',
1415 'description':'Comment inside comment',
1416 'patterns':[r".*: warning: "".+"" within comment"] },
Chih-Hung Hsiehf8aaf602016-03-16 12:18:16 -07001417 { 'category':'C/C++', 'severity':severity.LOW, 'members':[], 'option':'',
1418 'description':'Value stored is never read',
1419 'patterns':[r".*: warning: Value stored to .+ is never read"] },
1420 { 'category':'C/C++', 'severity':severity.LOW, 'members':[], 'option':'-Wdeprecated-declarations',
1421 'description':'Deprecated declarations',
1422 'patterns':[r".*: warning: .+ is deprecated.+deprecated-declarations"] },
Chih-Hung Hsieh90d46192016-03-29 15:33:11 -07001423 { 'category':'C/C++', 'severity':severity.LOW, 'members':[], 'option':'-Wdeprecated-register',
1424 'description':'Deprecated register',
1425 'patterns':[r".*: warning: 'register' storage class specifier is deprecated"] },
Chih-Hung Hsiehf8aaf602016-03-16 12:18:16 -07001426 { 'category':'C/C++', 'severity':severity.LOW, 'members':[], 'option':'-Wpointer-sign',
1427 'description':'Converts between pointers to integer types with different sign',
1428 'patterns':[r".*: warning: .+ converts between pointers to integer types with different sign"] },
Marco Nelissen594375d2009-07-14 09:04:04 -07001429 { 'category':'C/C++', 'severity':severity.HARMLESS, 'members':[], 'option':'',
1430 'description':'Extra tokens after #endif',
1431 'patterns':[r".*: warning: extra tokens at end of #endif directive"] },
1432 { 'category':'C/C++', 'severity':severity.MEDIUM, 'members':[], 'option':'-Wenum-compare',
1433 'description':'Comparison between different enums',
Chih-Hung Hsiehf8aaf602016-03-16 12:18:16 -07001434 'patterns':[r".*: warning: comparison between '.+' and '.+'.+Wenum-compare"] },
Marco Nelissen594375d2009-07-14 09:04:04 -07001435 { 'category':'C/C++', 'severity':severity.MEDIUM, 'members':[], 'option':'-Wconversion',
1436 'description':'Implicit conversion of negative number to unsigned type',
1437 'patterns':[r".*: warning: converting negative value '.+' to '.+'"] },
1438 { 'category':'C/C++', 'severity':severity.MEDIUM, 'members':[], 'option':'',
1439 'description':'Passing NULL as non-pointer argument',
Marco Nelissen5236fbd2009-07-31 08:30:34 -07001440 'patterns':[r".*: warning: passing NULL to non-pointer argument [0-9]+ of '.+'"] },
Marco Nelissen594375d2009-07-14 09:04:04 -07001441 { 'category':'C/C++', 'severity':severity.MEDIUM, 'members':[], 'option':'-Wctor-dtor-privacy',
1442 'description':'Class seems unusable because of private ctor/dtor' ,
1443 'patterns':[r".*: warning: all member functions in class '.+' are private"] },
1444 # skip this next one, because it only points out some RefBase-based classes where having a private destructor is perfectly fine
1445 { 'category':'C/C++', 'severity':severity.SKIP, 'members':[], 'option':'-Wctor-dtor-privacy',
1446 'description':'Class seems unusable because of private ctor/dtor' ,
1447 'patterns':[r".*: warning: 'class .+' only defines a private destructor and has no friends"] },
1448 { 'category':'C/C++', 'severity':severity.MEDIUM, 'members':[], 'option':'-Wctor-dtor-privacy',
1449 'description':'Class seems unusable because of private ctor/dtor' ,
1450 'patterns':[r".*: warning: 'class .+' only defines private constructors and has no friends"] },
Chih-Hung Hsiehba0ddcd2016-03-21 11:28:30 -07001451 { 'category':'C/C++', 'severity':severity.MEDIUM, 'members':[], 'option':'-Wgnu-static-float-init',
1452 'description':'In-class initializer for static const float/double' ,
1453 'patterns':[r".*: warning: in-class initializer for static data member of .+const (float|double)"] },
Marco Nelissen594375d2009-07-14 09:04:04 -07001454 { 'category':'C/C++', 'severity':severity.MEDIUM, 'members':[], 'option':'-Wpointer-arith',
1455 'description':'void* used in arithmetic' ,
1456 'patterns':[r".*: warning: pointer of type 'void \*' used in (arithmetic|subtraction)",
Chih-Hung Hsiehf8aaf602016-03-16 12:18:16 -07001457 r".*: warning: arithmetic on .+ to void is a GNU extension.*Wpointer-arith",
Marco Nelissen594375d2009-07-14 09:04:04 -07001458 r".*: warning: wrong type argument to increment"] },
1459 { 'category':'C/C++', 'severity':severity.MEDIUM, 'members':[], 'option':'-Wsign-promo',
1460 'description':'Overload resolution chose to promote from unsigned or enum to signed type' ,
1461 'patterns':[r".*: warning: passing '.+' chooses 'int' over '.* int'"] },
1462 { 'category':'cont.', 'severity':severity.SKIP, 'members':[], 'option':'',
1463 'description':'',
1464 'patterns':[r".*: warning: in call to '.+'"] },
Marco Nelissen5236fbd2009-07-31 08:30:34 -07001465 { 'category':'C/C++', 'severity':severity.HIGH, 'members':[], 'option':'-Wextra',
1466 'description':'Base should be explicitly initialized in copy constructor',
1467 'patterns':[r".*: warning: base class '.+' should be explicitly initialized in the copy constructor"] },
1468 { 'category':'C/C++', 'severity':severity.MEDIUM, 'members':[], 'option':'',
1469 'description':'Converting from <type> to <other type>',
1470 'patterns':[r".*: warning: converting to '.+' from '.+'"] },
Marco Nelissen8e201962010-03-10 16:16:02 -08001471 { 'category':'C/C++', 'severity':severity.MEDIUM, 'members':[], 'option':'',
Chih-Hung Hsiehf8aaf602016-03-16 12:18:16 -07001472 'description':'VLA has zero or negative size',
1473 'patterns':[r".*: warning: Declared variable-length array \(VLA\) has .+ size"] },
1474 { 'category':'C/C++', 'severity':severity.MEDIUM, 'members':[], 'option':'',
Marco Nelissen8e201962010-03-10 16:16:02 -08001475 'description':'Return value from void function',
1476 'patterns':[r".*: warning: 'return' with a value, in function returning void"] },
Chih-Hung Hsiehf8aaf602016-03-16 12:18:16 -07001477 { 'category':'C/C++', 'severity':severity.MEDIUM, 'members':[], 'option':'multichar',
1478 'description':'Multi-character character constant',
1479 'patterns':[r".*: warning: multi-character character constant"] },
Chih-Hung Hsiehba0ddcd2016-03-21 11:28:30 -07001480 { 'category':'C/C++', 'severity':severity.MEDIUM, 'members':[], 'option':'writable-strings',
1481 'description':'Conversion from string literal to char*',
1482 'patterns':[r".*: warning: .+ does not allow conversion from string literal to 'char \*'"] },
Marco Nelissen8e201962010-03-10 16:16:02 -08001483 { 'category':'C/C++', 'severity':severity.LOW, 'members':[], 'option':'',
1484 'description':'Useless specifier',
1485 'patterns':[r".*: warning: useless storage class specifier in empty declaration"] },
Chih-Hung Hsieh90d46192016-03-29 15:33:11 -07001486 { 'category':'C/C++', 'severity':severity.LOW, 'members':[], 'option':'-Wduplicate-decl-specifier',
1487 'description':'Duplicate declaration specifier',
1488 'patterns':[r".*: warning: duplicate '.+' declaration specifier"] },
Marco Nelissen8e201962010-03-10 16:16:02 -08001489 { 'category':'logtags', 'severity':severity.LOW, 'members':[], 'option':'',
1490 'description':'Duplicate logtag',
Chih-Hung Hsieh90d46192016-03-29 15:33:11 -07001491 'patterns':[r".*: warning: tag \".+\" \(.+\) duplicated in .+"] },
Chih-Hung Hsiehf8aaf602016-03-16 12:18:16 -07001492 { 'category':'logtags', 'severity':severity.LOW, 'members':[], 'option':'typedef-redefinition',
1493 'description':'Typedef redefinition',
1494 'patterns':[r".*: warning: redefinition of typedef '.+' is a C11 feature"] },
1495 { 'category':'logtags', 'severity':severity.LOW, 'members':[], 'option':'gnu-designator',
1496 'description':'GNU old-style field designator',
1497 'patterns':[r".*: warning: use of GNU old-style field designator extension"] },
1498 { 'category':'logtags', 'severity':severity.LOW, 'members':[], 'option':'missing-field-initializers',
1499 'description':'Missing field initializers',
1500 'patterns':[r".*: warning: missing field '.+' initializer"] },
1501 { 'category':'logtags', 'severity':severity.LOW, 'members':[], 'option':'missing-braces',
1502 'description':'Missing braces',
1503 'patterns':[r".*: warning: suggest braces around initialization of",
Chih-Hung Hsiehba0ddcd2016-03-21 11:28:30 -07001504 r".*: warning: too many braces around scalar initializer .+Wmany-braces-around-scalar-init",
Chih-Hung Hsiehf8aaf602016-03-16 12:18:16 -07001505 r".*: warning: braces around scalar initializer"] },
1506 { 'category':'logtags', 'severity':severity.LOW, 'members':[], 'option':'sign-compare',
1507 'description':'Comparison of integers of different signs',
1508 'patterns':[r".*: warning: comparison of integers of different signs.+sign-compare"] },
1509 { 'category':'logtags', 'severity':severity.LOW, 'members':[], 'option':'dangling-else',
1510 'description':'Add braces to avoid dangling else',
1511 'patterns':[r".*: warning: add explicit braces to avoid dangling else"] },
1512 { 'category':'logtags', 'severity':severity.LOW, 'members':[], 'option':'initializer-overrides',
1513 'description':'Initializer overrides prior initialization',
1514 'patterns':[r".*: warning: initializer overrides prior initialization of this subobject"] },
1515 { 'category':'logtags', 'severity':severity.LOW, 'members':[], 'option':'self-assign',
1516 'description':'Assigning value to self',
1517 'patterns':[r".*: warning: explicitly assigning value of .+ to itself"] },
1518 { 'category':'logtags', 'severity':severity.LOW, 'members':[], 'option':'gnu-variable-sized-type-not-at-end',
1519 'description':'GNU extension, variable sized type not at end',
1520 'patterns':[r".*: warning: field '.+' with variable sized type '.+' not at the end of a struct or class"] },
1521 { 'category':'logtags', 'severity':severity.LOW, 'members':[], 'option':'tautological-constant-out-of-range-compare',
1522 'description':'Comparison of constant is always false/true',
1523 'patterns':[r".*: comparison of .+ is always .+Wtautological-constant-out-of-range-compare"] },
1524 { 'category':'logtags', 'severity':severity.LOW, 'members':[], 'option':'overloaded-virtual',
1525 'description':'Hides overloaded virtual function',
1526 'patterns':[r".*: '.+' hides overloaded virtual function"] },
1527 { 'category':'logtags', 'severity':severity.LOW, 'members':[], 'option':'incompatible-pointer-types',
1528 'description':'Incompatible pointer types',
1529 'patterns':[r".*: warning: incompatible pointer types .+Wincompatible-pointer-types"] },
1530 { 'category':'logtags', 'severity':severity.LOW, 'members':[], 'option':'asm-operand-widths',
Chih-Hung Hsiehba0ddcd2016-03-21 11:28:30 -07001531 'description':'ASM value size does not match register size',
Chih-Hung Hsiehf8aaf602016-03-16 12:18:16 -07001532 'patterns':[r".*: warning: value size does not match register size specified by the constraint and modifier"] },
Chih-Hung Hsiehba0ddcd2016-03-21 11:28:30 -07001533 { 'category':'C/C++', 'severity':severity.LOW, 'members':[], 'option':'literal-suffix',
Chih-Hung Hsiehf8aaf602016-03-16 12:18:16 -07001534 'description':'Needs a space between literal and string macro',
1535 'patterns':[r".*: warning: invalid suffix on literal.+ requires a space .+Wliteral-suffix"] },
Chih-Hung Hsiehba0ddcd2016-03-21 11:28:30 -07001536 { 'category':'C/C++', 'severity':severity.LOW, 'members':[], 'option':'#warnings',
Chih-Hung Hsiehf8aaf602016-03-16 12:18:16 -07001537 'description':'Warnings from #warning',
1538 'patterns':[r".*: warning: .+-W#warnings"] },
Chih-Hung Hsiehba0ddcd2016-03-21 11:28:30 -07001539 { 'category':'C/C++', 'severity':severity.LOW, 'members':[], 'option':'absolute-value',
1540 'description':'Using float/int absolute value function with int/float argument',
1541 'patterns':[r".*: warning: using .+ absolute value function .+ when argument is .+ type .+Wabsolute-value"] },
1542 { 'category':'C/C++', 'severity':severity.LOW, 'members':[], 'option':'',
1543 'description':'Refers to implicitly defined namespace',
1544 'patterns':[r".*: warning: using directive refers to implicitly-defined namespace .+"] },
Chih-Hung Hsieh90d46192016-03-29 15:33:11 -07001545 { 'category':'C/C++', 'severity':severity.LOW, 'members':[], 'option':'-Winvalid-pp-token',
1546 'description':'Invalid pp token',
1547 'patterns':[r".*: warning: missing .+Winvalid-pp-token"] },
Chih-Hung Hsiehf8aaf602016-03-16 12:18:16 -07001548
Marco Nelissen8e201962010-03-10 16:16:02 -08001549 { 'category':'C/C++', 'severity':severity.MEDIUM, 'members':[], 'option':'',
1550 'description':'Operator new returns NULL',
1551 'patterns':[r".*: warning: 'operator new' must not return NULL unless it is declared 'throw\(\)' .+"] },
1552 { 'category':'C/C++', 'severity':severity.MEDIUM, 'members':[], 'option':'',
1553 'description':'NULL used in arithmetic',
1554 'patterns':[r".*: warning: NULL used in arithmetic"] },
Chih-Hung Hsiehba0ddcd2016-03-21 11:28:30 -07001555 { 'category':'C/C++', 'severity':severity.MEDIUM, 'members':[], 'option':'header-guard',
1556 'description':'Misspelled header guard',
1557 'patterns':[r".*: warning: '.+' is used as a header guard .+ followed by .+ different macro"] },
1558 { 'category':'C/C++', 'severity':severity.MEDIUM, 'members':[], 'option':'empty-body',
1559 'description':'Empty loop body',
1560 'patterns':[r".*: warning: .+ loop has empty body"] },
Chih-Hung Hsiehf8aaf602016-03-16 12:18:16 -07001561 { 'category':'C/C++', 'severity':severity.MEDIUM, 'members':[], 'option':'enum-conversion',
1562 'description':'Implicit conversion from enumeration type',
1563 'patterns':[r".*: warning: implicit conversion from enumeration type '.+'"] },
1564 { 'category':'C/C++', 'severity':severity.MEDIUM, 'members':[], 'option':'switch',
1565 'description':'case value not in enumerated type',
1566 'patterns':[r".*: warning: case value not in enumerated type '.+'"] },
1567 { 'category':'C/C++', 'severity':severity.MEDIUM, 'members':[], 'option':'',
1568 'description':'Undefined result',
1569 'patterns':[r".*: warning: The result of .+ is undefined",
1570 r".*: warning: 'this' pointer cannot be null in well-defined C\+\+ code;",
1571 r".*: warning: shifting a negative signed value is undefined"] },
1572 { 'category':'C/C++', 'severity':severity.MEDIUM, 'members':[], 'option':'',
1573 'description':'Division by zero',
1574 'patterns':[r".*: warning: Division by zero"] },
Marco Nelissen8e201962010-03-10 16:16:02 -08001575 { 'category':'C/C++', 'severity':severity.MEDIUM, 'members':[], 'option':'',
1576 'description':'Use of deprecated method',
1577 'patterns':[r".*: warning: '.+' is deprecated .+"] },
Chih-Hung Hsiehf8aaf602016-03-16 12:18:16 -07001578 { 'category':'C/C++', 'severity':severity.MEDIUM, 'members':[], 'option':'',
1579 'description':'Use of garbage or uninitialized value',
1580 'patterns':[r".*: warning: .+ is a garbage value",
1581 r".*: warning: Function call argument is an uninitialized value",
1582 r".*: warning: Undefined or garbage value returned to caller",
Chih-Hung Hsiehba0ddcd2016-03-21 11:28:30 -07001583 r".*: warning: Called .+ pointer is.+uninitialized",
1584 r".*: warning: Called .+ pointer is.+uninitalized", # match a typo in compiler message
1585 r".*: warning: Use of zero-allocated memory",
Chih-Hung Hsiehf8aaf602016-03-16 12:18:16 -07001586 r".*: warning: Dereference of undefined pointer value",
1587 r".*: warning: Passed-by-value .+ contains uninitialized data",
1588 r".*: warning: Branch condition evaluates to a garbage value",
1589 r".*: warning: The .+ of .+ is an uninitialized value.",
1590 r".*: warning: .+ is used uninitialized whenever .+sometimes-uninitialized",
1591 r".*: warning: Assigned value is garbage or undefined"] },
1592 { 'category':'C/C++', 'severity':severity.MEDIUM, 'members':[], 'option':'',
1593 'description':'Result of malloc type incompatible with sizeof operand type',
1594 'patterns':[r".*: warning: Result of '.+' is converted to .+ incompatible with sizeof operand type"] },
1595 { 'category':'C/C++', 'severity':severity.MEDIUM, 'members':[], 'option':'',
1596 'description':'Return value not checked',
1597 'patterns':[r".*: warning: The return value from .+ is not checked"] },
1598 { 'category':'C/C++', 'severity':severity.MEDIUM, 'members':[], 'option':'',
1599 'description':'Possible heap pollution',
1600 'patterns':[r".*: warning: .*Possible heap pollution from .+ type .+"] },
1601 { 'category':'C/C++', 'severity':severity.MEDIUM, 'members':[], 'option':'',
1602 'description':'Allocation size of 0 byte',
1603 'patterns':[r".*: warning: Call to .+ has an allocation size of 0 byte"] },
1604 { 'category':'C/C++', 'severity':severity.MEDIUM, 'members':[], 'option':'',
1605 'description':'Result of malloc type incompatible with sizeof operand type',
1606 'patterns':[r".*: warning: Result of '.+' is converted to .+ incompatible with sizeof operand type"] },
1607
1608 { 'category':'C/C++', 'severity':severity.HARMLESS, 'members':[], 'option':'',
1609 'description':'Discarded qualifier from pointer target type',
1610 'patterns':[r".*: warning: .+ discards '.+' qualifier from pointer target type"] },
1611 { 'category':'C/C++', 'severity':severity.HARMLESS, 'members':[], 'option':'',
1612 'description':'Use snprintf instead of sprintf',
1613 'patterns':[r".*: warning: .*sprintf is often misused; please use snprintf"] },
1614 { 'category':'C/C++', 'severity':severity.HARMLESS, 'members':[], 'option':'',
1615 'description':'Unsupported optimizaton flag',
1616 'patterns':[r".*: warning: optimization flag '.+' is not supported"] },
1617 { 'category':'C/C++', 'severity':severity.HARMLESS, 'members':[], 'option':'',
1618 'description':'Extra or missing parentheses',
1619 'patterns':[r".*: warning: equality comparison with extraneous parentheses",
1620 r".*: warning: .+ within .+Wlogical-op-parentheses"] },
1621 { 'category':'C/C++', 'severity':severity.HARMLESS, 'members':[], 'option':'mismatched-tags',
1622 'description':'Mismatched class vs struct tags',
1623 'patterns':[r".*: warning: '.+' defined as a .+ here but previously declared as a .+mismatched-tags",
1624 r".*: warning: .+ was previously declared as a .+mismatched-tags"] },
Marco Nelissen594375d2009-07-14 09:04:04 -07001625
1626 # these next ones are to deal with formatting problems resulting from the log being mixed up by 'make -j'
1627 { 'category':'C/C++', 'severity':severity.SKIP, 'members':[], 'option':'',
1628 'description':'',
1629 'patterns':[r".*: warning: ,$"] },
1630 { 'category':'C/C++', 'severity':severity.SKIP, 'members':[], 'option':'',
1631 'description':'',
1632 'patterns':[r".*: warning: $"] },
1633 { 'category':'C/C++', 'severity':severity.SKIP, 'members':[], 'option':'',
1634 'description':'',
1635 'patterns':[r".*: warning: In file included from .+,"] },
1636
Chih-Hung Hsieh90d46192016-03-29 15:33:11 -07001637 # warnings from clang-tidy
1638 { 'category':'C/C++', 'severity':severity.TIDY, 'members':[], 'option':'',
1639 'description':'clang-tidy readability',
1640 'patterns':[r".*: .+\[readability-.+\]$"] },
1641 { 'category':'C/C++', 'severity':severity.TIDY, 'members':[], 'option':'',
1642 'description':'clang-tidy c++ core guidelines',
1643 'patterns':[r".*: .+\[cppcoreguidelines-.+\]$"] },
1644 { 'category':'C/C++', 'severity':severity.TIDY, 'members':[], 'option':'',
1645 'description':'clang-tidy google-runtime',
1646 'patterns':[r".*: .+\[google-runtime-.+\]$"] },
1647 { 'category':'C/C++', 'severity':severity.TIDY, 'members':[], 'option':'',
1648 'description':'clang-tidy google-build',
1649 'patterns':[r".*: .+\[google-build-.+\]$"] },
1650 { 'category':'C/C++', 'severity':severity.TIDY, 'members':[], 'option':'',
1651 'description':'clang-tidy google-explicit',
1652 'patterns':[r".*: .+\[google-explicit-.+\]$"] },
1653 { 'category':'C/C++', 'severity':severity.TIDY, 'members':[], 'option':'',
Chih-Hung Hsiehd742e902016-03-31 16:14:55 -07001654 'description':'clang-tidy google-readability',
1655 'patterns':[r".*: .+\[google-readability-.+\]$"] },
1656 { 'category':'C/C++', 'severity':severity.TIDY, 'members':[], 'option':'',
1657 'description':'clang-tidy google-global',
1658 'patterns':[r".*: .+\[google-global-.+\]$"] },
1659 { 'category':'C/C++', 'severity':severity.TIDY, 'members':[], 'option':'',
Chih-Hung Hsieh90d46192016-03-29 15:33:11 -07001660 'description':'clang-tidy modernize',
1661 'patterns':[r".*: .+\[modernize-.+\]$"] },
1662 { 'category':'C/C++', 'severity':severity.TIDY, 'members':[], 'option':'',
1663 'description':'clang-tidy misc',
1664 'patterns':[r".*: .+\[misc-.+\]$"] },
1665 { 'category':'C/C++', 'severity':severity.TIDY, 'members':[], 'option':'',
1666 'description':'clang-tidy CERT',
1667 'patterns':[r".*: .+\[cert-.+\]$"] },
1668 { 'category':'C/C++', 'severity':severity.TIDY, 'members':[], 'option':'',
1669 'description':'clang-tidy llvm',
1670 'patterns':[r".*: .+\[llvm-.+\]$"] },
1671 { 'category':'C/C++', 'severity':severity.TIDY, 'members':[], 'option':'',
1672 'description':'clang-tidy clang-diagnostic',
1673 'patterns':[r".*: .+\[clang-diagnostic-.+\]$"] },
1674 { 'category':'C/C++', 'severity':severity.TIDY, 'members':[], 'option':'',
1675 'description':'clang-tidy clang-analyzer',
1676 'patterns':[r".*: .+\[clang-analyzer-.+\]$",
1677 r".*: Call Path : .+$"] },
1678
Marco Nelissen594375d2009-07-14 09:04:04 -07001679 # catch-all for warnings this script doesn't know about yet
1680 { 'category':'C/C++', 'severity':severity.UNKNOWN, 'members':[], 'option':'',
1681 'description':'Unclassified/unrecognized warnings',
1682 'patterns':[r".*: warning: .+"] },
1683]
1684
1685anchor = 0
Chih-Hung Hsieh465b6102016-06-22 19:15:12 -07001686cur_row_class = 0
1687
1688html_script_style = """\
1689 <script type="text/javascript">
1690 function expand(id) {
1691 var e = document.getElementById(id);
1692 var f = document.getElementById(id + "_mark");
1693 if (e.style.display == 'block') {
1694 e.style.display = 'none';
1695 f.innerHTML = '&#x2295';
1696 }
1697 else {
1698 e.style.display = 'block';
1699 f.innerHTML = '&#x2296';
1700 }
1701 };
1702 function expand_collapse(show) {
1703 for (var id = 1; ; id++) {
1704 var e = document.getElementById(id + "");
1705 var f = document.getElementById(id + "_mark");
1706 if (!e || !f) break;
1707 e.style.display = (show ? 'block' : 'none');
1708 f.innerHTML = (show ? '&#x2296' : '&#x2295');
1709 }
1710 };
1711 </script>
1712 <style type="text/css">
1713 table,th,td{border-collapse:collapse; width:100%;}
1714 .button{color:blue;font-size:110%;font-weight:bolder;}
1715 .bt{color:black;background-color:transparent;border:none;outline:none;
1716 font-size:140%;font-weight:bolder;}
1717 .c0{background-color:#e0e0e0;}
1718 .c1{background-color:#d0d0d0;}
1719 </style>\n"""
1720
Marco Nelissen594375d2009-07-14 09:04:04 -07001721
1722def output(text):
1723 print text,
1724
1725def htmlbig(param):
1726 return '<font size="+2">' + param + '</font>'
1727
1728def dumphtmlprologue(title):
Chih-Hung Hsieh465b6102016-06-22 19:15:12 -07001729 output('<html>\n<head>\n')
1730 output('<title>' + title + '</title>\n')
1731 output(html_script_style)
1732 output('</head>\n<body>\n')
Chih-Hung Hsieh90d46192016-03-29 15:33:11 -07001733 output('<a name="PageTop">')
Marco Nelissen594375d2009-07-14 09:04:04 -07001734 output(htmlbig(title))
1735 output('<p>\n')
1736
Chih-Hung Hsieh465b6102016-06-22 19:15:12 -07001737def dumphtmlepilogue():
1738 output('</body>\n</head>\n</html>\n')
1739
Marco Nelissen594375d2009-07-14 09:04:04 -07001740def tablerow(text):
Chih-Hung Hsieh465b6102016-06-22 19:15:12 -07001741 global cur_row_class
1742 output('<tr><td class="c' + str(cur_row_class) + '">')
1743 cur_row_class = 1 - cur_row_class
1744 output(text)
1745 output('</td></tr>')
Marco Nelissen594375d2009-07-14 09:04:04 -07001746
1747# dump some stats about total number of warnings and such
1748def dumpstats():
1749 known = 0
1750 unknown = 0
1751 for i in warnpatterns:
Chih-Hung Hsiehba0ddcd2016-03-21 11:28:30 -07001752 i['members'] = sorted(set(i['members']))
Marco Nelissen594375d2009-07-14 09:04:04 -07001753 if i['severity'] == severity.UNKNOWN:
1754 unknown += len(i['members'])
1755 elif i['severity'] != severity.SKIP:
1756 known += len(i['members'])
Chih-Hung Hsieha9be47e2016-03-21 14:11:03 -07001757 output('\nNumber of classified warnings: <b>' + str(known) + '</b><br>' )
1758 output('\nNumber of unclassified warnings: <b>' + str(unknown) + '</b><br>')
Marco Nelissen594375d2009-07-14 09:04:04 -07001759 total = unknown + known
Chih-Hung Hsieha9be47e2016-03-21 14:11:03 -07001760 output('\nTotal number of warnings: <b>' + str(total) + '</b>')
Marco Nelissen594375d2009-07-14 09:04:04 -07001761 if total < 1000:
1762 output('(low count may indicate incremental build)')
Chih-Hung Hsieh465b6102016-06-22 19:15:12 -07001763 output('<br><br>\n')
1764 output('<button class="button" onclick="expand_collapse(1);">' +
1765 'Expand all warnings</button> ' +
1766 '<button class="button" onclick="expand_collapse(0);">' +
1767 'Collapse all warnings</button>')
1768 output('<br>\n')
Chih-Hung Hsieha9be47e2016-03-21 14:11:03 -07001769
Chih-Hung Hsieh465b6102016-06-22 19:15:12 -07001770# dump everything for a given severity
1771def dumpseverity(sev):
1772 global anchor
1773 output('\n<br><span style="background-color:' + colorforseverity(sev) + '"><b>' +
1774 headerforseverity(sev) + ':</b></span>\n')
Chih-Hung Hsieh90d46192016-03-29 15:33:11 -07001775 output('<blockquote>\n')
Chih-Hung Hsieha9be47e2016-03-21 14:11:03 -07001776 for i in warnpatterns:
Chih-Hung Hsieh465b6102016-06-22 19:15:12 -07001777 if i['severity'] == sev and len(i['members']) > 0:
1778 output('\n<table frame="box">\n')
1779 anchor += 1
1780 i['anchor'] = str(anchor)
1781 mark = str(anchor) + '_mark'
1782 output('<tr bgcolor="' + colorforseverity(sev) + '">' +
1783 '<td><button class="bt" id="' + mark +
1784 '" onclick="expand(\'' + str(anchor) + '\');">' +
1785 '&#x2295</button> ' + descriptionfor(i) +
1786 ' (' + str(len(i['members'])) + ')</td></tr>\n')
1787 output('</table>\n')
1788 dumpcategory(i)
1789 output('</blockquote>\n')
Marco Nelissen594375d2009-07-14 09:04:04 -07001790
1791def allpatterns(cat):
1792 pats = ''
1793 for i in cat['patterns']:
1794 pats += i
1795 pats += ' / '
1796 return pats
1797
1798def descriptionfor(cat):
1799 if cat['description'] != '':
1800 return cat['description']
1801 return allpatterns(cat)
1802
1803
1804# show which warnings no longer occur
1805def dumpfixed():
Chih-Hung Hsieh465b6102016-06-22 19:15:12 -07001806 global anchor
1807 anchor += 1
1808 mark = str(anchor) + '_mark'
1809 output('\n<br><p style="background-color:lightblue"><b>' +
1810 '<button id="' + mark + '" ' +
1811 'class="bt" onclick="expand(' + str(anchor) + ');">' +
1812 '&#x2295</button> Fixed warnings. ' +
1813 'No more occurences. Please consider turning these into ' +
1814 'errors if possible, before they are reintroduced in to the build' +
1815 ':</b></p>\n')
1816 output('<blockquote>\n')
1817 fixed_patterns = []
Marco Nelissen594375d2009-07-14 09:04:04 -07001818 for i in warnpatterns:
1819 if len(i['members']) == 0 and i['severity'] != severity.SKIP:
Chih-Hung Hsieh465b6102016-06-22 19:15:12 -07001820 fixed_patterns.append(i['description'] + ' (' +
1821 allpatterns(i) + ') ' + i['option'])
1822 fixed_patterns.sort()
1823 output('<div id="' + str(anchor) + '" style="display:none;"><table>\n')
1824 for i in fixed_patterns:
1825 tablerow(i)
1826 output('</table></div>\n')
1827 output('</blockquote>\n')
Marco Nelissen594375d2009-07-14 09:04:04 -07001828
Ian Rogersf3829732016-05-10 12:06:01 -07001829def warningwithurl(line):
1830 if not args.url:
1831 return line
1832 m = re.search( r'^([^ :]+):(\d+):(.+)', line, re.M|re.I)
1833 if not m:
1834 return line
1835 filepath = m.group(1)
1836 linenumber = m.group(2)
1837 warning = m.group(3)
1838 if args.separator:
1839 return '<a href="' + args.url + '/' + filepath + args.separator + linenumber + '">' + filepath + ':' + linenumber + '</a>:' + warning
1840 else:
1841 return '<a href="' + args.url + '/' + filepath + '">' + filepath + '</a>:' + linenumber + ':' + warning
Marco Nelissen594375d2009-07-14 09:04:04 -07001842
1843# dump a category, provided it is not marked as 'SKIP' and has more than 0 occurrences
1844def dumpcategory(cat):
1845 if cat['severity'] != severity.SKIP and len(cat['members']) != 0:
1846 header = [descriptionfor(cat),str(len(cat['members'])) + ' occurences:']
1847 if cat['option'] != '':
1848 header[1:1] = [' (related option: ' + cat['option'] +')']
Chih-Hung Hsieh465b6102016-06-22 19:15:12 -07001849
1850 output('<div id="' + cat['anchor'] + '" style="display:none;">')
1851 output('<table>\n')
Marco Nelissen594375d2009-07-14 09:04:04 -07001852 for i in cat['members']:
Ian Rogersf3829732016-05-10 12:06:01 -07001853 tablerow(warningwithurl(i))
Chih-Hung Hsieh465b6102016-06-22 19:15:12 -07001854 output('</table></div>\n')
Marco Nelissen594375d2009-07-14 09:04:04 -07001855
1856
1857def classifywarning(line):
1858 for i in warnpatterns:
Marco Nelissen2bdc7ec2009-09-29 10:19:29 -07001859 for cpat in i['compiledpatterns']:
1860 if cpat.match(line):
Marco Nelissen594375d2009-07-14 09:04:04 -07001861 i['members'].append(line)
1862 return
1863 else:
1864 # If we end up here, there was a problem parsing the log
1865 # probably caused by 'make -j' mixing the output from
1866 # 2 or more concurrent compiles
1867 pass
1868
Marco Nelissen2bdc7ec2009-09-29 10:19:29 -07001869# precompiling every pattern speeds up parsing by about 30x
1870def compilepatterns():
1871 for i in warnpatterns:
1872 i['compiledpatterns'] = []
1873 for pat in i['patterns']:
1874 i['compiledpatterns'].append(re.compile(pat))
Marco Nelissen594375d2009-07-14 09:04:04 -07001875
Ian Rogersf3829732016-05-10 12:06:01 -07001876infile = open(args.buildlog, 'r')
Marco Nelissen594375d2009-07-14 09:04:04 -07001877warnings = []
1878
1879platformversion = 'unknown'
1880targetproduct = 'unknown'
1881targetvariant = 'unknown'
1882linecounter = 0
1883
1884warningpattern = re.compile('.* warning:.*')
Marco Nelissen2bdc7ec2009-09-29 10:19:29 -07001885compilepatterns()
Marco Nelissen594375d2009-07-14 09:04:04 -07001886
1887# read the log file and classify all the warnings
1888lastmatchedline = ''
1889for line in infile:
Marco Nelissen8e201962010-03-10 16:16:02 -08001890 # replace fancy quotes with plain ol' quotes
1891 line = line.replace("‘", "'");
1892 line = line.replace("’", "'");
Marco Nelissen594375d2009-07-14 09:04:04 -07001893 if warningpattern.match(line):
1894 if line != lastmatchedline:
1895 classifywarning(line)
1896 lastmatchedline = line
1897 else:
1898 # save a little bit of time by only doing this for the first few lines
1899 if linecounter < 50:
1900 linecounter +=1
1901 m = re.search('(?<=^PLATFORM_VERSION=).*', line)
1902 if m != None:
1903 platformversion = m.group(0)
1904 m = re.search('(?<=^TARGET_PRODUCT=).*', line)
1905 if m != None:
1906 targetproduct = m.group(0)
1907 m = re.search('(?<=^TARGET_BUILD_VARIANT=).*', line)
1908 if m != None:
1909 targetvariant = m.group(0)
1910
1911
1912# dump the html output to stdout
1913dumphtmlprologue('Warnings for ' + platformversion + ' - ' + targetproduct + ' - ' + targetvariant)
1914dumpstats()
Ian Rogers2f4ce822016-05-10 09:34:29 -07001915# sort table based on number of members once dumpstats has deduplicated the
1916# members.
1917warnpatterns.sort(reverse=True, key=lambda i: len(i['members']))
Marco Nelissen594375d2009-07-14 09:04:04 -07001918dumpseverity(severity.FIXMENOW)
1919dumpseverity(severity.HIGH)
1920dumpseverity(severity.MEDIUM)
1921dumpseverity(severity.LOW)
Chih-Hung Hsieh90d46192016-03-29 15:33:11 -07001922dumpseverity(severity.TIDY)
Marco Nelissen594375d2009-07-14 09:04:04 -07001923dumpseverity(severity.HARMLESS)
1924dumpseverity(severity.UNKNOWN)
1925dumpfixed()
Chih-Hung Hsieh465b6102016-06-22 19:15:12 -07001926dumphtmlepilogue()