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