warn.py revision 121e284b460afc3603b88883563ad3156aa2de4d
1#!/usr/bin/env python
2# This file uses the following encoding: utf-8
3
4import argparse
5import re
6
7parser = argparse.ArgumentParser(description='Convert a build log into HTML')
8parser.add_argument('--gencsv',
9                    help='Generate a CSV file with number of various warnings',
10                    action="store_true",
11                    default=False)
12parser.add_argument('--byproject',
13                    help='Separate warnings in HTML output by project names',
14                    action="store_true",
15                    default=False)
16parser.add_argument('--url',
17                    help='Root URL of an Android source code tree prefixed '
18                    'before files in warnings')
19parser.add_argument('--separator',
20                    help='Separator between the end of a URL and the line '
21                    'number argument. e.g. #')
22parser.add_argument(dest='buildlog', metavar='build.log',
23                    help='Path to build.log file')
24args = parser.parse_args()
25
26# if you add another level, don't forget to give it a color below
27class severity:
28    UNKNOWN = 0
29    FIXMENOW = 1
30    HIGH = 2
31    MEDIUM = 3
32    LOW = 4
33    TIDY = 5
34    HARMLESS = 6
35    SKIP = 100
36    kinds = [FIXMENOW, HIGH, MEDIUM, LOW, TIDY, HARMLESS, UNKNOWN, SKIP]
37
38def colorforseverity(sev):
39    if sev == severity.FIXMENOW:
40        return 'fuchsia'
41    if sev == severity.HIGH:
42        return 'red'
43    if sev == severity.MEDIUM:
44        return 'orange'
45    if sev == severity.LOW:
46        return 'yellow'
47    if sev == severity.TIDY:
48        return 'peachpuff'
49    if sev == severity.HARMLESS:
50        return 'limegreen'
51    if sev == severity.UNKNOWN:
52        return 'lightblue'
53    return 'grey'
54
55def headerforseverity(sev):
56    if sev == severity.FIXMENOW:
57        return 'Critical warnings, fix me now'
58    if sev == severity.HIGH:
59        return 'High severity warnings'
60    if sev == severity.MEDIUM:
61        return 'Medium severity warnings'
62    if sev == severity.LOW:
63        return 'Low severity warnings'
64    if sev == severity.HARMLESS:
65        return 'Harmless warnings'
66    if sev == severity.TIDY:
67        return 'Clang-Tidy warnings'
68    if sev == severity.UNKNOWN:
69        return 'Unknown warnings'
70    return 'Unhandled warnings'
71
72def columnheaderforseverity(sev):
73    if sev == severity.FIXMENOW:
74        return 'FixNow'
75    if sev == severity.HIGH:
76        return 'High'
77    if sev == severity.MEDIUM:
78        return 'Medium'
79    if sev == severity.LOW:
80        return 'Low'
81    if sev == severity.HARMLESS:
82        return 'Harmless'
83    if sev == severity.TIDY:
84        return 'Tidy'
85    if sev == severity.UNKNOWN:
86        return 'Unknown'
87    return 'Unhandled'
88
89warnpatterns = [
90    { 'category':'make',    'severity':severity.MEDIUM,   'members':[], 'option':'',
91        'description':'make: overriding commands/ignoring old commands',
92        'patterns':[r".*: warning: overriding commands for target .+",
93                    r".*: warning: ignoring old commands for target .+"] },
94    { 'category':'make',    'severity':severity.HIGH,     'members':[], 'option':'',
95        'description':'make: LOCAL_CLANG is false',
96        'patterns':[r".*: warning: LOCAL_CLANG is set to false"] },
97    { 'category':'make',    'severity':severity.HIGH,     'members':[], 'option':'',
98        'description':'SDK App using platform shared library',
99        'patterns':[r".*: warning: .+ \(.*app:sdk.*\) should not link to .+ \(native:platform\)"] },
100    { 'category':'make',    'severity':severity.HIGH,     'members':[], 'option':'',
101        'description':'System module linking to a vendor module',
102        'patterns':[r".*: warning: .+ \(.+\) should not link to .+ \(partition:.+\)"] },
103    { 'category':'make',    'severity':severity.MEDIUM,   'members':[], 'option':'',
104        'description':'Invalid SDK/NDK linking',
105        'patterns':[r".*: warning: .+ \(.+\) should not link to .+ \(.+\)"] },
106    { 'category':'C/C++',   'severity':severity.HIGH,     'members':[], 'option':'-Wimplicit-function-declaration',
107        'description':'Implicit function declaration',
108        'patterns':[r".*: warning: implicit declaration of function .+",
109                    r".*: warning: implicitly declaring library function" ] },
110    { 'category':'C/C++',   'severity':severity.SKIP,     'members':[], 'option':'',
111        'description':'',
112        'patterns':[r".*: warning: conflicting types for '.+'"] },
113    { 'category':'C/C++',   'severity':severity.HIGH,     'members':[], 'option':'-Wtype-limits',
114        'description':'Expression always evaluates to true or false',
115        'patterns':[r".*: warning: comparison is always .+ due to limited range of data type",
116                    r".*: warning: comparison of unsigned .*expression .+ is always true",
117                    r".*: warning: comparison of unsigned .*expression .+ is always false"] },
118    { 'category':'C/C++',   'severity':severity.HIGH,     'members':[], 'option':'',
119        'description':'Potential leak of memory, bad free, use after free',
120        'patterns':[r".*: warning: Potential leak of memory",
121                    r".*: warning: Potential memory leak",
122                    r".*: warning: Memory allocated by alloca\(\) should not be deallocated",
123                    r".*: warning: Memory allocated by .+ should be deallocated by .+ not .+",
124                    r".*: warning: 'delete' applied to a pointer that was allocated",
125                    r".*: warning: Use of memory after it is freed",
126                    r".*: warning: Argument to .+ is the address of .+ variable",
127                    r".*: warning: Argument to free\(\) is offset by .+ of memory allocated by",
128                    r".*: warning: Attempt to .+ released memory"] },
129    { 'category':'C/C++',   'severity':severity.HIGH,     'members':[], 'option':'',
130        'description':'Use transient memory for control value',
131        'patterns':[r".*: warning: .+Using such transient memory for the control value is .*dangerous."] },
132    { 'category':'C/C++',   'severity':severity.HIGH,     'members':[], 'option':'',
133        'description':'Return address of stack memory',
134        'patterns':[r".*: warning: Address of stack memory .+ returned to caller",
135                    r".*: warning: Address of stack memory .+ will be a dangling reference"] },
136    { 'category':'C/C++',   'severity':severity.HIGH,     'members':[], 'option':'',
137        'description':'Problem with vfork',
138        'patterns':[r".*: warning: This .+ is prohibited after a successful vfork",
139                    r".*: warning: Call to function '.+' is insecure "] },
140    { 'category':'C/C++',   'severity':severity.HIGH,     'members':[], 'option':'infinite-recursion',
141        'description':'Infinite recursion',
142        'patterns':[r".*: warning: all paths through this function will call itself"] },
143    { 'category':'C/C++',   'severity':severity.HIGH,     'members':[], 'option':'',
144        'description':'Potential buffer overflow',
145        'patterns':[r".*: warning: Size argument is greater than .+ the destination buffer",
146                    r".*: warning: Potential buffer overflow.",
147                    r".*: warning: String copy function overflows destination buffer"] },
148    { 'category':'C/C++',   'severity':severity.MEDIUM,   'members':[], 'option':'',
149        'description':'Incompatible pointer types',
150        'patterns':[r".*: warning: assignment from incompatible pointer type",
151                    r".*: warning: return from incompatible pointer type",
152                    r".*: warning: passing argument [0-9]+ of '.*' from incompatible pointer type",
153                    r".*: warning: initialization from incompatible pointer type"] },
154    { 'category':'C/C++',   'severity':severity.HIGH,     'members':[], 'option':'-fno-builtin',
155        'description':'Incompatible declaration of built in function',
156        'patterns':[r".*: warning: incompatible implicit declaration of built-in function .+"] },
157    { 'category':'C/C++',   'severity':severity.HIGH,     'members':[], 'option':'-Wincompatible-library-redeclaration',
158        'description':'Incompatible redeclaration of library function',
159        'patterns':[r".*: warning: incompatible redeclaration of library function .+"] },
160    { 'category':'C/C++',   'severity':severity.HIGH,     'members':[], 'option':'',
161        'description':'Null passed as non-null argument',
162        'patterns':[r".*: warning: Null passed to a callee that requires a non-null"] },
163    { 'category':'C/C++',   'severity':severity.MEDIUM,   'members':[], 'option':'-Wunused-parameter',
164        'description':'Unused parameter',
165        'patterns':[r".*: warning: unused parameter '.*'"] },
166    { 'category':'C/C++',   'severity':severity.MEDIUM,   'members':[], 'option':'-Wunused',
167        'description':'Unused function, variable or label',
168        'patterns':[r".*: warning: '.+' defined but not used",
169                    r".*: warning: unused function '.+'",
170                    r".*: warning: private field '.+' is not used",
171                    r".*: warning: unused variable '.+'"] },
172    { 'category':'C/C++',   'severity':severity.MEDIUM,   'members':[], 'option':'-Wunused-value',
173        'description':'Statement with no effect or result unused',
174        'patterns':[r".*: warning: statement with no effect",
175                    r".*: warning: expression result unused"] },
176    { 'category':'C/C++',   'severity':severity.MEDIUM,   'members':[], 'option':'-Wunused-result',
177        'description':'Ignoreing return value of function',
178        'patterns':[r".*: warning: ignoring return value of function .+Wunused-result"] },
179    { 'category':'C/C++',   'severity':severity.MEDIUM,   'members':[], 'option':'-Wmissing-field-initializers',
180        'description':'Missing initializer',
181        'patterns':[r".*: warning: missing initializer"] },
182    { 'category':'C/C++',   'severity':severity.MEDIUM,   'members':[], 'option':'-Wdelete-non-virtual-dtor',
183        'description':'Need virtual destructor',
184        'patterns':[r".*: warning: delete called .* has virtual functions but non-virtual destructor"] },
185    { 'category':'cont.',   'severity':severity.SKIP,     'members':[], 'option':'',
186        'description':'',
187        'patterns':[r".*: warning: \(near initialization for '.+'\)"] },
188    { 'category':'C/C++',   'severity':severity.MEDIUM,     'members':[], 'option':'-Wdate-time',
189        'description':'Expansion of data or time macro',
190        'patterns':[r".*: warning: expansion of date or time macro is not reproducible"] },
191    { 'category':'C/C++',   'severity':severity.MEDIUM,   'members':[], 'option':'-Wformat',
192        'description':'Format string does not match arguments',
193        'patterns':[r".*: warning: format '.+' expects type '.+', but argument [0-9]+ has type '.+'",
194                    r".*: warning: more '%' conversions than data arguments",
195                    r".*: warning: data argument not used by format string",
196                    r".*: warning: incomplete format specifier",
197                    r".*: warning: unknown conversion type .* in format",
198                    r".*: warning: format .+ expects .+ but argument .+Wformat=",
199                    r".*: warning: field precision should have .+ but argument has .+Wformat",
200                    r".*: warning: format specifies type .+ but the argument has .*type .+Wformat"] },
201    { 'category':'C/C++',   'severity':severity.MEDIUM,   'members':[], 'option':'-Wformat-extra-args',
202        'description':'Too many arguments for format string',
203        'patterns':[r".*: warning: too many arguments for format"] },
204    { 'category':'C/C++',   'severity':severity.MEDIUM,   'members':[], 'option':'-Wformat-invalid-specifier',
205        'description':'Invalid format specifier',
206        'patterns':[r".*: warning: invalid .+ specifier '.+'.+format-invalid-specifier"] },
207    { 'category':'C/C++',   'severity':severity.MEDIUM,   'members':[], 'option':'-Wsign-compare',
208        'description':'Comparison between signed and unsigned',
209        'patterns':[r".*: warning: comparison between signed and unsigned",
210                    r".*: warning: comparison of promoted \~unsigned with unsigned",
211                    r".*: warning: signed and unsigned type in conditional expression"] },
212    { 'category':'C/C++',   'severity':severity.MEDIUM,   'members':[], 'option':'',
213        'description':'Comparison between enum and non-enum',
214        'patterns':[r".*: warning: enumeral and non-enumeral type in conditional expression"] },
215    { 'category':'libpng',  'severity':severity.MEDIUM,   'members':[], 'option':'',
216        'description':'libpng: zero area',
217        'patterns':[r".*libpng warning: Ignoring attempt to set cHRM RGB triangle with zero area"] },
218    { 'category':'aapt',    'severity':severity.MEDIUM,   'members':[], 'option':'',
219        'description':'aapt: no comment for public symbol',
220        'patterns':[r".*: warning: No comment for public symbol .+"] },
221    { 'category':'C/C++',   'severity':severity.MEDIUM,   'members':[], 'option':'-Wmissing-braces',
222        'description':'Missing braces around initializer',
223        'patterns':[r".*: warning: missing braces around initializer.*"] },
224    { 'category':'C/C++',   'severity':severity.HARMLESS, 'members':[], 'option':'',
225        'description':'No newline at end of file',
226        'patterns':[r".*: warning: no newline at end of file"] },
227    { 'category':'C/C++',   'severity':severity.HARMLESS, 'members':[], 'option':'',
228        'description':'Missing space after macro name',
229        'patterns':[r".*: warning: missing whitespace after the macro name"] },
230    { 'category':'C/C++',   'severity':severity.LOW, 'members':[], 'option':'-Wcast-align',
231        'description':'Cast increases required alignment',
232        'patterns':[r".*: warning: cast from .* to .* increases required alignment .*"] },
233    { 'category':'C/C++',   'severity':severity.MEDIUM,   'members':[], 'option':'-Wcast-qual',
234        'description':'Qualifier discarded',
235        'patterns':[r".*: warning: passing argument [0-9]+ of '.+' discards qualifiers from pointer target type",
236                    r".*: warning: assignment discards qualifiers from pointer target type",
237                    r".*: warning: passing .+ to parameter of type .+ discards qualifiers",
238                    r".*: warning: assigning to .+ from .+ discards qualifiers",
239                    r".*: warning: initializing .+ discards qualifiers .+types-discards-qualifiers",
240                    r".*: warning: return discards qualifiers from pointer target type"] },
241    { 'category':'C/C++',   'severity':severity.MEDIUM,   'members':[], 'option':'-Wunknown-attributes',
242        'description':'Unknown attribute',
243        'patterns':[r".*: warning: unknown attribute '.+'"] },
244    { 'category':'C/C++',   'severity':severity.MEDIUM,   'members':[], 'option':'-Wignored-attributes',
245        'description':'Attribute ignored',
246        'patterns':[r".*: warning: '_*packed_*' attribute ignored",
247                    r".*: warning: attribute declaration must precede definition .+ignored-attributes"] },
248    { 'category':'C/C++',   'severity':severity.MEDIUM,   'members':[], 'option':'-Wvisibility',
249        'description':'Visibility problem',
250        'patterns':[r".*: warning: declaration of '.+' will not be visible outside of this function"] },
251    { 'category':'C/C++',   'severity':severity.MEDIUM,   'members':[], 'option':'-Wattributes',
252        'description':'Visibility mismatch',
253        'patterns':[r".*: warning: '.+' declared with greater visibility than the type of its field '.+'"] },
254    { 'category':'C/C++',   'severity':severity.MEDIUM,   'members':[], 'option':'',
255        'description':'Shift count greater than width of type',
256        'patterns':[r".*: warning: (left|right) shift count >= width of type"] },
257    { 'category':'C/C++',   'severity':severity.MEDIUM,   'members':[], 'option':'-Wextern-initializer',
258        'description':'extern <foo> is initialized',
259        'patterns':[r".*: warning: '.+' initialized and declared 'extern'",
260                    r".*: warning: 'extern' variable has an initializer"] },
261    { 'category':'C/C++',   'severity':severity.MEDIUM,   'members':[], 'option':'-Wold-style-declaration',
262        'description':'Old style declaration',
263        'patterns':[r".*: warning: 'static' is not at beginning of declaration"] },
264    { 'category':'C/C++',   'severity':severity.MEDIUM,   'members':[], 'option':'-Wreturn-type',
265        'description':'Missing return value',
266        'patterns':[r".*: warning: control reaches end of non-void function"] },
267    { 'category':'C/C++',   'severity':severity.MEDIUM,   'members':[], 'option':'-Wimplicit-int',
268        'description':'Implicit int type',
269        'patterns':[r".*: warning: type specifier missing, defaults to 'int'",
270                    r".*: warning: type defaults to 'int' in declaration of '.+'"] },
271    { 'category':'C/C++',   'severity':severity.MEDIUM,   'members':[], 'option':'-Wmain-return-type',
272        'description':'Main function should return int',
273        'patterns':[r".*: warning: return type of 'main' is not 'int'"] },
274    { 'category':'C/C++',   'severity':severity.MEDIUM,   'members':[], 'option':'-Wuninitialized',
275        'description':'Variable may be used uninitialized',
276        'patterns':[r".*: warning: '.+' may be used uninitialized in this function"] },
277    { 'category':'C/C++',   'severity':severity.HIGH,     'members':[], 'option':'-Wuninitialized',
278        'description':'Variable is used uninitialized',
279        'patterns':[r".*: warning: '.+' is used uninitialized in this function",
280                    r".*: warning: variable '.+' is uninitialized when used here"] },
281    { 'category':'ld',      'severity':severity.MEDIUM,   'members':[], 'option':'-fshort-enums',
282        'description':'ld: possible enum size mismatch',
283        'patterns':[r".*: warning: .* uses variable-size enums yet the output is to use 32-bit enums; use of enum values across objects may fail"] },
284    { 'category':'C/C++',   'severity':severity.MEDIUM,   'members':[], 'option':'-Wpointer-sign',
285        'description':'Pointer targets differ in signedness',
286        'patterns':[r".*: warning: pointer targets in initialization differ in signedness",
287                    r".*: warning: pointer targets in assignment differ in signedness",
288                    r".*: warning: pointer targets in return differ in signedness",
289                    r".*: warning: pointer targets in passing argument [0-9]+ of '.+' differ in signedness"] },
290    { 'category':'C/C++',   'severity':severity.MEDIUM,   'members':[], 'option':'-Wstrict-overflow',
291        'description':'Assuming overflow does not occur',
292        'patterns':[r".*: warning: assuming signed overflow does not occur when assuming that .* is always (true|false)"] },
293    { 'category':'C/C++',   'severity':severity.MEDIUM,   'members':[], 'option':'-Wempty-body',
294        'description':'Suggest adding braces around empty body',
295        'patterns':[r".*: warning: suggest braces around empty body in an 'if' statement",
296                    r".*: warning: empty body in an if-statement",
297                    r".*: warning: suggest braces around empty body in an 'else' statement",
298                    r".*: warning: empty body in an else-statement"] },
299    { 'category':'C/C++',   'severity':severity.MEDIUM,   'members':[], 'option':'-Wparentheses',
300        'description':'Suggest adding parentheses',
301        'patterns':[r".*: warning: suggest explicit braces to avoid ambiguous 'else'",
302                    r".*: warning: suggest parentheses around arithmetic in operand of '.+'",
303                    r".*: warning: suggest parentheses around comparison in operand of '.+'",
304                    r".*: warning: logical not is only applied to the left hand side of this comparison",
305                    r".*: warning: using the result of an assignment as a condition without parentheses",
306                    r".*: warning: .+ has lower precedence than .+ be evaluated first .+Wparentheses",
307                    r".*: warning: suggest parentheses around '.+?' .+ '.+?'",
308                    r".*: warning: suggest parentheses around assignment used as truth value"] },
309    { 'category':'C/C++',   'severity':severity.MEDIUM,   'members':[], 'option':'',
310        'description':'Static variable used in non-static inline function',
311        'patterns':[r".*: warning: '.+' is static but used in inline function '.+' which is not static"] },
312    { 'category':'C/C++',   'severity':severity.MEDIUM,   'members':[], 'option':'-Wimplicit int',
313        'description':'No type or storage class (will default to int)',
314        'patterns':[r".*: warning: data definition has no type or storage class"] },
315    { 'category':'C/C++',   'severity':severity.MEDIUM,   'members':[], 'option':'',
316        'description':'Null pointer',
317        'patterns':[r".*: warning: Dereference of null pointer",
318                    r".*: warning: Called .+ pointer is null",
319                    r".*: warning: Forming reference to null pointer",
320                    r".*: warning: Returning null reference",
321                    r".*: warning: Null pointer passed as an argument to a 'nonnull' parameter",
322                    r".*: warning: .+ results in a null pointer dereference",
323                    r".*: warning: Access to .+ results in a dereference of a null pointer",
324                    r".*: warning: Null pointer argument in"] },
325    { 'category':'cont.',   'severity':severity.SKIP,     'members':[], 'option':'',
326        'description':'',
327        'patterns':[r".*: warning: parameter names \(without types\) in function declaration"] },
328    { 'category':'C/C++',   'severity':severity.MEDIUM,   'members':[], 'option':'-Wstrict-aliasing',
329        'description':'Dereferencing <foo> breaks strict aliasing rules',
330        'patterns':[r".*: warning: dereferencing .* break strict-aliasing rules"] },
331    { 'category':'C/C++',   'severity':severity.MEDIUM,   'members':[], 'option':'-Wpointer-to-int-cast',
332        'description':'Cast from pointer to integer of different size',
333        'patterns':[r".*: warning: cast from pointer to integer of different size",
334                    r".*: warning: initialization makes pointer from integer without a cast"] } ,
335    { 'category':'C/C++',   'severity':severity.MEDIUM,   'members':[], 'option':'-Wint-to-pointer-cast',
336        'description':'Cast to pointer from integer of different size',
337        'patterns':[r".*: warning: cast to pointer from integer of different size"] },
338    { 'category':'C/C++',   'severity':severity.MEDIUM,   'members':[], 'option':'',
339        'description':'Symbol redefined',
340        'patterns':[r".*: warning: "".+"" redefined"] },
341    { 'category':'cont.',   'severity':severity.SKIP,     'members':[], 'option':'',
342        'description':'',
343        'patterns':[r".*: warning: this is the location of the previous definition"] },
344    { 'category':'ld',      'severity':severity.MEDIUM,   'members':[], 'option':'',
345        'description':'ld: type and size of dynamic symbol are not defined',
346        'patterns':[r".*: warning: type and size of dynamic symbol `.+' are not defined"] },
347    { 'category':'C/C++',   'severity':severity.MEDIUM,   'members':[], 'option':'',
348        'description':'Pointer from integer without cast',
349        'patterns':[r".*: warning: assignment makes pointer from integer without a cast"] },
350    { 'category':'C/C++',   'severity':severity.MEDIUM,   'members':[], 'option':'',
351        'description':'Pointer from integer without cast',
352        'patterns':[r".*: warning: passing argument [0-9]+ of '.+' makes pointer from integer without a cast"] },
353    { 'category':'C/C++',   'severity':severity.MEDIUM,   'members':[], 'option':'',
354        'description':'Integer from pointer without cast',
355        'patterns':[r".*: warning: assignment makes integer from pointer without a cast"] },
356    { 'category':'C/C++',   'severity':severity.MEDIUM,   'members':[], 'option':'',
357        'description':'Integer from pointer without cast',
358        'patterns':[r".*: warning: passing argument [0-9]+ of '.+' makes integer from pointer without a cast"] },
359    { 'category':'C/C++',   'severity':severity.MEDIUM,   'members':[], 'option':'',
360        'description':'Integer from pointer without cast',
361        'patterns':[r".*: warning: return makes integer from pointer without a cast"] },
362    { 'category':'C/C++',   'severity':severity.MEDIUM,   'members':[], 'option':'-Wunknown-pragmas',
363        'description':'Ignoring pragma',
364        'patterns':[r".*: warning: ignoring #pragma .+"] },
365    { 'category':'C/C++',   'severity':severity.MEDIUM,   'members':[], 'option':'-Wclobbered',
366        'description':'Variable might be clobbered by longjmp or vfork',
367        'patterns':[r".*: warning: variable '.+' might be clobbered by 'longjmp' or 'vfork'"] },
368    { 'category':'C/C++',   'severity':severity.MEDIUM,   'members':[], 'option':'-Wclobbered',
369        'description':'Argument might be clobbered by longjmp or vfork',
370        'patterns':[r".*: warning: argument '.+' might be clobbered by 'longjmp' or 'vfork'"] },
371    { 'category':'C/C++',   'severity':severity.MEDIUM,   'members':[], 'option':'-Wredundant-decls',
372        'description':'Redundant declaration',
373        'patterns':[r".*: warning: redundant redeclaration of '.+'"] },
374    { 'category':'cont.',   'severity':severity.SKIP,     'members':[], 'option':'',
375        'description':'',
376        'patterns':[r".*: warning: previous declaration of '.+' was here"] },
377    { 'category':'C/C++',   'severity':severity.MEDIUM,   'members':[], 'option':'-Wswitch-enum',
378        'description':'Enum value not handled in switch',
379        'patterns':[r".*: warning: .*enumeration value.* not handled in switch.+Wswitch"] },
380    { 'category':'java',    'severity':severity.MEDIUM,   'members':[], 'option':'-encoding',
381        'description':'Java: Non-ascii characters used, but ascii encoding specified',
382        'patterns':[r".*: warning: unmappable character for encoding ascii"] },
383    { 'category':'java',    'severity':severity.MEDIUM,   'members':[], 'option':'',
384        'description':'Java: Non-varargs call of varargs method with inexact argument type for last parameter',
385        'patterns':[r".*: warning: non-varargs call of varargs method with inexact argument type for last parameter"] },
386    { 'category':'java',    'severity':severity.MEDIUM,   'members':[], 'option':'',
387        'description':'Java: Unchecked method invocation',
388        'patterns':[r".*: warning: \[unchecked\] unchecked method invocation: .+ in class .+"] },
389    { 'category':'java',    'severity':severity.MEDIUM,   'members':[], 'option':'',
390        'description':'Java: Unchecked conversion',
391        'patterns':[r".*: warning: \[unchecked\] unchecked conversion"] },
392    { 'category':'java',   'severity':severity.MEDIUM,     'members':[], 'option':'',
393        'description':'_ used as an identifier',
394        'patterns':[r".*: warning: '_' used as an identifier"] },
395
396    # Warnings from Error Prone.
397    {'category': 'java',
398     'severity': severity.MEDIUM,
399     'members': [],
400     'option': '',
401     'description': 'Java: Use of deprecated member',
402     'patterns': [r'.*: warning: \[deprecation\] .+']},
403    {'category': 'java',
404     'severity': severity.MEDIUM,
405     'members': [],
406     'option': '',
407     'description': 'Java: Unchecked conversion',
408     'patterns': [r'.*: warning: \[unchecked\] .+']},
409
410    # Warnings from Error Prone (auto generated list).
411    {'category': 'java',
412     'severity': severity.LOW,
413     'members': [],
414     'option': '',
415     'description':
416         'Java: Deprecated item is not annotated with @Deprecated',
417     'patterns': [r".*: warning: \[DepAnn\] .+"]},
418    {'category': 'java',
419     'severity': severity.LOW,
420     'members': [],
421     'option': '',
422     'description':
423         'Java: Fallthrough warning suppression has no effect if warning is suppressed',
424     'patterns': [r".*: warning: \[FallthroughSuppression\] .+"]},
425    {'category': 'java',
426     'severity': severity.LOW,
427     'members': [],
428     'option': '',
429     'description':
430         'Java: Prefer \'L\' to \'l\' for the suffix to long literals',
431     'patterns': [r".*: warning: \[LongLiteralLowerCaseSuffix\] .+"]},
432    {'category': 'java',
433     'severity': severity.LOW,
434     'members': [],
435     'option': '',
436     'description':
437         'Java: @Binds is a more efficient and declaritive mechanism for delegating a binding.',
438     'patterns': [r".*: warning: \[UseBinds\] .+"]},
439    {'category': 'java',
440     'severity': severity.MEDIUM,
441     'members': [],
442     'option': '',
443     'description':
444         'Java: Assertions may be disabled at runtime and do not guarantee that execution will halt here; consider throwing an exception instead',
445     'patterns': [r".*: warning: \[AssertFalse\] .+"]},
446    {'category': 'java',
447     'severity': severity.MEDIUM,
448     'members': [],
449     'option': '',
450     'description':
451         'Java: Classes that implement Annotation must override equals and hashCode. Consider using AutoAnnotation instead of implementing Annotation by hand.',
452     'patterns': [r".*: warning: \[BadAnnotationImplementation\] .+"]},
453    {'category': 'java',
454     'severity': severity.MEDIUM,
455     'members': [],
456     'option': '',
457     'description':
458         'Java: BigDecimal(double) and BigDecimal.valueOf(double) may lose precision, prefer BigDecimal(String) or BigDecimal(long)',
459     'patterns': [r".*: warning: \[BigDecimalLiteralDouble\] .+"]},
460    {'category': 'java',
461     'severity': severity.MEDIUM,
462     'members': [],
463     'option': '',
464     'description':
465         'Java: Mockito cannot mock final classes',
466     'patterns': [r".*: warning: \[CannotMockFinalClass\] .+"]},
467    {'category': 'java',
468     'severity': severity.MEDIUM,
469     'members': [],
470     'option': '',
471     'description':
472         'Java: This code, which counts elements using a loop, can be replaced by a simpler library method',
473     'patterns': [r".*: warning: \[ElementsCountedInLoop\] .+"]},
474    {'category': 'java',
475     'severity': severity.MEDIUM,
476     'members': [],
477     'option': '',
478     'description':
479         'Java: Empty top-level type declaration',
480     'patterns': [r".*: warning: \[EmptyTopLevelDeclaration\] .+"]},
481    {'category': 'java',
482     'severity': severity.MEDIUM,
483     'members': [],
484     'option': '',
485     'description':
486         'Java: Classes that override equals should also override hashCode.',
487     'patterns': [r".*: warning: \[EqualsHashCode\] .+"]},
488    {'category': 'java',
489     'severity': severity.MEDIUM,
490     'members': [],
491     'option': '',
492     'description':
493         'Java: An equality test between objects with incompatible types always returns false',
494     'patterns': [r".*: warning: \[EqualsIncompatibleType\] .+"]},
495    {'category': 'java',
496     'severity': severity.MEDIUM,
497     'members': [],
498     'option': '',
499     'description':
500         '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.',
501     'patterns': [r".*: warning: \[Finally\] .+"]},
502    {'category': 'java',
503     'severity': severity.MEDIUM,
504     'members': [],
505     'option': '',
506     'description':
507         'Java: This annotation has incompatible modifiers as specified by its @IncompatibleModifiers annotation',
508     'patterns': [r".*: warning: \[IncompatibleModifiers\] .+"]},
509    {'category': 'java',
510     'severity': severity.MEDIUM,
511     'members': [],
512     'option': '',
513     'description':
514         'Java: Class should not implement both `Iterable` and `Iterator`',
515     'patterns': [r".*: warning: \[IterableAndIterator\] .+"]},
516    {'category': 'java',
517     'severity': severity.MEDIUM,
518     'members': [],
519     'option': '',
520     'description':
521         'Java: Floating-point comparison without error tolerance',
522     'patterns': [r".*: warning: \[JUnit3FloatingPointComparisonWithoutDelta\] .+"]},
523    {'category': 'java',
524     'severity': severity.MEDIUM,
525     'members': [],
526     'option': '',
527     'description':
528         'Java: Test class inherits from JUnit 3\'s TestCase but has JUnit 4 @Test annotations.',
529     'patterns': [r".*: warning: \[JUnitAmbiguousTestClass\] .+"]},
530    {'category': 'java',
531     'severity': severity.MEDIUM,
532     'members': [],
533     'option': '',
534     'description':
535         'Java: Enum switch statement is missing cases',
536     'patterns': [r".*: warning: \[MissingCasesInEnumSwitch\] .+"]},
537    {'category': 'java',
538     'severity': severity.MEDIUM,
539     'members': [],
540     'option': '',
541     'description':
542         'Java: Not calling fail() when expecting an exception masks bugs',
543     'patterns': [r".*: warning: \[MissingFail\] .+"]},
544    {'category': 'java',
545     'severity': severity.MEDIUM,
546     'members': [],
547     'option': '',
548     'description':
549         'Java: method overrides method in supertype; expected @Override',
550     'patterns': [r".*: warning: \[MissingOverride\] .+"]},
551    {'category': 'java',
552     'severity': severity.MEDIUM,
553     'members': [],
554     'option': '',
555     'description':
556         'Java: Source files should not contain multiple top-level class declarations',
557     'patterns': [r".*: warning: \[MultipleTopLevelClasses\] .+"]},
558    {'category': 'java',
559     'severity': severity.MEDIUM,
560     'members': [],
561     'option': '',
562     'description':
563         'Java: This update of a volatile variable is non-atomic',
564     'patterns': [r".*: warning: \[NonAtomicVolatileUpdate\] .+"]},
565    {'category': 'java',
566     'severity': severity.MEDIUM,
567     'members': [],
568     'option': '',
569     'description':
570         'Java: Static import of member uses non-canonical name',
571     'patterns': [r".*: warning: \[NonCanonicalStaticMemberImport\] .+"]},
572    {'category': 'java',
573     'severity': severity.MEDIUM,
574     'members': [],
575     'option': '',
576     'description':
577         'Java: equals method doesn\'t override Object.equals',
578     'patterns': [r".*: warning: \[NonOverridingEquals\] .+"]},
579    {'category': 'java',
580     'severity': severity.MEDIUM,
581     'members': [],
582     'option': '',
583     'description':
584         'Java: Constructors should not be annotated with @Nullable since they cannot return null',
585     'patterns': [r".*: warning: \[NullableConstructor\] .+"]},
586    {'category': 'java',
587     'severity': severity.MEDIUM,
588     'members': [],
589     'option': '',
590     'description':
591         'Java: @Nullable should not be used for primitive types since they cannot be null',
592     'patterns': [r".*: warning: \[NullablePrimitive\] .+"]},
593    {'category': 'java',
594     'severity': severity.MEDIUM,
595     'members': [],
596     'option': '',
597     'description':
598         'Java: void-returning methods should not be annotated with @Nullable, since they cannot return null',
599     'patterns': [r".*: warning: \[NullableVoid\] .+"]},
600    {'category': 'java',
601     'severity': severity.MEDIUM,
602     'members': [],
603     'option': '',
604     'description':
605         'Java: Package names should match the directory they are declared in',
606     'patterns': [r".*: warning: \[PackageLocation\] .+"]},
607    {'category': 'java',
608     'severity': severity.MEDIUM,
609     'members': [],
610     'option': '',
611     'description':
612         'Java: Second argument to Preconditions.* is a call to String.format(), which can be unwrapped',
613     'patterns': [r".*: warning: \[PreconditionsErrorMessageEagerEvaluation\] .+"]},
614    {'category': 'java',
615     'severity': severity.MEDIUM,
616     'members': [],
617     'option': '',
618     'description':
619         'Java: Preconditions only accepts the %s placeholder in error message strings',
620     'patterns': [r".*: warning: \[PreconditionsInvalidPlaceholder\] .+"]},
621    {'category': 'java',
622     'severity': severity.MEDIUM,
623     'members': [],
624     'option': '',
625     'description':
626         'Java: Passing a primitive array to a varargs method is usually wrong',
627     'patterns': [r".*: warning: \[PrimitiveArrayPassedToVarargsMethod\] .+"]},
628    {'category': 'java',
629     'severity': severity.MEDIUM,
630     'members': [],
631     'option': '',
632     'description':
633         'Java: Protobuf fields cannot be null, so this check is redundant',
634     'patterns': [r".*: warning: \[ProtoFieldPreconditionsCheckNotNull\] .+"]},
635    {'category': 'java',
636     'severity': severity.MEDIUM,
637     'members': [],
638     'option': '',
639     'description':
640         'Java: This annotation is missing required modifiers as specified by its @RequiredModifiers annotation',
641     'patterns': [r".*: warning: \[RequiredModifiers\] .+"]},
642    {'category': 'java',
643     'severity': severity.MEDIUM,
644     'members': [],
645     'option': '',
646     'description':
647         'Java: A static variable or method should not be accessed from an object instance',
648     'patterns': [r".*: warning: \[StaticAccessedFromInstance\] .+"]},
649    {'category': 'java',
650     'severity': severity.MEDIUM,
651     'members': [],
652     'option': '',
653     'description':
654         'Java: String comparison using reference equality instead of value equality',
655     'patterns': [r".*: warning: \[StringEquality\] .+"]},
656    {'category': 'java',
657     'severity': severity.MEDIUM,
658     'members': [],
659     'option': '',
660     'description':
661         '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.',
662     'patterns': [r".*: warning: \[TypeParameterUnusedInFormals\] .+"]},
663    {'category': 'java',
664     'severity': severity.MEDIUM,
665     'members': [],
666     'option': '',
667     'description':
668         'Java: Using static imports for types is unnecessary',
669     'patterns': [r".*: warning: \[UnnecessaryStaticImport\] .+"]},
670    {'category': 'java',
671     'severity': severity.MEDIUM,
672     'members': [],
673     'option': '',
674     'description':
675         'Java: Unsynchronized method overrides a synchronized method.',
676     'patterns': [r".*: warning: \[UnsynchronizedOverridesSynchronized\] .+"]},
677    {'category': 'java',
678     'severity': severity.MEDIUM,
679     'members': [],
680     'option': '',
681     'description':
682         'Java: Non-constant variable missing @Var annotation',
683     'patterns': [r".*: warning: \[Var\] .+"]},
684    {'category': 'java',
685     'severity': severity.MEDIUM,
686     'members': [],
687     'option': '',
688     'description':
689         'Java: Because of spurious wakeups, Object.wait() and Condition.await() must always be called in a loop',
690     'patterns': [r".*: warning: \[WaitNotInLoop\] .+"]},
691    {'category': 'java',
692     'severity': severity.MEDIUM,
693     'members': [],
694     'option': '',
695     'description':
696         'Java: Subclasses of Fragment must be instantiable via Class#newInstance(): the class must be public, static and have a public nullary constructor',
697     'patterns': [r".*: warning: \[FragmentNotInstantiable\] .+"]},
698    {'category': 'java',
699     'severity': severity.MEDIUM,
700     'members': [],
701     'option': '',
702     'description':
703         'Java: Hardcoded reference to /sdcard',
704     'patterns': [r".*: warning: \[HardCodedSdCardPath\] .+"]},
705    {'category': 'java',
706     'severity': severity.MEDIUM,
707     'members': [],
708     'option': '',
709     'description':
710         'Java: Incompatible type as argument to Object-accepting Java collections method',
711     'patterns': [r".*: warning: \[CollectionIncompatibleType\] .+"]},
712    {'category': 'java',
713     'severity': severity.MEDIUM,
714     'members': [],
715     'option': '',
716     'description':
717         'Java: @AssistedInject and @Inject should not be used on different constructors in the same class.',
718     'patterns': [r".*: warning: \[AssistedInjectAndInjectOnConstructors\] .+"]},
719    {'category': 'java',
720     'severity': severity.MEDIUM,
721     'members': [],
722     'option': '',
723     'description':
724         'Java: Although Guice allows injecting final fields, doing so is not recommended because the injected value may not be visible to other threads.',
725     'patterns': [r".*: warning: \[GuiceInjectOnFinalField\] .+"]},
726    {'category': 'java',
727     'severity': severity.MEDIUM,
728     'members': [],
729     'option': '',
730     'description':
731         '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.',
732     'patterns': [r".*: warning: \[OverridesGuiceInjectableMethod\] .+"]},
733    {'category': 'java',
734     'severity': severity.MEDIUM,
735     'members': [],
736     'option': '',
737     'description':
738         'Java: Double-checked locking on non-volatile fields is unsafe',
739     'patterns': [r".*: warning: \[DoubleCheckedLocking\] .+"]},
740    {'category': 'java',
741     'severity': severity.MEDIUM,
742     'members': [],
743     'option': '',
744     'description':
745         'Java: Writes to static fields should not be guarded by instance locks',
746     'patterns': [r".*: warning: \[StaticGuardedByInstance\] .+"]},
747    {'category': 'java',
748     'severity': severity.MEDIUM,
749     'members': [],
750     'option': '',
751     'description':
752         'Java: Synchronizing on non-final fields is not safe: if the field is ever updated, different threads may end up locking on different objects.',
753     'patterns': [r".*: warning: \[SynchronizeOnNonFinalField\] .+"]},
754    {'category': 'java',
755     'severity': severity.HIGH,
756     'members': [],
757     'option': '',
758     'description':
759         'Java: Reference equality used to compare arrays',
760     'patterns': [r".*: warning: \[ArrayEquals\] .+"]},
761    {'category': 'java',
762     'severity': severity.HIGH,
763     'members': [],
764     'option': '',
765     'description':
766         'Java: hashcode method on array does not hash array contents',
767     'patterns': [r".*: warning: \[ArrayHashCode\] .+"]},
768    {'category': 'java',
769     'severity': severity.HIGH,
770     'members': [],
771     'option': '',
772     'description':
773         'Java: Calling toString on an array does not provide useful information',
774     'patterns': [r".*: warning: \[ArrayToString.*\] .+"]},
775    {'category': 'java',
776     'severity': severity.HIGH,
777     'members': [],
778     'option': '',
779     'description':
780         'Java: Arrays.asList does not autobox primitive arrays, as one might expect.',
781     'patterns': [r".*: warning: \[ArraysAsListPrimitiveArray\] .+"]},
782    {'category': 'java',
783     'severity': severity.HIGH,
784     'members': [],
785     'option': '',
786     'description':
787         'Java: AsyncCallable should not return a null Future, only a Future whose result is null.',
788     'patterns': [r".*: warning: \[AsyncCallableReturnsNull\] .+"]},
789    {'category': 'java',
790     'severity': severity.HIGH,
791     'members': [],
792     'option': '',
793     'description':
794         'Java: AsyncFunction should not return a null Future, only a Future whose result is null.',
795     'patterns': [r".*: warning: \[AsyncFunctionReturnsNull\] .+"]},
796    {'category': 'java',
797     'severity': severity.HIGH,
798     'members': [],
799     'option': '',
800     'description':
801         'Java: Possible sign flip from narrowing conversion',
802     'patterns': [r".*: warning: \[BadComparable\] .+"]},
803    {'category': 'java',
804     'severity': severity.HIGH,
805     'members': [],
806     'option': '',
807     'description':
808         'Java: Shift by an amount that is out of range',
809     'patterns': [r".*: warning: \[BadShiftAmount\] .+"]},
810    {'category': 'java',
811     'severity': severity.HIGH,
812     'members': [],
813     'option': '',
814     'description':
815         'Java: valueOf provides better time and space performance',
816     'patterns': [r".*: warning: \[BoxedPrimitiveConstructor\] .+"]},
817    {'category': 'java',
818     'severity': severity.HIGH,
819     'members': [],
820     'option': '',
821     'description':
822         '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.',
823     'patterns': [r".*: warning: \[ChainingConstructorIgnoresParameter\] .+"]},
824    {'category': 'java',
825     'severity': severity.HIGH,
826     'members': [],
827     'option': '',
828     'description':
829         'Java: Ignored return value of method that is annotated with @CheckReturnValue',
830     'patterns': [r".*: warning: \[CheckReturnValue\] .+"]},
831    {'category': 'java',
832     'severity': severity.HIGH,
833     'members': [],
834     'option': '',
835     'description':
836         'Java: Inner class is non-static but does not reference enclosing class',
837     'patterns': [r".*: warning: \[ClassCanBeStatic\] .+"]},
838    {'category': 'java',
839     'severity': severity.HIGH,
840     'members': [],
841     'option': '',
842     'description':
843         'Java: The source file name should match the name of the top-level class it contains',
844     'patterns': [r".*: warning: \[ClassName\] .+"]},
845    {'category': 'java',
846     'severity': severity.HIGH,
847     'members': [],
848     'option': '',
849     'description':
850         'Java: This comparison method violates the contract',
851     'patterns': [r".*: warning: \[ComparisonContractViolated\] .+"]},
852    {'category': 'java',
853     'severity': severity.HIGH,
854     'members': [],
855     'option': '',
856     'description':
857         'Java: Comparison to value that is out of range for the compared type',
858     'patterns': [r".*: warning: \[ComparisonOutOfRange\] .+"]},
859    {'category': 'java',
860     'severity': severity.HIGH,
861     'members': [],
862     'option': '',
863     'description':
864         'Java: Non-compile-time constant expression passed to parameter with @CompileTimeConstant type annotation.',
865     'patterns': [r".*: warning: \[CompileTimeConstant\] .+"]},
866    {'category': 'java',
867     'severity': severity.HIGH,
868     'members': [],
869     'option': '',
870     'description':
871         'Java: Exception created but not thrown',
872     'patterns': [r".*: warning: \[DeadException\] .+"]},
873    {'category': 'java',
874     'severity': severity.HIGH,
875     'members': [],
876     'option': '',
877     'description':
878         'Java: Division by integer literal zero',
879     'patterns': [r".*: warning: \[DivZero\] .+"]},
880    {'category': 'java',
881     'severity': severity.HIGH,
882     'members': [],
883     'option': '',
884     'description':
885         'Java: Empty statement after if',
886     'patterns': [r".*: warning: \[EmptyIf\] .+"]},
887    {'category': 'java',
888     'severity': severity.HIGH,
889     'members': [],
890     'option': '',
891     'description':
892         'Java: == NaN always returns false; use the isNaN methods instead',
893     'patterns': [r".*: warning: \[EqualsNaN\] .+"]},
894    {'category': 'java',
895     'severity': severity.HIGH,
896     'members': [],
897     'option': '',
898     'description':
899         'Java: Method annotated @ForOverride must be protected or package-private and only invoked from declaring class',
900     'patterns': [r".*: warning: \[ForOverride\] .+"]},
901    {'category': 'java',
902     'severity': severity.HIGH,
903     'members': [],
904     'option': '',
905     'description':
906         'Java: Futures.getChecked requires a checked exception type with a standard constructor.',
907     'patterns': [r".*: warning: \[FuturesGetCheckedIllegalExceptionType\] .+"]},
908    {'category': 'java',
909     'severity': severity.HIGH,
910     'members': [],
911     'option': '',
912     'description':
913         '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',
914     'patterns': [r".*: warning: \[GetClassOnClass\] .+"]},
915    {'category': 'java',
916     'severity': severity.HIGH,
917     'members': [],
918     'option': '',
919     'description':
920         'Java: An object is tested for equality to itself using Guava Libraries',
921     'patterns': [r".*: warning: \[GuavaSelfEquals\] .+"]},
922    {'category': 'java',
923     'severity': severity.HIGH,
924     'members': [],
925     'option': '',
926     'description':
927         'Java: contains() is a legacy method that is equivalent to containsValue()',
928     'patterns': [r".*: warning: \[HashtableContains\] .+"]},
929    {'category': 'java',
930     'severity': severity.HIGH,
931     'members': [],
932     'option': '',
933     'description':
934         'Java: Cipher.getInstance() is invoked using either the default settings or ECB mode',
935     'patterns': [r".*: warning: \[InsecureCipherMode\] .+"]},
936    {'category': 'java',
937     'severity': severity.HIGH,
938     'members': [],
939     'option': '',
940     'description':
941         'Java: Invalid syntax used for a regular expression',
942     'patterns': [r".*: warning: \[InvalidPatternSyntax\] .+"]},
943    {'category': 'java',
944     'severity': severity.HIGH,
945     'members': [],
946     'option': '',
947     'description':
948         'Java: The argument to Class#isInstance(Object) should not be a Class',
949     'patterns': [r".*: warning: \[IsInstanceOfClass\] .+"]},
950    {'category': 'java',
951     'severity': severity.HIGH,
952     'members': [],
953     'option': '',
954     'description':
955         'Java: jMock tests must have a @RunWith(JMock.class) annotation, or the Mockery field must have a @Rule JUnit annotation',
956     'patterns': [r".*: warning: \[JMockTestWithoutRunWithOrRuleAnnotation\] .+"]},
957    {'category': 'java',
958     'severity': severity.HIGH,
959     'members': [],
960     'option': '',
961     'description':
962         'Java: Test method will not be run; please prefix name with "test"',
963     'patterns': [r".*: warning: \[JUnit3TestNotRun\] .+"]},
964    {'category': 'java',
965     'severity': severity.HIGH,
966     'members': [],
967     'option': '',
968     'description':
969         'Java: setUp() method will not be run; Please add a @Before annotation',
970     'patterns': [r".*: warning: \[JUnit4SetUpNotRun\] .+"]},
971    {'category': 'java',
972     'severity': severity.HIGH,
973     'members': [],
974     'option': '',
975     'description':
976         'Java: tearDown() method will not be run; Please add an @After annotation',
977     'patterns': [r".*: warning: \[JUnit4TearDownNotRun\] .+"]},
978    {'category': 'java',
979     'severity': severity.HIGH,
980     'members': [],
981     'option': '',
982     'description':
983         'Java: Test method will not be run; please add @Test annotation',
984     'patterns': [r".*: warning: \[JUnit4TestNotRun\] .+"]},
985    {'category': 'java',
986     'severity': severity.HIGH,
987     'members': [],
988     'option': '',
989     'description':
990         'Java: Printf-like format string does not match its arguments',
991     'patterns': [r".*: warning: \[MalformedFormatString\] .+"]},
992    {'category': 'java',
993     'severity': severity.HIGH,
994     'members': [],
995     'option': '',
996     'description':
997         'Java: Use of "YYYY" (week year) in a date pattern without "ww" (week in year). You probably meant to use "yyyy" (year) instead.',
998     'patterns': [r".*: warning: \[MisusedWeekYear\] .+"]},
999    {'category': 'java',
1000     'severity': severity.HIGH,
1001     'members': [],
1002     'option': '',
1003     'description':
1004         'Java: A bug in Mockito will cause this test to fail at runtime with a ClassCastException',
1005     'patterns': [r".*: warning: \[MockitoCast\] .+"]},
1006    {'category': 'java',
1007     'severity': severity.HIGH,
1008     'members': [],
1009     'option': '',
1010     'description':
1011         'Java: Missing method call for verify(mock) here',
1012     'patterns': [r".*: warning: \[MockitoUsage\] .+"]},
1013    {'category': 'java',
1014     'severity': severity.HIGH,
1015     'members': [],
1016     'option': '',
1017     'description':
1018         'Java: Modifying a collection with itself',
1019     'patterns': [r".*: warning: \[ModifyingCollectionWithItself\] .+"]},
1020    {'category': 'java',
1021     'severity': severity.HIGH,
1022     'members': [],
1023     'option': '',
1024     'description':
1025         'Java: Compound assignments to bytes, shorts, chars, and floats hide dangerous casts',
1026     'patterns': [r".*: warning: \[NarrowingCompoundAssignment\] .+"]},
1027    {'category': 'java',
1028     'severity': severity.HIGH,
1029     'members': [],
1030     'option': '',
1031     'description':
1032         'Java: @NoAllocation was specified on this method, but something was found that would trigger an allocation',
1033     'patterns': [r".*: warning: \[NoAllocation\] .+"]},
1034    {'category': 'java',
1035     'severity': severity.HIGH,
1036     'members': [],
1037     'option': '',
1038     'description':
1039         'Java: Static import of type uses non-canonical name',
1040     'patterns': [r".*: warning: \[NonCanonicalStaticImport\] .+"]},
1041    {'category': 'java',
1042     'severity': severity.HIGH,
1043     'members': [],
1044     'option': '',
1045     'description':
1046         'Java: @CompileTimeConstant parameters should be final',
1047     'patterns': [r".*: warning: \[NonFinalCompileTimeConstant\] .+"]},
1048    {'category': 'java',
1049     'severity': severity.HIGH,
1050     'members': [],
1051     'option': '',
1052     'description':
1053         'Java: Calling getAnnotation on an annotation that is not retained at runtime.',
1054     'patterns': [r".*: warning: \[NonRuntimeAnnotation\] .+"]},
1055    {'category': 'java',
1056     'severity': severity.HIGH,
1057     'members': [],
1058     'option': '',
1059     'description':
1060         'Java: Numeric comparison using reference equality instead of value equality',
1061     'patterns': [r".*: warning: \[NumericEquality\] .+"]},
1062    {'category': 'java',
1063     'severity': severity.HIGH,
1064     'members': [],
1065     'option': '',
1066     'description':
1067         'Java: Comparison using reference equality instead of value equality',
1068     'patterns': [r".*: warning: \[OptionalEquality\] .+"]},
1069    {'category': 'java',
1070     'severity': severity.HIGH,
1071     'members': [],
1072     'option': '',
1073     'description':
1074         'Java: Varargs doesn\'t agree for overridden method',
1075     'patterns': [r".*: warning: \[Overrides\] .+"]},
1076    {'category': 'java',
1077     'severity': severity.HIGH,
1078     'members': [],
1079     'option': '',
1080     'description':
1081         'Java: Literal passed as first argument to Preconditions.checkNotNull() can never be null',
1082     'patterns': [r".*: warning: \[PreconditionsCheckNotNull\] .+"]},
1083    {'category': 'java',
1084     'severity': severity.HIGH,
1085     'members': [],
1086     'option': '',
1087     'description':
1088         'Java: First argument to `Preconditions.checkNotNull()` is a primitive rather than an object reference',
1089     'patterns': [r".*: warning: \[PreconditionsCheckNotNullPrimitive\] .+"]},
1090    {'category': 'java',
1091     'severity': severity.HIGH,
1092     'members': [],
1093     'option': '',
1094     'description':
1095         'Java: Protobuf fields cannot be null',
1096     'patterns': [r".*: warning: \[ProtoFieldNullComparison\] .+"]},
1097    {'category': 'java',
1098     'severity': severity.HIGH,
1099     'members': [],
1100     'option': '',
1101     'description':
1102         'Java: Comparing protobuf fields of type String using reference equality',
1103     'patterns': [r".*: warning: \[ProtoStringFieldReferenceEquality\] .+"]},
1104    {'category': 'java',
1105     'severity': severity.HIGH,
1106     'members': [],
1107     'option': '',
1108     'description':
1109         'Java:  Check for non-whitelisted callers to RestrictedApiChecker.',
1110     'patterns': [r".*: warning: \[RestrictedApiChecker\] .+"]},
1111    {'category': 'java',
1112     'severity': severity.HIGH,
1113     'members': [],
1114     'option': '',
1115     'description':
1116         'Java: Return value of this method must be used',
1117     'patterns': [r".*: warning: \[ReturnValueIgnored\] .+"]},
1118    {'category': 'java',
1119     'severity': severity.HIGH,
1120     'members': [],
1121     'option': '',
1122     'description':
1123         'Java: Variable assigned to itself',
1124     'patterns': [r".*: warning: \[SelfAssignment\] .+"]},
1125    {'category': 'java',
1126     'severity': severity.HIGH,
1127     'members': [],
1128     'option': '',
1129     'description':
1130         'Java: An object is compared to itself',
1131     'patterns': [r".*: warning: \[SelfComparision\] .+"]},
1132    {'category': 'java',
1133     'severity': severity.HIGH,
1134     'members': [],
1135     'option': '',
1136     'description':
1137         'Java: Variable compared to itself',
1138     'patterns': [r".*: warning: \[SelfEquality\] .+"]},
1139    {'category': 'java',
1140     'severity': severity.HIGH,
1141     'members': [],
1142     'option': '',
1143     'description':
1144         'Java: An object is tested for equality to itself',
1145     'patterns': [r".*: warning: \[SelfEquals\] .+"]},
1146    {'category': 'java',
1147     'severity': severity.HIGH,
1148     'members': [],
1149     'option': '',
1150     'description':
1151         'Java: Comparison of a size >= 0 is always true, did you intend to check for non-emptiness?',
1152     'patterns': [r".*: warning: \[SizeGreaterThanOrEqualsZero\] .+"]},
1153    {'category': 'java',
1154     'severity': severity.HIGH,
1155     'members': [],
1156     'option': '',
1157     'description':
1158         'Java: Calling toString on a Stream does not provide useful information',
1159     'patterns': [r".*: warning: \[StreamToString\] .+"]},
1160    {'category': 'java',
1161     'severity': severity.HIGH,
1162     'members': [],
1163     'option': '',
1164     'description':
1165         'Java: StringBuilder does not have a char constructor; this invokes the int constructor.',
1166     'patterns': [r".*: warning: \[StringBuilderInitWithChar\] .+"]},
1167    {'category': 'java',
1168     'severity': severity.HIGH,
1169     'members': [],
1170     'option': '',
1171     'description':
1172         'Java: Suppressing "deprecated" is probably a typo for "deprecation"',
1173     'patterns': [r".*: warning: \[SuppressWarningsDeprecated\] .+"]},
1174    {'category': 'java',
1175     'severity': severity.HIGH,
1176     'members': [],
1177     'option': '',
1178     'description':
1179         'Java: throwIfUnchecked(knownCheckedException) is a no-op.',
1180     'patterns': [r".*: warning: \[ThrowIfUncheckedKnownChecked\] .+"]},
1181    {'category': 'java',
1182     'severity': severity.HIGH,
1183     'members': [],
1184     'option': '',
1185     'description':
1186         'Java: Catching Throwable/Error masks failures from fail() or assert*() in the try block',
1187     'patterns': [r".*: warning: \[TryFailThrowable\] .+"]},
1188    {'category': 'java',
1189     'severity': severity.HIGH,
1190     'members': [],
1191     'option': '',
1192     'description':
1193         'Java: Type parameter used as type qualifier',
1194     'patterns': [r".*: warning: \[TypeParameterQualifier\] .+"]},
1195    {'category': 'java',
1196     'severity': severity.HIGH,
1197     'members': [],
1198     'option': '',
1199     'description':
1200         'Java: Non-generic methods should not be invoked with type arguments',
1201     'patterns': [r".*: warning: \[UnnecessaryTypeArgument\] .+"]},
1202    {'category': 'java',
1203     'severity': severity.HIGH,
1204     'members': [],
1205     'option': '',
1206     'description':
1207         'Java: Instance created but never used',
1208     'patterns': [r".*: warning: \[UnusedAnonymousClass\] .+"]},
1209    {'category': 'java',
1210     'severity': severity.HIGH,
1211     'members': [],
1212     'option': '',
1213     'description':
1214         'Java: Use of wildcard imports is forbidden',
1215     'patterns': [r".*: warning: \[WildcardImport\] .+"]},
1216    {'category': 'java',
1217     'severity': severity.HIGH,
1218     'members': [],
1219     'option': '',
1220     'description':
1221         'Java: Method parameter has wrong package',
1222     'patterns': [r".*: warning: \[ParameterPackage\] .+"]},
1223    {'category': 'java',
1224     'severity': severity.HIGH,
1225     'members': [],
1226     'option': '',
1227     'description':
1228         'Java: Certain resources in `android.R.string` have names that do not match their content',
1229     'patterns': [r".*: warning: \[MislabeledAndroidString\] .+"]},
1230    {'category': 'java',
1231     'severity': severity.HIGH,
1232     'members': [],
1233     'option': '',
1234     'description':
1235         'Java: Return value of android.graphics.Rect.intersect() must be checked',
1236     'patterns': [r".*: warning: \[RectIntersectReturnValueIgnored\] .+"]},
1237    {'category': 'java',
1238     'severity': severity.HIGH,
1239     'members': [],
1240     'option': '',
1241     'description':
1242         'Java: Invalid printf-style format string',
1243     'patterns': [r".*: warning: \[FormatString\] .+"]},
1244    {'category': 'java',
1245     'severity': severity.HIGH,
1246     'members': [],
1247     'option': '',
1248     'description':
1249         'Java: @AssistedInject and @Inject cannot be used on the same constructor.',
1250     'patterns': [r".*: warning: \[AssistedInjectAndInjectOnSameConstructor\] .+"]},
1251    {'category': 'java',
1252     'severity': severity.HIGH,
1253     'members': [],
1254     'option': '',
1255     'description':
1256         'Java: Injected constructors cannot be optional nor have binding annotations',
1257     'patterns': [r".*: warning: \[InjectedConstructorAnnotations\] .+"]},
1258    {'category': 'java',
1259     'severity': severity.HIGH,
1260     'members': [],
1261     'option': '',
1262     'description':
1263         'Java: The target of a scoping annotation must be set to METHOD and/or TYPE.',
1264     'patterns': [r".*: warning: \[InjectInvalidTargetingOnScopingAnnotation\] .+"]},
1265    {'category': 'java',
1266     'severity': severity.HIGH,
1267     'members': [],
1268     'option': '',
1269     'description':
1270         'Java: Abstract methods are not injectable with javax.inject.Inject.',
1271     'patterns': [r".*: warning: \[JavaxInjectOnAbstractMethod\] .+"]},
1272    {'category': 'java',
1273     'severity': severity.HIGH,
1274     'members': [],
1275     'option': '',
1276     'description':
1277         'Java: @javax.inject.Inject cannot be put on a final field.',
1278     'patterns': [r".*: warning: \[JavaxInjectOnFinalField\] .+"]},
1279    {'category': 'java',
1280     'severity': severity.HIGH,
1281     'members': [],
1282     'option': '',
1283     'description':
1284         'Java: A class may not have more than one injectable constructor.',
1285     'patterns': [r".*: warning: \[MoreThanOneInjectableConstructor\] .+"]},
1286    {'category': 'java',
1287     'severity': severity.HIGH,
1288     'members': [],
1289     'option': '',
1290     'description':
1291         'Java: Using more than one qualifier annotation on the same element is not allowed.',
1292     'patterns': [r".*: warning: \[InjectMoreThanOneQualifier\] .+"]},
1293    {'category': 'java',
1294     'severity': severity.HIGH,
1295     'members': [],
1296     'option': '',
1297     'description':
1298         'Java: A class can be annotated with at most one scope annotation',
1299     'patterns': [r".*: warning: \[InjectMoreThanOneScopeAnnotationOnClass\] .+"]},
1300    {'category': 'java',
1301     'severity': severity.HIGH,
1302     'members': [],
1303     'option': '',
1304     'description':
1305         'Java: Annotations cannot be both Qualifiers/BindingAnnotations and Scopes',
1306     'patterns': [r".*: warning: \[OverlappingQualifierAndScopeAnnotation\] .+"]},
1307    {'category': 'java',
1308     'severity': severity.HIGH,
1309     'members': [],
1310     'option': '',
1311     'description':
1312         'Java: Scope annotation on an interface or abstact class is not allowed',
1313     'patterns': [r".*: warning: \[InjectScopeAnnotationOnInterfaceOrAbstractClass\] .+"]},
1314    {'category': 'java',
1315     'severity': severity.HIGH,
1316     'members': [],
1317     'option': '',
1318     'description':
1319         'Java: Scoping and qualifier annotations must have runtime retention.',
1320     'patterns': [r".*: warning: \[InjectScopeOrQualifierAnnotationRetention\] .+"]},
1321    {'category': 'java',
1322     'severity': severity.HIGH,
1323     'members': [],
1324     'option': '',
1325     'description':
1326         'Java: Dagger @Provides methods may not return null unless annotated with @Nullable',
1327     'patterns': [r".*: warning: \[DaggerProvidesNull\] .+"]},
1328    {'category': 'java',
1329     'severity': severity.HIGH,
1330     'members': [],
1331     'option': '',
1332     'description':
1333         'Java: Scope annotation on implementation class of AssistedInject factory is not allowed',
1334     'patterns': [r".*: warning: \[GuiceAssistedInjectScoping\] .+"]},
1335    {'category': 'java',
1336     'severity': severity.HIGH,
1337     'members': [],
1338     'option': '',
1339     'description':
1340         'Java: A constructor cannot have two @Assisted parameters of the same type unless they are disambiguated with named @Assisted annotations. ',
1341     'patterns': [r".*: warning: \[GuiceAssistedParameters\] .+"]},
1342    {'category': 'java',
1343     'severity': severity.HIGH,
1344     'members': [],
1345     'option': '',
1346     'description':
1347         'Java: This method is not annotated with @Inject, but it overrides a  method that is  annotated with @javax.inject.Inject.',
1348     'patterns': [r".*: warning: \[OverridesJavaxInjectableMethod\] .+"]},
1349    {'category': 'java',
1350     'severity': severity.HIGH,
1351     'members': [],
1352     'option': '',
1353     'description':
1354         'Java: Checks for unguarded accesses to fields and methods with @GuardedBy annotations',
1355     'patterns': [r".*: warning: \[GuardedByChecker\] .+"]},
1356    {'category': 'java',
1357     'severity': severity.HIGH,
1358     'members': [],
1359     'option': '',
1360     'description':
1361         'Java: Invalid @GuardedBy expression',
1362     'patterns': [r".*: warning: \[GuardedByValidator\] .+"]},
1363    {'category': 'java',
1364     'severity': severity.HIGH,
1365     'members': [],
1366     'option': '',
1367     'description':
1368         'Java: Type declaration annotated with @Immutable is not immutable',
1369     'patterns': [r".*: warning: \[Immutable\] .+"]},
1370    {'category': 'java',
1371     'severity': severity.HIGH,
1372     'members': [],
1373     'option': '',
1374     'description':
1375         'Java: This method does not acquire the locks specified by its @LockMethod annotation',
1376     'patterns': [r".*: warning: \[LockMethodChecker\] .+"]},
1377    {'category': 'java',
1378     'severity': severity.HIGH,
1379     'members': [],
1380     'option': '',
1381     'description':
1382         'Java: This method does not acquire the locks specified by its @UnlockMethod annotation',
1383     'patterns': [r".*: warning: \[UnlockMethod\] .+"]},
1384
1385    {'category': 'java',
1386     'severity': severity.UNKNOWN,
1387     'members': [],
1388     'option': '',
1389     'description': 'Java: Unclassified/unrecognized warnings',
1390     'patterns': [r".*: warning: \[.+\] .+"]},
1391
1392    { 'category':'aapt',    'severity':severity.MEDIUM,   'members':[], 'option':'',
1393        'description':'aapt: No default translation',
1394        'patterns':[r".*: warning: string '.+' has no default translation in .*"] },
1395    { 'category':'aapt',    'severity':severity.MEDIUM,   'members':[], 'option':'',
1396        'description':'aapt: Missing default or required localization',
1397        'patterns':[r".*: warning: \*\*\*\* string '.+' has no default or required localization for '.+' in .+"] },
1398    { 'category':'aapt',    'severity':severity.MEDIUM,   'members':[], 'option':'',
1399        'description':'aapt: String marked untranslatable, but translation exists',
1400        'patterns':[r".*: warning: string '.+' in .* marked untranslatable but exists in locale '??_??'"] },
1401    { 'category':'aapt',    'severity':severity.MEDIUM,   'members':[], 'option':'',
1402        'description':'aapt: empty span in string',
1403        'patterns':[r".*: warning: empty '.+' span found in text '.+"] },
1404    { 'category':'C/C++',   'severity':severity.MEDIUM,   'members':[], 'option':'',
1405        'description':'Taking address of temporary',
1406        'patterns':[r".*: warning: taking address of temporary"] },
1407    { 'category':'C/C++',   'severity':severity.MEDIUM,   'members':[], 'option':'',
1408        'description':'Possible broken line continuation',
1409        'patterns':[r".*: warning: backslash and newline separated by space"] },
1410    { 'category':'C/C++',   'severity':severity.MEDIUM,   'members':[], 'option':'-Wundefined-var-template',
1411        'description':'Undefined variable template',
1412        'patterns':[r".*: warning: instantiation of variable .* no definition is available"] },
1413    { 'category':'C/C++',   'severity':severity.MEDIUM,   'members':[], 'option':'-Wundefined-inline',
1414        'description':'Inline function is not defined',
1415        'patterns':[r".*: warning: inline function '.*' is not defined"] },
1416    { 'category':'C/C++',   'severity':severity.MEDIUM,   'members':[], 'option':'-Warray-bounds',
1417        'description':'Array subscript out of bounds',
1418        'patterns':[r".*: warning: array subscript is above array bounds",
1419                    r".*: warning: Array subscript is undefined",
1420                    r".*: warning: array subscript is below array bounds"] },
1421    { 'category':'C/C++',   'severity':severity.MEDIUM,   'members':[], 'option':'',
1422        'description':'Excess elements in initializer',
1423        'patterns':[r".*: warning: excess elements in .+ initializer"] },
1424    { 'category':'C/C++',   'severity':severity.MEDIUM,   'members':[], 'option':'',
1425        'description':'Decimal constant is unsigned only in ISO C90',
1426        'patterns':[r".*: warning: this decimal constant is unsigned only in ISO C90"] },
1427    { 'category':'C/C++',   'severity':severity.MEDIUM,   'members':[], 'option':'-Wmain',
1428        'description':'main is usually a function',
1429        'patterns':[r".*: warning: 'main' is usually a function"] },
1430    { 'category':'C/C++',   'severity':severity.MEDIUM,   'members':[], 'option':'',
1431        'description':'Typedef ignored',
1432        'patterns':[r".*: warning: 'typedef' was ignored in this declaration"] },
1433    { 'category':'C/C++',   'severity':severity.HIGH,     'members':[], 'option':'-Waddress',
1434        'description':'Address always evaluates to true',
1435        'patterns':[r".*: warning: the address of '.+' will always evaluate as 'true'"] },
1436    { 'category':'C/C++',   'severity':severity.FIXMENOW, 'members':[], 'option':'',
1437        'description':'Freeing a non-heap object',
1438        'patterns':[r".*: warning: attempt to free a non-heap object '.+'"] },
1439    { 'category':'C/C++',   'severity':severity.MEDIUM,   'members':[], 'option':'-Wchar-subscripts',
1440        'description':'Array subscript has type char',
1441        'patterns':[r".*: warning: array subscript .+ type 'char'.+Wchar-subscripts"] },
1442    { 'category':'C/C++',   'severity':severity.MEDIUM,   'members':[], 'option':'',
1443        'description':'Constant too large for type',
1444        'patterns':[r".*: warning: integer constant is too large for '.+' type"] },
1445    { 'category':'C/C++',   'severity':severity.MEDIUM,   'members':[], 'option':'-Woverflow',
1446        'description':'Constant too large for type, truncated',
1447        'patterns':[r".*: warning: large integer implicitly truncated to unsigned type"] },
1448    { 'category':'C/C++',   'severity':severity.MEDIUM,   'members':[], 'option':'-Winteger-overflow',
1449        'description':'Overflow in expression',
1450        'patterns':[r".*: warning: overflow in expression; .*Winteger-overflow"] },
1451    { 'category':'C/C++',   'severity':severity.MEDIUM,   'members':[], 'option':'-Woverflow',
1452        'description':'Overflow in implicit constant conversion',
1453        'patterns':[r".*: warning: overflow in implicit constant conversion"] },
1454    { 'category':'C/C++',   'severity':severity.MEDIUM,   'members':[], 'option':'',
1455        'description':'Declaration does not declare anything',
1456        'patterns':[r".*: warning: declaration 'class .+' does not declare anything"] },
1457    { 'category':'C/C++',   'severity':severity.MEDIUM,   'members':[], 'option':'-Wreorder',
1458        'description':'Initialization order will be different',
1459        'patterns':[r".*: warning: '.+' will be initialized after",
1460                    r".*: warning: field .+ will be initialized after .+Wreorder"] },
1461    { 'category':'cont.',   'severity':severity.SKIP,     'members':[], 'option':'',
1462        'description':'',
1463        'patterns':[r".*: warning:   '.+'"] },
1464    { 'category':'cont.',   'severity':severity.SKIP,     'members':[], 'option':'',
1465        'description':'',
1466        'patterns':[r".*: warning:   base '.+'"] },
1467    { 'category':'cont.',   'severity':severity.SKIP,     'members':[], 'option':'',
1468        'description':'',
1469        'patterns':[r".*: warning:   when initialized here"] },
1470    { 'category':'C/C++',   'severity':severity.MEDIUM,   'members':[], 'option':'-Wmissing-parameter-type',
1471        'description':'Parameter type not specified',
1472        'patterns':[r".*: warning: type of '.+' defaults to 'int'"] },
1473    { 'category':'C/C++',   'severity':severity.MEDIUM,   'members':[], 'option':'-Wmissing-declarations',
1474        'description':'Missing declarations',
1475        'patterns':[r".*: warning: declaration does not declare anything"] },
1476    { 'category':'C/C++',   'severity':severity.MEDIUM,   'members':[], 'option':'-Wmissing-noreturn',
1477        'description':'Missing noreturn',
1478        'patterns':[r".*: warning: function '.*' could be declared with attribute 'noreturn'"] },
1479    { 'category':'gcc',     'severity':severity.MEDIUM,   'members':[], 'option':'',
1480        'description':'Invalid option for C file',
1481        'patterns':[r".*: warning: command line option "".+"" is valid for C\+\+\/ObjC\+\+ but not for C"] },
1482    { 'category':'C/C++',   'severity':severity.MEDIUM,   'members':[], 'option':'',
1483        'description':'User warning',
1484        'patterns':[r".*: warning: #warning "".+"""] },
1485    { 'category':'C/C++',   'severity':severity.MEDIUM,   'members':[], 'option':'-Wvexing-parse',
1486        'description':'Vexing parsing problem',
1487        'patterns':[r".*: warning: empty parentheses interpreted as a function declaration"] },
1488    { 'category':'C/C++',   'severity':severity.MEDIUM,   'members':[], 'option':'-Wextra',
1489        'description':'Dereferencing void*',
1490        'patterns':[r".*: warning: dereferencing 'void \*' pointer"] },
1491    { 'category':'C/C++',   'severity':severity.MEDIUM,   'members':[], 'option':'',
1492        'description':'Comparison of pointer and integer',
1493        'patterns':[r".*: warning: ordered comparison of pointer with integer zero",
1494                    r".*: warning: .*comparison between pointer and integer"] },
1495    { 'category':'C/C++',   'severity':severity.MEDIUM,   'members':[], 'option':'',
1496        'description':'Use of error-prone unary operator',
1497        'patterns':[r".*: warning: use of unary operator that may be intended as compound assignment"] },
1498    { 'category':'C/C++',   'severity':severity.MEDIUM,   'members':[], 'option':'-Wwrite-strings',
1499        'description':'Conversion of string constant to non-const char*',
1500        'patterns':[r".*: warning: deprecated conversion from string constant to '.+'"] },
1501    { 'category':'C/C++',   'severity':severity.MEDIUM,   'members':[], 'option':'-Wstrict-prototypes',
1502        'description':'Function declaration isn''t a prototype',
1503        'patterns':[r".*: warning: function declaration isn't a prototype"] },
1504    { 'category':'C/C++',   'severity':severity.MEDIUM,   'members':[], 'option':'-Wignored-qualifiers',
1505        'description':'Type qualifiers ignored on function return value',
1506        'patterns':[r".*: warning: type qualifiers ignored on function return type",
1507                    r".*: warning: .+ type qualifier .+ has no effect .+Wignored-qualifiers"] },
1508    { 'category':'C/C++',   'severity':severity.MEDIUM,   'members':[], 'option':'',
1509        'description':'<foo> declared inside parameter list, scope limited to this definition',
1510        'patterns':[r".*: warning: '.+' declared inside parameter list"] },
1511    { 'category':'cont.',   'severity':severity.SKIP,     'members':[], 'option':'',
1512        'description':'',
1513        'patterns':[r".*: warning: its scope is only this definition or declaration, which is probably not what you want"] },
1514    { 'category':'C/C++',   'severity':severity.LOW,      'members':[], 'option':'-Wcomment',
1515        'description':'Line continuation inside comment',
1516        'patterns':[r".*: warning: multi-line comment"] },
1517    { 'category':'C/C++',   'severity':severity.LOW,      'members':[], 'option':'-Wcomment',
1518        'description':'Comment inside comment',
1519        'patterns':[r".*: warning: "".+"" within comment"] },
1520    # Warning "value stored is never read" could be from clang-tidy or clang static analyzer.
1521    { 'category':'C/C++',   'severity':severity.TIDY,      'members':[], 'option':'',
1522        'description':'clang-tidy Value stored is never read',
1523        'patterns':[r".*: warning: Value stored to .+ is never read.*clang-analyzer-deadcode.DeadStores"] },
1524    { 'category':'C/C++',   'severity':severity.LOW,      'members':[], 'option':'',
1525        'description':'Value stored is never read',
1526        'patterns':[r".*: warning: Value stored to .+ is never read"] },
1527    { 'category':'C/C++',   'severity':severity.LOW,      'members':[], 'option':'-Wdeprecated-declarations',
1528        'description':'Deprecated declarations',
1529        'patterns':[r".*: warning: .+ is deprecated.+deprecated-declarations"] },
1530    { 'category':'C/C++',   'severity':severity.LOW,      'members':[], 'option':'-Wdeprecated-register',
1531        'description':'Deprecated register',
1532        'patterns':[r".*: warning: 'register' storage class specifier is deprecated"] },
1533    { 'category':'C/C++',   'severity':severity.LOW,      'members':[], 'option':'-Wpointer-sign',
1534        'description':'Converts between pointers to integer types with different sign',
1535        'patterns':[r".*: warning: .+ converts between pointers to integer types with different sign"] },
1536    { 'category':'C/C++',   'severity':severity.HARMLESS, 'members':[], 'option':'',
1537        'description':'Extra tokens after #endif',
1538        'patterns':[r".*: warning: extra tokens at end of #endif directive"] },
1539    { 'category':'C/C++',   'severity':severity.MEDIUM,   'members':[], 'option':'-Wenum-compare',
1540        'description':'Comparison between different enums',
1541        'patterns':[r".*: warning: comparison between '.+' and '.+'.+Wenum-compare"] },
1542    { 'category':'C/C++',   'severity':severity.MEDIUM,   'members':[], 'option':'-Wconversion',
1543        'description':'Conversion may change value',
1544        'patterns':[r".*: warning: converting negative value '.+' to '.+'",
1545                    r".*: warning: conversion to '.+' .+ may (alter|change)"] },
1546    { 'category':'C/C++',   'severity':severity.MEDIUM,   'members':[], 'option':'-Wconversion-null',
1547        'description':'Converting to non-pointer type from NULL',
1548        'patterns':[r".*: warning: converting to non-pointer type '.+' from NULL"] },
1549    { 'category':'C/C++',   'severity':severity.MEDIUM,   'members':[], 'option':'-Wnull-conversion',
1550        'description':'Converting NULL to non-pointer type',
1551        'patterns':[r".*: warning: implicit conversion of NULL constant to '.+'"] },
1552    { 'category':'C/C++',   'severity':severity.MEDIUM,   'members':[], 'option':'-Wnon-literal-null-conversion',
1553        'description':'Zero used as null pointer',
1554        'patterns':[r".*: warning: expression .* zero treated as a null pointer constant"] },
1555    { 'category':'C/C++',   'severity':severity.MEDIUM,   'members':[], 'option':'',
1556        'description':'Implicit conversion changes value',
1557        'patterns':[r".*: warning: implicit conversion .* changes value from .* to .*-conversion"] },
1558    { 'category':'C/C++',   'severity':severity.MEDIUM,   'members':[], 'option':'',
1559        'description':'Passing NULL as non-pointer argument',
1560        'patterns':[r".*: warning: passing NULL to non-pointer argument [0-9]+ of '.+'"] },
1561    { 'category':'C/C++',   'severity':severity.MEDIUM,   'members':[], 'option':'-Wctor-dtor-privacy',
1562        'description':'Class seems unusable because of private ctor/dtor' ,
1563        'patterns':[r".*: warning: all member functions in class '.+' are private"] },
1564    # skip this next one, because it only points out some RefBase-based classes where having a private destructor is perfectly fine
1565    { 'category':'C/C++',   'severity':severity.SKIP,     'members':[], 'option':'-Wctor-dtor-privacy',
1566        'description':'Class seems unusable because of private ctor/dtor' ,
1567        'patterns':[r".*: warning: 'class .+' only defines a private destructor and has no friends"] },
1568    { 'category':'C/C++',   'severity':severity.MEDIUM,   'members':[], 'option':'-Wctor-dtor-privacy',
1569        'description':'Class seems unusable because of private ctor/dtor' ,
1570        'patterns':[r".*: warning: 'class .+' only defines private constructors and has no friends"] },
1571    { 'category':'C/C++',   'severity':severity.MEDIUM,   'members':[], 'option':'-Wgnu-static-float-init',
1572        'description':'In-class initializer for static const float/double' ,
1573        'patterns':[r".*: warning: in-class initializer for static data member of .+const (float|double)"] },
1574    { 'category':'C/C++',   'severity':severity.MEDIUM,   'members':[], 'option':'-Wpointer-arith',
1575        'description':'void* used in arithmetic' ,
1576        'patterns':[r".*: warning: pointer of type 'void \*' used in (arithmetic|subtraction)",
1577                    r".*: warning: arithmetic on .+ to void is a GNU extension.*Wpointer-arith",
1578                    r".*: warning: wrong type argument to increment"] },
1579    { 'category':'C/C++',   'severity':severity.MEDIUM,   'members':[], 'option':'-Wsign-promo',
1580        'description':'Overload resolution chose to promote from unsigned or enum to signed type' ,
1581        'patterns':[r".*: warning: passing '.+' chooses '.+' over '.+'.*Wsign-promo"] },
1582    { 'category':'cont.',   'severity':severity.SKIP,     'members':[], 'option':'',
1583        'description':'',
1584        'patterns':[r".*: warning:   in call to '.+'"] },
1585    { 'category':'C/C++',   'severity':severity.HIGH,     'members':[], 'option':'-Wextra',
1586        'description':'Base should be explicitly initialized in copy constructor',
1587        'patterns':[r".*: warning: base class '.+' should be explicitly initialized in the copy constructor"] },
1588    { 'category':'C/C++',   'severity':severity.MEDIUM,     'members':[], 'option':'',
1589        'description':'VLA has zero or negative size',
1590        'patterns':[r".*: warning: Declared variable-length array \(VLA\) has .+ size"] },
1591    { 'category':'C/C++',   'severity':severity.MEDIUM,     'members':[], 'option':'',
1592        'description':'Return value from void function',
1593        'patterns':[r".*: warning: 'return' with a value, in function returning void"] },
1594    { 'category':'C/C++',   'severity':severity.MEDIUM,     'members':[], 'option':'multichar',
1595        'description':'Multi-character character constant',
1596        'patterns':[r".*: warning: multi-character character constant"] },
1597    { 'category':'C/C++',   'severity':severity.MEDIUM,     'members':[], 'option':'writable-strings',
1598        'description':'Conversion from string literal to char*',
1599        'patterns':[r".*: warning: .+ does not allow conversion from string literal to 'char \*'"] },
1600    { 'category':'C/C++',   'severity':severity.LOW,     'members':[], 'option':'-Wextra-semi',
1601        'description':'Extra \';\'',
1602        'patterns':[r".*: warning: extra ';' .+extra-semi"] },
1603    { 'category':'C/C++',   'severity':severity.LOW,     'members':[], 'option':'',
1604        'description':'Useless specifier',
1605        'patterns':[r".*: warning: useless storage class specifier in empty declaration"] },
1606    { 'category':'C/C++',   'severity':severity.LOW,     'members':[], 'option':'-Wduplicate-decl-specifier',
1607        'description':'Duplicate declaration specifier',
1608        'patterns':[r".*: warning: duplicate '.+' declaration specifier"] },
1609    { 'category':'logtags',   'severity':severity.LOW,     'members':[], 'option':'',
1610        'description':'Duplicate logtag',
1611        'patterns':[r".*: warning: tag \".+\" \(.+\) duplicated in .+"] },
1612    { 'category':'logtags',   'severity':severity.LOW,     'members':[], 'option':'typedef-redefinition',
1613        'description':'Typedef redefinition',
1614        'patterns':[r".*: warning: redefinition of typedef '.+' is a C11 feature"] },
1615    { 'category':'logtags',   'severity':severity.LOW,     'members':[], 'option':'gnu-designator',
1616        'description':'GNU old-style field designator',
1617        'patterns':[r".*: warning: use of GNU old-style field designator extension"] },
1618    { 'category':'logtags',   'severity':severity.LOW,     'members':[], 'option':'missing-field-initializers',
1619        'description':'Missing field initializers',
1620        'patterns':[r".*: warning: missing field '.+' initializer"] },
1621    { 'category':'logtags',   'severity':severity.LOW,     'members':[], 'option':'missing-braces',
1622        'description':'Missing braces',
1623        'patterns':[r".*: warning: suggest braces around initialization of",
1624                    r".*: warning: too many braces around scalar initializer .+Wmany-braces-around-scalar-init",
1625                    r".*: warning: braces around scalar initializer"] },
1626    { 'category':'logtags',   'severity':severity.LOW,     'members':[], 'option':'sign-compare',
1627        'description':'Comparison of integers of different signs',
1628        'patterns':[r".*: warning: comparison of integers of different signs.+sign-compare"] },
1629    { 'category':'logtags',   'severity':severity.LOW,     'members':[], 'option':'dangling-else',
1630        'description':'Add braces to avoid dangling else',
1631        'patterns':[r".*: warning: add explicit braces to avoid dangling else"] },
1632    { 'category':'logtags',   'severity':severity.LOW,     'members':[], 'option':'initializer-overrides',
1633        'description':'Initializer overrides prior initialization',
1634        'patterns':[r".*: warning: initializer overrides prior initialization of this subobject"] },
1635    { 'category':'logtags',   'severity':severity.LOW,     'members':[], 'option':'self-assign',
1636        'description':'Assigning value to self',
1637        'patterns':[r".*: warning: explicitly assigning value of .+ to itself"] },
1638    { 'category':'logtags',   'severity':severity.LOW,     'members':[], 'option':'gnu-variable-sized-type-not-at-end',
1639        'description':'GNU extension, variable sized type not at end',
1640        'patterns':[r".*: warning: field '.+' with variable sized type '.+' not at the end of a struct or class"] },
1641    { 'category':'logtags',   'severity':severity.LOW,     'members':[], 'option':'tautological-constant-out-of-range-compare',
1642        'description':'Comparison of constant is always false/true',
1643        'patterns':[r".*: comparison of .+ is always .+Wtautological-constant-out-of-range-compare"] },
1644    { 'category':'logtags',   'severity':severity.LOW,     'members':[], 'option':'overloaded-virtual',
1645        'description':'Hides overloaded virtual function',
1646        'patterns':[r".*: '.+' hides overloaded virtual function"] },
1647    { 'category':'logtags',   'severity':severity.LOW,     'members':[], 'option':'incompatible-pointer-types',
1648        'description':'Incompatible pointer types',
1649        'patterns':[r".*: warning: incompatible pointer types .+Wincompatible-pointer-types"] },
1650    { 'category':'logtags',   'severity':severity.LOW,     'members':[], 'option':'asm-operand-widths',
1651        'description':'ASM value size does not match register size',
1652        'patterns':[r".*: warning: value size does not match register size specified by the constraint and modifier"] },
1653    { 'category':'C/C++',   'severity':severity.LOW,     'members':[], 'option':'tautological-compare',
1654        'description':'Comparison of self is always false',
1655        'patterns':[r".*: self-comparison always evaluates to false"] },
1656    { 'category':'C/C++',   'severity':severity.LOW,     'members':[], 'option':'constant-logical-operand',
1657        'description':'Logical op with constant operand',
1658        'patterns':[r".*: use of logical '.+' with constant operand"] },
1659    { 'category':'C/C++',   'severity':severity.LOW,     'members':[], 'option':'literal-suffix',
1660        'description':'Needs a space between literal and string macro',
1661        'patterns':[r".*: warning: invalid suffix on literal.+ requires a space .+Wliteral-suffix"] },
1662    { 'category':'C/C++',   'severity':severity.LOW,     'members':[], 'option':'#warnings',
1663        'description':'Warnings from #warning',
1664        'patterns':[r".*: warning: .+-W#warnings"] },
1665    { 'category':'C/C++',   'severity':severity.LOW,     'members':[], 'option':'absolute-value',
1666        'description':'Using float/int absolute value function with int/float argument',
1667        'patterns':[r".*: warning: using .+ absolute value function .+ when argument is .+ type .+Wabsolute-value",
1668                    r".*: warning: absolute value function '.+' given .+ which may cause truncation .+Wabsolute-value"] },
1669    { 'category':'C/C++',   'severity':severity.LOW,     'members':[], 'option':'-Wc++11-extensions',
1670        'description':'Using C++11 extensions',
1671        'patterns':[r".*: warning: 'auto' type specifier is a C\+\+11 extension"] },
1672    { 'category':'C/C++',   'severity':severity.LOW,     'members':[], 'option':'',
1673        'description':'Refers to implicitly defined namespace',
1674        'patterns':[r".*: warning: using directive refers to implicitly-defined namespace .+"] },
1675    { 'category':'C/C++',   'severity':severity.LOW,     'members':[], 'option':'-Winvalid-pp-token',
1676        'description':'Invalid pp token',
1677        'patterns':[r".*: warning: missing .+Winvalid-pp-token"] },
1678
1679    { 'category':'C/C++',   'severity':severity.MEDIUM,     'members':[], 'option':'',
1680        'description':'Operator new returns NULL',
1681        'patterns':[r".*: warning: 'operator new' must not return NULL unless it is declared 'throw\(\)' .+"] },
1682    { 'category':'C/C++',   'severity':severity.MEDIUM,     'members':[], 'option':'-Wnull-arithmetic',
1683        'description':'NULL used in arithmetic',
1684        'patterns':[r".*: warning: NULL used in arithmetic",
1685                    r".*: warning: comparison between NULL and non-pointer"] },
1686    { 'category':'C/C++',   'severity':severity.MEDIUM,     'members':[], 'option':'header-guard',
1687        'description':'Misspelled header guard',
1688        'patterns':[r".*: warning: '.+' is used as a header guard .+ followed by .+ different macro"] },
1689    { 'category':'C/C++',   'severity':severity.MEDIUM,     'members':[], 'option':'empty-body',
1690        'description':'Empty loop body',
1691        'patterns':[r".*: warning: .+ loop has empty body"] },
1692    { 'category':'C/C++',   'severity':severity.MEDIUM,     'members':[], 'option':'enum-conversion',
1693        'description':'Implicit conversion from enumeration type',
1694        'patterns':[r".*: warning: implicit conversion from enumeration type '.+'"] },
1695    { 'category':'C/C++',   'severity':severity.MEDIUM,     'members':[], 'option':'switch',
1696        'description':'case value not in enumerated type',
1697        'patterns':[r".*: warning: case value not in enumerated type '.+'"] },
1698    { 'category':'C/C++',   'severity':severity.MEDIUM,     'members':[], 'option':'',
1699        'description':'Undefined result',
1700        'patterns':[r".*: warning: The result of .+ is undefined",
1701                    r".*: warning: passing an object that .+ has undefined behavior \[-Wvarargs\]",
1702                    r".*: warning: 'this' pointer cannot be null in well-defined C\+\+ code;",
1703                    r".*: warning: shifting a negative signed value is undefined"] },
1704    { 'category':'C/C++',   'severity':severity.MEDIUM,     'members':[], 'option':'',
1705        'description':'Division by zero',
1706        'patterns':[r".*: warning: Division by zero"] },
1707    { 'category':'C/C++',   'severity':severity.MEDIUM,     'members':[], 'option':'',
1708        'description':'Use of deprecated method',
1709        'patterns':[r".*: warning: '.+' is deprecated .+"] },
1710    { 'category':'C/C++',   'severity':severity.MEDIUM,     'members':[], 'option':'',
1711        'description':'Use of garbage or uninitialized value',
1712        'patterns':[r".*: warning: .+ is a garbage value",
1713                    r".*: warning: Function call argument is an uninitialized value",
1714                    r".*: warning: Undefined or garbage value returned to caller",
1715                    r".*: warning: Called .+ pointer is.+uninitialized",
1716                    r".*: warning: Called .+ pointer is.+uninitalized",  # match a typo in compiler message
1717                    r".*: warning: Use of zero-allocated memory",
1718                    r".*: warning: Dereference of undefined pointer value",
1719                    r".*: warning: Passed-by-value .+ contains uninitialized data",
1720                    r".*: warning: Branch condition evaluates to a garbage value",
1721                    r".*: warning: The .+ of .+ is an uninitialized value.",
1722                    r".*: warning: .+ is used uninitialized whenever .+sometimes-uninitialized",
1723                    r".*: warning: Assigned value is garbage or undefined"] },
1724    { 'category':'C/C++',   'severity':severity.MEDIUM,     'members':[], 'option':'',
1725        'description':'Result of malloc type incompatible with sizeof operand type',
1726        'patterns':[r".*: warning: Result of '.+' is converted to .+ incompatible with sizeof operand type"] },
1727    { 'category':'C/C++',   'severity':severity.MEDIUM,     'members':[], 'option':'-Wsizeof-array-argument',
1728        'description':'Sizeof on array argument',
1729        'patterns':[r".*: warning: sizeof on array function parameter will return"] },
1730    { 'category':'C/C++',   'severity':severity.MEDIUM,     'members':[], 'option':'-Wsizeof-pointer-memacces',
1731        'description':'Bad argument size of memory access functions',
1732        'patterns':[r".*: warning: .+\[-Wsizeof-pointer-memaccess\]"] },
1733    { 'category':'C/C++',   'severity':severity.MEDIUM,     'members':[], 'option':'',
1734        'description':'Return value not checked',
1735        'patterns':[r".*: warning: The return value from .+ is not checked"] },
1736    { 'category':'C/C++',   'severity':severity.MEDIUM,     'members':[], 'option':'',
1737        'description':'Possible heap pollution',
1738        'patterns':[r".*: warning: .*Possible heap pollution from .+ type .+"] },
1739    { 'category':'C/C++',   'severity':severity.MEDIUM,     'members':[], 'option':'',
1740        'description':'Allocation size of 0 byte',
1741        'patterns':[r".*: warning: Call to .+ has an allocation size of 0 byte"] },
1742    { 'category':'C/C++',   'severity':severity.MEDIUM,     'members':[], 'option':'',
1743        'description':'Result of malloc type incompatible with sizeof operand type',
1744        'patterns':[r".*: warning: Result of '.+' is converted to .+ incompatible with sizeof operand type"] },
1745    { 'category':'C/C++',   'severity':severity.MEDIUM,     'members':[], 'option':'-Wfor-loop-analysis',
1746        'description':'Variable used in loop condition not modified in loop body',
1747        'patterns':[r".*: warning: variable '.+' used in loop condition.*Wfor-loop-analysis"] },
1748    { 'category':'C/C++',   'severity':severity.MEDIUM,     'members':[], 'option':'',
1749        'description':'Closing a previously closed file',
1750        'patterns':[r".*: warning: Closing a previously closed file"] },
1751
1752    { 'category':'C/C++',   'severity':severity.HARMLESS,     'members':[], 'option':'',
1753        'description':'Discarded qualifier from pointer target type',
1754        'patterns':[r".*: warning: .+ discards '.+' qualifier from pointer target type"] },
1755    { 'category':'C/C++',   'severity':severity.HARMLESS,     'members':[], 'option':'',
1756        'description':'Use snprintf instead of sprintf',
1757        'patterns':[r".*: warning: .*sprintf is often misused; please use snprintf"] },
1758    { 'category':'C/C++',   'severity':severity.HARMLESS,     'members':[], 'option':'',
1759        'description':'Unsupported optimizaton flag',
1760        'patterns':[r".*: warning: optimization flag '.+' is not supported"] },
1761    { 'category':'C/C++',   'severity':severity.HARMLESS,     'members':[], 'option':'',
1762        'description':'Extra or missing parentheses',
1763        'patterns':[r".*: warning: equality comparison with extraneous parentheses",
1764                    r".*: warning: .+ within .+Wlogical-op-parentheses"] },
1765    { 'category':'C/C++',   'severity':severity.HARMLESS,     'members':[], 'option':'mismatched-tags',
1766        'description':'Mismatched class vs struct tags',
1767        'patterns':[r".*: warning: '.+' defined as a .+ here but previously declared as a .+mismatched-tags",
1768                    r".*: warning: .+ was previously declared as a .+mismatched-tags"] },
1769
1770    # these next ones are to deal with formatting problems resulting from the log being mixed up by 'make -j'
1771    { 'category':'C/C++',   'severity':severity.SKIP,     'members':[], 'option':'',
1772        'description':'',
1773        'patterns':[r".*: warning: ,$"] },
1774    { 'category':'C/C++',   'severity':severity.SKIP,     'members':[], 'option':'',
1775        'description':'',
1776        'patterns':[r".*: warning: $"] },
1777    { 'category':'C/C++',   'severity':severity.SKIP,     'members':[], 'option':'',
1778        'description':'',
1779        'patterns':[r".*: warning: In file included from .+,"] },
1780
1781    # warnings from clang-tidy
1782    { 'category':'C/C++',   'severity':severity.TIDY,     'members':[], 'option':'',
1783        'description':'clang-tidy readability',
1784        'patterns':[r".*: .+\[readability-.+\]$"] },
1785    { 'category':'C/C++',   'severity':severity.TIDY,     'members':[], 'option':'',
1786        'description':'clang-tidy c++ core guidelines',
1787        'patterns':[r".*: .+\[cppcoreguidelines-.+\]$"] },
1788    { 'category':'C/C++',   'severity':severity.TIDY,     'members':[], 'option':'',
1789        'description':'clang-tidy google-default-arguments',
1790        'patterns':[r".*: .+\[google-default-arguments\]$"] },
1791    { 'category':'C/C++',   'severity':severity.TIDY,     'members':[], 'option':'',
1792        'description':'clang-tidy google-runtime-int',
1793        'patterns':[r".*: .+\[google-runtime-int\]$"] },
1794    { 'category':'C/C++',   'severity':severity.TIDY,     'members':[], 'option':'',
1795        'description':'clang-tidy google-runtime-operator',
1796        'patterns':[r".*: .+\[google-runtime-operator\]$"] },
1797    { 'category':'C/C++',   'severity':severity.TIDY,     'members':[], 'option':'',
1798        'description':'clang-tidy google-runtime-references',
1799        'patterns':[r".*: .+\[google-runtime-references\]$"] },
1800    { 'category':'C/C++',   'severity':severity.TIDY,     'members':[], 'option':'',
1801        'description':'clang-tidy google-build',
1802        'patterns':[r".*: .+\[google-build-.+\]$"] },
1803    { 'category':'C/C++',   'severity':severity.TIDY,     'members':[], 'option':'',
1804        'description':'clang-tidy google-explicit',
1805        'patterns':[r".*: .+\[google-explicit-.+\]$"] },
1806    { 'category':'C/C++',   'severity':severity.TIDY,     'members':[], 'option':'',
1807        'description':'clang-tidy google-readability',
1808        'patterns':[r".*: .+\[google-readability-.+\]$"] },
1809    { 'category':'C/C++',   'severity':severity.TIDY,     'members':[], 'option':'',
1810        'description':'clang-tidy google-global',
1811        'patterns':[r".*: .+\[google-global-.+\]$"] },
1812    { 'category':'C/C++',   'severity':severity.TIDY,     'members':[], 'option':'',
1813        'description':'clang-tidy google- other',
1814        'patterns':[r".*: .+\[google-.+\]$"] },
1815    { 'category':'C/C++',   'severity':severity.TIDY,     'members':[], 'option':'',
1816        'description':'clang-tidy modernize',
1817        'patterns':[r".*: .+\[modernize-.+\]$"] },
1818    { 'category':'C/C++',   'severity':severity.TIDY,     'members':[], 'option':'',
1819        'description':'clang-tidy misc',
1820        'patterns':[r".*: .+\[misc-.+\]$"] },
1821    { 'category':'C/C++',   'severity':severity.TIDY,     'members':[], 'option':'',
1822        'description':'clang-tidy performance-faster-string-find',
1823        'patterns':[r".*: .+\[performance-faster-string-find\]$"] },
1824    { 'category':'C/C++',   'severity':severity.TIDY,     'members':[], 'option':'',
1825        'description':'clang-tidy performance-for-range-copy',
1826        'patterns':[r".*: .+\[performance-for-range-copy\]$"] },
1827    { 'category':'C/C++',   'severity':severity.TIDY,     'members':[], 'option':'',
1828        'description':'clang-tidy performance-implicit-cast-in-loop',
1829        'patterns':[r".*: .+\[performance-implicit-cast-in-loop\]$"] },
1830    { 'category':'C/C++',   'severity':severity.TIDY,     'members':[], 'option':'',
1831        'description':'clang-tidy performance-unnecessary-copy-initialization',
1832        'patterns':[r".*: .+\[performance-unnecessary-copy-initialization\]$"] },
1833    { 'category':'C/C++',   'severity':severity.TIDY,     'members':[], 'option':'',
1834        'description':'clang-tidy performance-unnecessary-value-param',
1835        'patterns':[r".*: .+\[performance-unnecessary-value-param\]$"] },
1836    { 'category':'C/C++',   'severity':severity.TIDY,     'members':[], 'option':'',
1837        'description':'clang-analyzer Unreachable code',
1838        'patterns':[r".*: warning: This statement is never executed.*UnreachableCode"] },
1839    { 'category':'C/C++',   'severity':severity.TIDY,     'members':[], 'option':'',
1840        'description':'clang-analyzer Size of malloc may overflow',
1841        'patterns':[r".*: warning: .* size of .* may overflow .*MallocOverflow"] },
1842    { 'category':'C/C++',   'severity':severity.TIDY,     'members':[], 'option':'',
1843        'description':'clang-analyzer Stream pointer might be NULL',
1844        'patterns':[r".*: warning: Stream pointer might be NULL .*unix.Stream"] },
1845    { 'category':'C/C++',   'severity':severity.TIDY,     'members':[], 'option':'',
1846        'description':'clang-analyzer Opened file never closed',
1847        'patterns':[r".*: warning: Opened File never closed.*unix.Stream"] },
1848    { 'category':'C/C++',   'severity':severity.TIDY,     'members':[], 'option':'',
1849        'description':'clang-analyzer sozeof() on a pointer type',
1850        'patterns':[r".*: warning: .*calls sizeof.* on a pointer type.*SizeofPtr"] },
1851    { 'category':'C/C++',   'severity':severity.TIDY,     'members':[], 'option':'',
1852        'description':'clang-analyzer Pointer arithmetic on non-array variables',
1853        'patterns':[r".*: warning: Pointer arithmetic on non-array variables .*PointerArithm"] },
1854    { 'category':'C/C++',   'severity':severity.TIDY,     'members':[], 'option':'',
1855        'description':'clang-analyzer Subtraction of pointers of different memory chunks',
1856        'patterns':[r".*: warning: Subtraction of two pointers .*PointerSub"] },
1857    { 'category':'C/C++',   'severity':severity.TIDY,     'members':[], 'option':'',
1858        'description':'clang-analyzer Access out-of-bound array element',
1859        'patterns':[r".*: warning: Access out-of-bound array element .*ArrayBound"] },
1860    { 'category':'C/C++',   'severity':severity.TIDY,     'members':[], 'option':'',
1861        'description':'clang-analyzer Out of bound memory access',
1862        'patterns':[r".*: warning: Out of bound memory access .*ArrayBoundV2"] },
1863    { 'category':'C/C++',   'severity':severity.TIDY,     'members':[], 'option':'',
1864        'description':'clang-analyzer Possible lock order reversal',
1865        'patterns':[r".*: warning: .* Possible lock order reversal.*PthreadLock"] },
1866    { 'category':'C/C++',   'severity':severity.TIDY,     'members':[], 'option':'',
1867        'description':'clang-analyzer Argument is a pointer to uninitialized value',
1868        'patterns':[r".*: warning: .* argument is a pointer to uninitialized value .*CallAndMessage"] },
1869    { 'category':'C/C++',   'severity':severity.TIDY,     'members':[], 'option':'',
1870        'description':'clang-analyzer cast to struct',
1871        'patterns':[r".*: warning: Casting a non-structure type to a structure type .*CastToStruct"] },
1872    { 'category':'C/C++',   'severity':severity.TIDY,     'members':[], 'option':'',
1873        'description':'clang-analyzer call path problems',
1874        'patterns':[r".*: warning: Call Path : .+"] },
1875    { 'category':'C/C++',   'severity':severity.TIDY,     'members':[], 'option':'',
1876        'description':'clang-analyzer other',
1877        'patterns':[r".*: .+\[clang-analyzer-.+\]$",
1878                    r".*: Call Path : .+$"] },
1879    { 'category':'C/C++',   'severity':severity.TIDY,     'members':[], 'option':'',
1880        'description':'clang-tidy CERT',
1881        'patterns':[r".*: .+\[cert-.+\]$"] },
1882    { 'category':'C/C++',   'severity':severity.TIDY,     'members':[], 'option':'',
1883        'description':'clang-tidy llvm',
1884        'patterns':[r".*: .+\[llvm-.+\]$"] },
1885    { 'category':'C/C++',   'severity':severity.TIDY,     'members':[], 'option':'',
1886        'description':'clang-diagnostic',
1887        'patterns':[r".*: .+\[clang-diagnostic-.+\]$"] },
1888
1889    # catch-all for warnings this script doesn't know about yet
1890    { 'category':'C/C++',   'severity':severity.UNKNOWN,  'members':[], 'option':'',
1891        'description':'Unclassified/unrecognized warnings',
1892        'patterns':[r".*: warning: .+"] },
1893]
1894
1895# A list of [project_name, file_path_pattern].
1896# project_name should not contain comma, to be used in CSV output.
1897projectlist = [
1898    ['art',                 r"(^|.*/)art/.*: warning:"],
1899    ['bionic',              r"(^|.*/)bionic/.*: warning:"],
1900    ['bootable',            r"(^|.*/)bootable/.*: warning:"],
1901    ['build',               r"(^|.*/)build/.*: warning:"],
1902    ['cts',                 r"(^|.*/)cts/.*: warning:"],
1903    ['dalvik',              r"(^|.*/)dalvik/.*: warning:"],
1904    ['developers',          r"(^|.*/)developers/.*: warning:"],
1905    ['development',         r"(^|.*/)development/.*: warning:"],
1906    ['device',              r"(^|.*/)device/.*: warning:"],
1907    ['doc',                 r"(^|.*/)doc/.*: warning:"],
1908    # match external/google* before external/
1909    ['external/google',     r"(^|.*/)external/google.*: warning:"],
1910    ['external/non-google', r"(^|.*/)external/.*: warning:"],
1911    ['frameworks',          r"(^|.*/)frameworks/.*: warning:"],
1912    ['hardware',            r"(^|.*/)hardware/.*: warning:"],
1913    ['kernel',              r"(^|.*/)kernel/.*: warning:"],
1914    ['libcore',             r"(^|.*/)libcore/.*: warning:"],
1915    ['libnativehelper',      r"(^|.*/)libnativehelper/.*: warning:"],
1916    ['ndk',                 r"(^|.*/)ndk/.*: warning:"],
1917    ['packages',            r"(^|.*/)packages/.*: warning:"],
1918    ['pdk',                 r"(^|.*/)pdk/.*: warning:"],
1919    ['prebuilts',           r"(^|.*/)prebuilts/.*: warning:"],
1920    ['system',              r"(^|.*/)system/.*: warning:"],
1921    ['toolchain',           r"(^|.*/)toolchain/.*: warning:"],
1922    ['test',                r"(^|.*/)test/.*: warning:"],
1923    ['tools',               r"(^|.*/)tools/.*: warning:"],
1924    # match vendor/google* before vendor/
1925    ['vendor/google',       r"(^|.*/)vendor/google.*: warning:"],
1926    ['vendor/non-google',   r"(^|.*/)vendor/.*: warning:"],
1927    # keep out/obj and other patterns at the end.
1928    ['out/obj', r".*/(gen|obj[^/]*)/(include|EXECUTABLES|SHARED_LIBRARIES|STATIC_LIBRARIES)/.*: warning:"],
1929    ['other',   r".*: warning:"],
1930]
1931
1932projectpatterns = []
1933for p in projectlist:
1934    projectpatterns.append({'description':p[0], 'members':[], 'pattern':re.compile(p[1])})
1935
1936projectnames = [p[0] for p in projectlist]
1937
1938# Each warning pattern has 3 dictionaries:
1939# (1) 'projects' maps a project name to number of warnings in that project.
1940# (2) 'projectanchor' maps a project name to its anchor number for HTML.
1941# (3) 'projectwarning' maps a project name to a list of warning of that project.
1942for w in warnpatterns:
1943    w['projects'] = {}
1944    w['projectanchor'] = {}
1945    w['projectwarning'] = {}
1946
1947platformversion = 'unknown'
1948targetproduct = 'unknown'
1949targetvariant = 'unknown'
1950
1951
1952##### Data and functions to dump html file. ##################################
1953
1954anchor = 0
1955cur_row_class = 0
1956
1957html_script_style = """\
1958    <script type="text/javascript">
1959    function expand(id) {
1960      var e = document.getElementById(id);
1961      var f = document.getElementById(id + "_mark");
1962      if (e.style.display == 'block') {
1963         e.style.display = 'none';
1964         f.innerHTML = '&#x2295';
1965      }
1966      else {
1967         e.style.display = 'block';
1968         f.innerHTML = '&#x2296';
1969      }
1970    };
1971    function expand_collapse(show) {
1972      for (var id = 1; ; id++) {
1973        var e = document.getElementById(id + "");
1974        var f = document.getElementById(id + "_mark");
1975        if (!e || !f) break;
1976        e.style.display = (show ? 'block' : 'none');
1977        f.innerHTML = (show ? '&#x2296' : '&#x2295');
1978      }
1979    };
1980    </script>
1981    <style type="text/css">
1982    th,td{border-collapse:collapse; border:1px solid black;}
1983    .button{color:blue;font-size:110%;font-weight:bolder;}
1984    .bt{color:black;background-color:transparent;border:none;outline:none;
1985        font-size:140%;font-weight:bolder;}
1986    .c0{background-color:#e0e0e0;}
1987    .c1{background-color:#d0d0d0;}
1988    .t1{border-collapse:collapse; width:100%; border:1px solid black;}
1989    </style>\n"""
1990
1991
1992def output(text):
1993    print text,
1994
1995def htmlbig(param):
1996    return '<font size="+2">' + param + '</font>'
1997
1998def dumphtmlprologue(title):
1999    output('<html>\n<head>\n')
2000    output('<title>' + title + '</title>\n')
2001    output(html_script_style)
2002    output('</head>\n<body>\n')
2003    output(htmlbig(title))
2004    output('<p>\n')
2005
2006def dumphtmlepilogue():
2007    output('</body>\n</head>\n</html>\n')
2008
2009def tablerow(text):
2010    global cur_row_class
2011    output('<tr><td class="c' + str(cur_row_class) + '">')
2012    cur_row_class = 1 - cur_row_class
2013    output(text)
2014    output('</td></tr>')
2015
2016def sortwarnings():
2017    for i in warnpatterns:
2018        i['members'] = sorted(set(i['members']))
2019
2020# dump a table of warnings per project and severity
2021def dumpstatsbyproject():
2022    projects = set(projectnames)
2023    severities = set(severity.kinds)
2024
2025    # warnings[p][s] is number of warnings in project p of severity s.
2026    warnings = {p:{s:0 for s in severity.kinds} for p in projectnames}
2027    for i in warnpatterns:
2028        s = i['severity']
2029        for p in i['projects']:
2030            warnings[p][s] += i['projects'][p]
2031
2032    # totalbyseverity[s] is number of warnings of severity s.
2033    totalbyseverity = {s:0 for s in severity.kinds}
2034
2035    # emit table header
2036    output('<blockquote><table border=1>\n<tr><th></th>\n')
2037    for s in severity.kinds:
2038        output('<th width="8%"><span style="background-color:{}">{}</span></th>'.
2039               format(colorforseverity(s), columnheaderforseverity(s)))
2040    output('<th>TOTAL</th></tr>\n')
2041
2042    # emit a row of warnings per project
2043    totalallprojects = 0
2044    for p in projectnames:
2045        totalbyproject = 0
2046        output('<tr><td align="left">{}</td>'.format(p))
2047        for s in severity.kinds:
2048            output('<td align="right">{}</td>'.format(warnings[p][s]))
2049            totalbyproject += warnings[p][s]
2050            totalbyseverity[s] += warnings[p][s]
2051        output('<td align="right">{}</td>'.format(totalbyproject))
2052        totalallprojects += totalbyproject
2053        output('</tr>\n')
2054
2055    # emit a row of warning counts per severity
2056    totalallseverities = 0
2057    output('<tr><td align="right">TOTAL</td>')
2058    for s in severity.kinds:
2059        output('<td align="right">{}</td>'.format(totalbyseverity[s]))
2060        totalallseverities += totalbyseverity[s]
2061    output('<td align="right">{}</td></tr>\n'.format(totalallprojects))
2062
2063    # at the end of table, verify total counts
2064    output('</table></blockquote><br>\n')
2065    if totalallprojects != totalallseverities:
2066        output('<h3>ERROR: Sum of warnings by project ' +
2067               '!= Sum of warnings by severity.</h3>\n')
2068
2069# dump some stats about total number of warnings and such
2070def dumpstats():
2071    known = 0
2072    skipped = 0
2073    unknown = 0
2074    sortwarnings()
2075    for i in warnpatterns:
2076        if i['severity'] == severity.UNKNOWN:
2077            unknown += len(i['members'])
2078        elif i['severity'] == severity.SKIP:
2079            skipped += len(i['members'])
2080        else:
2081            known += len(i['members'])
2082    output('\nNumber of classified warnings: <b>' + str(known) + '</b><br>' )
2083    output('\nNumber of skipped warnings: <b>' + str(skipped) + '</b><br>')
2084    output('\nNumber of unclassified warnings: <b>' + str(unknown) + '</b><br>')
2085    total = unknown + known + skipped
2086    output('\nTotal number of warnings: <b>' + str(total) + '</b>')
2087    if total < 1000:
2088        output('(low count may indicate incremental build)')
2089    output('<br><br>\n')
2090
2091def emitbuttons():
2092    output('<button class="button" onclick="expand_collapse(1);">' +
2093           'Expand all warnings</button>\n' +
2094           '<button class="button" onclick="expand_collapse(0);">' +
2095           'Collapse all warnings</button><br>\n')
2096
2097# dump everything for a given severity
2098def dumpseverity(sev):
2099    global anchor
2100    total = 0
2101    for i in warnpatterns:
2102        if i['severity'] == sev:
2103            total = total + len(i['members'])
2104    output('\n<br><span style="background-color:' + colorforseverity(sev) + '"><b>' +
2105           headerforseverity(sev) + ': ' + str(total) + '</b></span>\n')
2106    output('<blockquote>\n')
2107    for i in warnpatterns:
2108        if i['severity'] == sev and len(i['members']) > 0:
2109            anchor += 1
2110            i['anchor'] = str(anchor)
2111            if args.byproject:
2112                dumpcategorybyproject(sev, i)
2113            else:
2114                dumpcategory(sev, i)
2115    output('</blockquote>\n')
2116
2117# emit all skipped project anchors for expand_collapse.
2118def dumpskippedanchors():
2119    output('<div style="display:none;">\n')  # hide these fake elements
2120    for i in warnpatterns:
2121        if i['severity'] == severity.SKIP and len(i['members']) > 0:
2122            projects = i['projectwarning'].keys()
2123            for p in projects:
2124                output('<div id="' + i['projectanchor'][p] + '"></div>' +
2125                       '<div id="' + i['projectanchor'][p] + '_mark"></div>\n')
2126    output('</div>\n')
2127
2128def allpatterns(cat):
2129    pats = ''
2130    for i in cat['patterns']:
2131        pats += i
2132        pats += ' / '
2133    return pats
2134
2135def descriptionfor(cat):
2136    if cat['description'] != '':
2137        return cat['description']
2138    return allpatterns(cat)
2139
2140
2141# show which warnings no longer occur
2142def dumpfixed():
2143    global anchor
2144    anchor += 1
2145    mark = str(anchor) + '_mark'
2146    output('\n<br><p style="background-color:lightblue"><b>' +
2147           '<button id="' + mark + '" ' +
2148           'class="bt" onclick="expand(' + str(anchor) + ');">' +
2149           '&#x2295</button> Fixed warnings. ' +
2150           'No more occurences. Please consider turning these into ' +
2151           'errors if possible, before they are reintroduced in to the build' +
2152           ':</b></p>\n')
2153    output('<blockquote>\n')
2154    fixed_patterns = []
2155    for i in warnpatterns:
2156        if len(i['members']) == 0:
2157            fixed_patterns.append(i['description'] + ' (' +
2158                                  allpatterns(i) + ') ' + i['option'])
2159    fixed_patterns.sort()
2160    output('<div id="' + str(anchor) + '" style="display:none;"><table>\n')
2161    for i in fixed_patterns:
2162        tablerow(i)
2163    output('</table></div>\n')
2164    output('</blockquote>\n')
2165
2166def warningwithurl(line):
2167    if not args.url:
2168        return line
2169    m = re.search( r'^([^ :]+):(\d+):(.+)', line, re.M|re.I)
2170    if not m:
2171        return line
2172    filepath = m.group(1)
2173    linenumber = m.group(2)
2174    warning = m.group(3)
2175    if args.separator:
2176        return '<a href="' + args.url + '/' + filepath + args.separator + linenumber + '">' + filepath + ':' + linenumber + '</a>:' + warning
2177    else:
2178        return '<a href="' + args.url + '/' + filepath + '">' + filepath + '</a>:' + linenumber + ':' + warning
2179
2180def dumpgroup(sev, anchor, description, warnings):
2181    mark = anchor + '_mark'
2182    output('\n<table class="t1">\n')
2183    output('<tr bgcolor="' + colorforseverity(sev) + '">' +
2184           '<td><button class="bt" id="' + mark +
2185           '" onclick="expand(\'' + anchor + '\');">' +
2186           '&#x2295</button> ' + description + '</td></tr>\n')
2187    output('</table>\n')
2188    output('<div id="' + anchor + '" style="display:none;">')
2189    output('<table class="t1">\n')
2190    for i in warnings:
2191        tablerow(warningwithurl(i))
2192    output('</table></div>\n')
2193
2194# dump warnings in a category
2195def dumpcategory(sev, cat):
2196    description = descriptionfor(cat) + ' (' + str(len(cat['members'])) + ')'
2197    dumpgroup(sev, cat['anchor'], description, cat['members'])
2198
2199# similar to dumpcategory but output one table per project.
2200def dumpcategorybyproject(sev, cat):
2201    warning = descriptionfor(cat)
2202    projects = cat['projectwarning'].keys()
2203    projects.sort()
2204    for p in projects:
2205        anchor = cat['projectanchor'][p]
2206        projectwarnings = cat['projectwarning'][p]
2207        description = '{}, in {} ({})'.format(warning, p, len(projectwarnings))
2208        dumpgroup(sev, anchor, description, projectwarnings)
2209
2210def findproject(line):
2211    for p in projectpatterns:
2212        if p['pattern'].match(line):
2213            return p['description']
2214    return '???'
2215
2216def classifywarning(line):
2217    global anchor
2218    for i in warnpatterns:
2219        for cpat in i['compiledpatterns']:
2220            if cpat.match(line):
2221                i['members'].append(line)
2222                pname = findproject(line)
2223                # Count warnings by project.
2224                if pname in i['projects']:
2225                    i['projects'][pname] += 1
2226                else:
2227                    i['projects'][pname] = 1
2228                # Collect warnings by project.
2229                if args.byproject:
2230                    if pname in i['projectwarning']:
2231                        i['projectwarning'][pname].append(line)
2232                    else:
2233                        i['projectwarning'][pname] = [line]
2234                    if pname not in i['projectanchor']:
2235                        anchor += 1
2236                        i['projectanchor'][pname] = str(anchor)
2237                return
2238            else:
2239                # If we end up here, there was a problem parsing the log
2240                # probably caused by 'make -j' mixing the output from
2241                # 2 or more concurrent compiles
2242                pass
2243
2244# precompiling every pattern speeds up parsing by about 30x
2245def compilepatterns():
2246    for i in warnpatterns:
2247        i['compiledpatterns'] = []
2248        for pat in i['patterns']:
2249            i['compiledpatterns'].append(re.compile(pat))
2250
2251def parseinputfile():
2252    global platformversion
2253    global targetproduct
2254    global targetvariant
2255    infile = open(args.buildlog, 'r')
2256    linecounter = 0
2257
2258    warningpattern = re.compile('.* warning:.*')
2259    compilepatterns()
2260
2261    # read the log file and classify all the warnings
2262    warninglines = set()
2263    for line in infile:
2264        # replace fancy quotes with plain ol' quotes
2265        line = line.replace("‘", "'");
2266        line = line.replace("’", "'");
2267        if warningpattern.match(line):
2268            if line not in warninglines:
2269                classifywarning(line)
2270                warninglines.add(line)
2271        else:
2272            # save a little bit of time by only doing this for the first few lines
2273            if linecounter < 50:
2274                linecounter +=1
2275                m = re.search('(?<=^PLATFORM_VERSION=).*', line)
2276                if m != None:
2277                    platformversion = m.group(0)
2278                m = re.search('(?<=^TARGET_PRODUCT=).*', line)
2279                if m != None:
2280                    targetproduct = m.group(0)
2281                m = re.search('(?<=^TARGET_BUILD_VARIANT=).*', line)
2282                if m != None:
2283                    targetvariant = m.group(0)
2284
2285
2286# dump the html output to stdout
2287def dumphtml():
2288    dumphtmlprologue('Warnings for ' + platformversion + ' - ' + targetproduct + ' - ' + targetvariant)
2289    dumpstats()
2290    dumpstatsbyproject()
2291    emitbuttons()
2292    # sort table based on number of members once dumpstats has deduplicated the
2293    # members.
2294    warnpatterns.sort(reverse=True, key=lambda i: len(i['members']))
2295    # Dump warnings by severity. If severity.SKIP warnings are not dumpped,
2296    # the project anchors should be dumped through dumpskippedanchors.
2297    for s in severity.kinds:
2298        dumpseverity(s)
2299    dumpfixed()
2300    dumphtmlepilogue()
2301
2302
2303##### Functions to count warnings and dump csv file. #########################
2304
2305def descriptionforcsv(cat):
2306    if cat['description'] == '':
2307        return '?'
2308    return cat['description']
2309
2310def stringforcsv(s):
2311    if ',' in s:
2312        return '"{}"'.format(s)
2313    return s
2314
2315def countseverity(sev, kind):
2316  sum = 0
2317  for i in warnpatterns:
2318      if i['severity'] == sev and len(i['members']) > 0:
2319          n = len(i['members'])
2320          sum += n
2321          warning = stringforcsv(kind + ': ' + descriptionforcsv(i))
2322          print '{},,{}'.format(n, warning)
2323          # print number of warnings for each project, ordered by project name.
2324          projects = i['projects'].keys()
2325          projects.sort()
2326          for p in projects:
2327              print '{},{},{}'.format(i['projects'][p], p, warning)
2328  print '{},,{}'.format(sum, kind + ' warnings')
2329  return sum
2330
2331# dump number of warnings in csv format to stdout
2332def dumpcsv():
2333    sortwarnings()
2334    total = 0
2335    for s in severity.kinds:
2336        total += countseverity(s, columnheaderforseverity(s))
2337    print '{},,{}'.format(total, 'All warnings')
2338
2339
2340parseinputfile()
2341if args.gencsv:
2342    dumpcsv()
2343else:
2344    dumphtml()
2345