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