blob: f18a54d488adf04d69022eeecef0a2af5888ee8a [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
Chih-Hung Hsieh99459fc2016-09-22 13:43:12 -070035 SKIP = 7
36 attributes = [
37 ['lightblue', 'Unknown', 'Unknown warnings'],
38 ['fuchsia', 'FixNow', 'Critical warnings, fix me now'],
39 ['red', 'High', 'High severity warnings'],
40 ['orange', 'Medium', 'Medium severity warnings'],
41 ['yellow', 'Low', 'Low severity warnings'],
42 ['peachpuff', 'Tidy', 'Clang-Tidy warnings'],
43 ['limegreen', 'Harmless', 'Harmless warnings'],
44 ['grey', 'Unhandled', 'Unhandled warnings']
45 ]
46 color = [a[0] for a in attributes]
47 columnheader = [a[1] for a in attributes]
48 header = [a[2] for a in attributes]
49 # order to dump by severity
Chih-Hung Hsiehe41c99b2016-09-12 16:20:49 -070050 kinds = [FIXMENOW, HIGH, MEDIUM, LOW, TIDY, HARMLESS, UNKNOWN, SKIP]
Marco Nelissen594375d2009-07-14 09:04:04 -070051
Marco Nelissen594375d2009-07-14 09:04:04 -070052warnpatterns = [
Chih-Hung Hsieh99459fc2016-09-22 13:43:12 -070053 { 'category':'make', 'severity':severity.MEDIUM,
Marco Nelissen594375d2009-07-14 09:04:04 -070054 'description':'make: overriding commands/ignoring old commands',
55 'patterns':[r".*: warning: overriding commands for target .+",
56 r".*: warning: ignoring old commands for target .+"] },
Chih-Hung Hsieh99459fc2016-09-22 13:43:12 -070057 { 'category':'make', 'severity':severity.HIGH,
Chih-Hung Hsiehd9cd1fa2016-08-02 14:22:06 -070058 'description':'make: LOCAL_CLANG is false',
59 'patterns':[r".*: warning: LOCAL_CLANG is set to false"] },
Chih-Hung Hsieh99459fc2016-09-22 13:43:12 -070060 { 'category':'make', 'severity':severity.HIGH,
Dan Willemsen121e2842016-09-14 21:38:29 -070061 'description':'SDK App using platform shared library',
62 'patterns':[r".*: warning: .+ \(.*app:sdk.*\) should not link to .+ \(native:platform\)"] },
Chih-Hung Hsieh99459fc2016-09-22 13:43:12 -070063 { 'category':'make', 'severity':severity.HIGH,
Dan Willemsen121e2842016-09-14 21:38:29 -070064 'description':'System module linking to a vendor module',
65 'patterns':[r".*: warning: .+ \(.+\) should not link to .+ \(partition:.+\)"] },
Chih-Hung Hsieh99459fc2016-09-22 13:43:12 -070066 { 'category':'make', 'severity':severity.MEDIUM,
Dan Willemsen121e2842016-09-14 21:38:29 -070067 'description':'Invalid SDK/NDK linking',
68 'patterns':[r".*: warning: .+ \(.+\) should not link to .+ \(.+\)"] },
Chih-Hung Hsieh99459fc2016-09-22 13:43:12 -070069 { 'category':'C/C++', 'severity':severity.HIGH, 'option':'-Wimplicit-function-declaration',
Marco Nelissen594375d2009-07-14 09:04:04 -070070 'description':'Implicit function declaration',
Chih-Hung Hsieh8d145432016-07-01 15:48:06 -070071 'patterns':[r".*: warning: implicit declaration of function .+",
72 r".*: warning: implicitly declaring library function" ] },
Chih-Hung Hsieh99459fc2016-09-22 13:43:12 -070073 { 'category':'C/C++', 'severity':severity.SKIP,
Marco Nelissen594375d2009-07-14 09:04:04 -070074 'description':'',
75 'patterns':[r".*: warning: conflicting types for '.+'"] },
Chih-Hung Hsieh99459fc2016-09-22 13:43:12 -070076 { 'category':'C/C++', 'severity':severity.HIGH, 'option':'-Wtype-limits',
Marco Nelissen594375d2009-07-14 09:04:04 -070077 'description':'Expression always evaluates to true or false',
Chih-Hung Hsiehf8aaf602016-03-16 12:18:16 -070078 'patterns':[r".*: warning: comparison is always .+ due to limited range of data type",
Chih-Hung Hsiehba0ddcd2016-03-21 11:28:30 -070079 r".*: warning: comparison of unsigned .*expression .+ is always true",
80 r".*: warning: comparison of unsigned .*expression .+ is always false"] },
Chih-Hung Hsieh99459fc2016-09-22 13:43:12 -070081 { 'category':'C/C++', 'severity':severity.HIGH,
Chih-Hung Hsiehf8aaf602016-03-16 12:18:16 -070082 'description':'Potential leak of memory, bad free, use after free',
83 'patterns':[r".*: warning: Potential leak of memory",
84 r".*: warning: Potential memory leak",
Chih-Hung Hsieh8d145432016-07-01 15:48:06 -070085 r".*: warning: Memory allocated by alloca\(\) should not be deallocated",
Chih-Hung Hsiehf8aaf602016-03-16 12:18:16 -070086 r".*: warning: Memory allocated by .+ should be deallocated by .+ not .+",
87 r".*: warning: 'delete' applied to a pointer that was allocated",
88 r".*: warning: Use of memory after it is freed",
89 r".*: warning: Argument to .+ is the address of .+ variable",
90 r".*: warning: Argument to free\(\) is offset by .+ of memory allocated by",
91 r".*: warning: Attempt to .+ released memory"] },
Chih-Hung Hsieh99459fc2016-09-22 13:43:12 -070092 { 'category':'C/C++', 'severity':severity.HIGH,
Chih-Hung Hsieh8d145432016-07-01 15:48:06 -070093 'description':'Use transient memory for control value',
94 'patterns':[r".*: warning: .+Using such transient memory for the control value is .*dangerous."] },
Chih-Hung Hsieh99459fc2016-09-22 13:43:12 -070095 { 'category':'C/C++', 'severity':severity.HIGH,
Chih-Hung Hsiehf8aaf602016-03-16 12:18:16 -070096 'description':'Return address of stack memory',
Chih-Hung Hsiehba0ddcd2016-03-21 11:28:30 -070097 'patterns':[r".*: warning: Address of stack memory .+ returned to caller",
98 r".*: warning: Address of stack memory .+ will be a dangling reference"] },
Chih-Hung Hsieh99459fc2016-09-22 13:43:12 -070099 { 'category':'C/C++', 'severity':severity.HIGH,
Chih-Hung Hsiehf8aaf602016-03-16 12:18:16 -0700100 'description':'Problem with vfork',
101 'patterns':[r".*: warning: This .+ is prohibited after a successful vfork",
Chih-Hung Hsieh8d145432016-07-01 15:48:06 -0700102 r".*: warning: Call to function '.+' is insecure "] },
Chih-Hung Hsieh99459fc2016-09-22 13:43:12 -0700103 { 'category':'C/C++', 'severity':severity.HIGH, 'option':'infinite-recursion',
Chih-Hung Hsiehf8aaf602016-03-16 12:18:16 -0700104 'description':'Infinite recursion',
105 'patterns':[r".*: warning: all paths through this function will call itself"] },
Chih-Hung Hsieh99459fc2016-09-22 13:43:12 -0700106 { 'category':'C/C++', 'severity':severity.HIGH,
Chih-Hung Hsiehf8aaf602016-03-16 12:18:16 -0700107 'description':'Potential buffer overflow',
108 'patterns':[r".*: warning: Size argument is greater than .+ the destination buffer",
109 r".*: warning: Potential buffer overflow.",
110 r".*: warning: String copy function overflows destination buffer"] },
Chih-Hung Hsieh99459fc2016-09-22 13:43:12 -0700111 { 'category':'C/C++', 'severity':severity.MEDIUM,
Marco Nelissen594375d2009-07-14 09:04:04 -0700112 'description':'Incompatible pointer types',
113 'patterns':[r".*: warning: assignment from incompatible pointer type",
Marco Nelissen8e201962010-03-10 16:16:02 -0800114 r".*: warning: return from incompatible pointer type",
Marco Nelissen594375d2009-07-14 09:04:04 -0700115 r".*: warning: passing argument [0-9]+ of '.*' from incompatible pointer type",
116 r".*: warning: initialization from incompatible pointer type"] },
Chih-Hung Hsieh99459fc2016-09-22 13:43:12 -0700117 { 'category':'C/C++', 'severity':severity.HIGH, 'option':'-fno-builtin',
Marco Nelissen594375d2009-07-14 09:04:04 -0700118 'description':'Incompatible declaration of built in function',
119 'patterns':[r".*: warning: incompatible implicit declaration of built-in function .+"] },
Chih-Hung Hsieh99459fc2016-09-22 13:43:12 -0700120 { 'category':'C/C++', 'severity':severity.HIGH, 'option':'-Wincompatible-library-redeclaration',
Chih-Hung Hsieh0862c482016-09-06 16:26:46 -0700121 'description':'Incompatible redeclaration of library function',
122 'patterns':[r".*: warning: incompatible redeclaration of library function .+"] },
Chih-Hung Hsieh99459fc2016-09-22 13:43:12 -0700123 { 'category':'C/C++', 'severity':severity.HIGH,
Chih-Hung Hsieh8d145432016-07-01 15:48:06 -0700124 'description':'Null passed as non-null argument',
Chih-Hung Hsiehc21ddbd2016-07-20 10:08:51 -0700125 'patterns':[r".*: warning: Null passed to a callee that requires a non-null"] },
Chih-Hung Hsieh99459fc2016-09-22 13:43:12 -0700126 { 'category':'C/C++', 'severity':severity.MEDIUM, 'option':'-Wunused-parameter',
Marco Nelissen594375d2009-07-14 09:04:04 -0700127 'description':'Unused parameter',
128 'patterns':[r".*: warning: unused parameter '.*'"] },
Chih-Hung Hsieh99459fc2016-09-22 13:43:12 -0700129 { 'category':'C/C++', 'severity':severity.MEDIUM, 'option':'-Wunused',
Marco Nelissen594375d2009-07-14 09:04:04 -0700130 'description':'Unused function, variable or label',
Marco Nelissen8e201962010-03-10 16:16:02 -0800131 'patterns':[r".*: warning: '.+' defined but not used",
Chih-Hung Hsiehba0ddcd2016-03-21 11:28:30 -0700132 r".*: warning: unused function '.+'",
Chih-Hung Hsieh90d46192016-03-29 15:33:11 -0700133 r".*: warning: private field '.+' is not used",
Marco Nelissen8e201962010-03-10 16:16:02 -0800134 r".*: warning: unused variable '.+'"] },
Chih-Hung Hsieh99459fc2016-09-22 13:43:12 -0700135 { 'category':'C/C++', 'severity':severity.MEDIUM, 'option':'-Wunused-value',
Chih-Hung Hsieh90d46192016-03-29 15:33:11 -0700136 'description':'Statement with no effect or result unused',
137 'patterns':[r".*: warning: statement with no effect",
138 r".*: warning: expression result unused"] },
Chih-Hung Hsieh99459fc2016-09-22 13:43:12 -0700139 { 'category':'C/C++', 'severity':severity.MEDIUM, 'option':'-Wunused-result',
Chih-Hung Hsieh90d46192016-03-29 15:33:11 -0700140 'description':'Ignoreing return value of function',
141 'patterns':[r".*: warning: ignoring return value of function .+Wunused-result"] },
Chih-Hung Hsieh99459fc2016-09-22 13:43:12 -0700142 { 'category':'C/C++', 'severity':severity.MEDIUM, 'option':'-Wmissing-field-initializers',
Marco Nelissen594375d2009-07-14 09:04:04 -0700143 'description':'Missing initializer',
144 'patterns':[r".*: warning: missing initializer"] },
Chih-Hung Hsieh99459fc2016-09-22 13:43:12 -0700145 { 'category':'C/C++', 'severity':severity.MEDIUM, 'option':'-Wdelete-non-virtual-dtor',
Chih-Hung Hsieh8d145432016-07-01 15:48:06 -0700146 'description':'Need virtual destructor',
147 'patterns':[r".*: warning: delete called .* has virtual functions but non-virtual destructor"] },
Chih-Hung Hsieh99459fc2016-09-22 13:43:12 -0700148 { 'category':'cont.', 'severity':severity.SKIP,
Marco Nelissen594375d2009-07-14 09:04:04 -0700149 'description':'',
150 'patterns':[r".*: warning: \(near initialization for '.+'\)"] },
Chih-Hung Hsieh99459fc2016-09-22 13:43:12 -0700151 { 'category':'C/C++', 'severity':severity.MEDIUM, 'option':'-Wdate-time',
Chih-Hung Hsieh8d145432016-07-01 15:48:06 -0700152 'description':'Expansion of data or time macro',
153 'patterns':[r".*: warning: expansion of date or time macro is not reproducible"] },
Chih-Hung Hsieh99459fc2016-09-22 13:43:12 -0700154 { 'category':'C/C++', 'severity':severity.MEDIUM, 'option':'-Wformat',
Marco Nelissen594375d2009-07-14 09:04:04 -0700155 'description':'Format string does not match arguments',
Chih-Hung Hsiehf8aaf602016-03-16 12:18:16 -0700156 'patterns':[r".*: warning: format '.+' expects type '.+', but argument [0-9]+ has type '.+'",
157 r".*: warning: more '%' conversions than data arguments",
158 r".*: warning: data argument not used by format string",
159 r".*: warning: incomplete format specifier",
Chih-Hung Hsieh8d145432016-07-01 15:48:06 -0700160 r".*: warning: unknown conversion type .* in format",
Chih-Hung Hsiehf8aaf602016-03-16 12:18:16 -0700161 r".*: warning: format .+ expects .+ but argument .+Wformat=",
162 r".*: warning: field precision should have .+ but argument has .+Wformat",
Chih-Hung Hsiehba0ddcd2016-03-21 11:28:30 -0700163 r".*: warning: format specifies type .+ but the argument has .*type .+Wformat"] },
Chih-Hung Hsieh99459fc2016-09-22 13:43:12 -0700164 { 'category':'C/C++', 'severity':severity.MEDIUM, 'option':'-Wformat-extra-args',
Marco Nelissen594375d2009-07-14 09:04:04 -0700165 'description':'Too many arguments for format string',
166 'patterns':[r".*: warning: too many arguments for format"] },
Chih-Hung Hsieh99459fc2016-09-22 13:43:12 -0700167 { 'category':'C/C++', 'severity':severity.MEDIUM, 'option':'-Wformat-invalid-specifier',
Chih-Hung Hsiehf8aaf602016-03-16 12:18:16 -0700168 'description':'Invalid format specifier',
169 'patterns':[r".*: warning: invalid .+ specifier '.+'.+format-invalid-specifier"] },
Chih-Hung Hsieh99459fc2016-09-22 13:43:12 -0700170 { 'category':'C/C++', 'severity':severity.MEDIUM, 'option':'-Wsign-compare',
Marco Nelissen594375d2009-07-14 09:04:04 -0700171 'description':'Comparison between signed and unsigned',
172 'patterns':[r".*: warning: comparison between signed and unsigned",
173 r".*: warning: comparison of promoted \~unsigned with unsigned",
174 r".*: warning: signed and unsigned type in conditional expression"] },
Chih-Hung Hsieh99459fc2016-09-22 13:43:12 -0700175 { 'category':'C/C++', 'severity':severity.MEDIUM,
Marco Nelissen8e201962010-03-10 16:16:02 -0800176 'description':'Comparison between enum and non-enum',
177 'patterns':[r".*: warning: enumeral and non-enumeral type in conditional expression"] },
Chih-Hung Hsieh99459fc2016-09-22 13:43:12 -0700178 { 'category':'libpng', 'severity':severity.MEDIUM,
Marco Nelissen594375d2009-07-14 09:04:04 -0700179 'description':'libpng: zero area',
180 'patterns':[r".*libpng warning: Ignoring attempt to set cHRM RGB triangle with zero area"] },
Chih-Hung Hsieh99459fc2016-09-22 13:43:12 -0700181 { 'category':'aapt', 'severity':severity.MEDIUM,
Marco Nelissen594375d2009-07-14 09:04:04 -0700182 'description':'aapt: no comment for public symbol',
183 'patterns':[r".*: warning: No comment for public symbol .+"] },
Chih-Hung Hsieh99459fc2016-09-22 13:43:12 -0700184 { 'category':'C/C++', 'severity':severity.MEDIUM, 'option':'-Wmissing-braces',
Marco Nelissen594375d2009-07-14 09:04:04 -0700185 'description':'Missing braces around initializer',
186 'patterns':[r".*: warning: missing braces around initializer.*"] },
Chih-Hung Hsieh99459fc2016-09-22 13:43:12 -0700187 { 'category':'C/C++', 'severity':severity.HARMLESS,
Marco Nelissen594375d2009-07-14 09:04:04 -0700188 'description':'No newline at end of file',
189 'patterns':[r".*: warning: no newline at end of file"] },
Chih-Hung Hsieh99459fc2016-09-22 13:43:12 -0700190 { 'category':'C/C++', 'severity':severity.HARMLESS,
Chih-Hung Hsieh8d145432016-07-01 15:48:06 -0700191 'description':'Missing space after macro name',
192 'patterns':[r".*: warning: missing whitespace after the macro name"] },
Chih-Hung Hsieh99459fc2016-09-22 13:43:12 -0700193 { 'category':'C/C++', 'severity':severity.LOW, 'option':'-Wcast-align',
Chih-Hung Hsieh8d145432016-07-01 15:48:06 -0700194 'description':'Cast increases required alignment',
195 'patterns':[r".*: warning: cast from .* to .* increases required alignment .*"] },
Chih-Hung Hsieh99459fc2016-09-22 13:43:12 -0700196 { 'category':'C/C++', 'severity':severity.MEDIUM, 'option':'-Wcast-qual',
Marco Nelissen594375d2009-07-14 09:04:04 -0700197 'description':'Qualifier discarded',
198 'patterns':[r".*: warning: passing argument [0-9]+ of '.+' discards qualifiers from pointer target type",
199 r".*: warning: assignment discards qualifiers from pointer target type",
Chih-Hung Hsiehba0ddcd2016-03-21 11:28:30 -0700200 r".*: warning: passing .+ to parameter of type .+ discards qualifiers",
201 r".*: warning: assigning to .+ from .+ discards qualifiers",
Chih-Hung Hsieh8d145432016-07-01 15:48:06 -0700202 r".*: warning: initializing .+ discards qualifiers .+types-discards-qualifiers",
Marco Nelissen594375d2009-07-14 09:04:04 -0700203 r".*: warning: return discards qualifiers from pointer target type"] },
Chih-Hung Hsieh99459fc2016-09-22 13:43:12 -0700204 { 'category':'C/C++', 'severity':severity.MEDIUM, 'option':'-Wunknown-attributes',
Chih-Hung Hsieh8d145432016-07-01 15:48:06 -0700205 'description':'Unknown attribute',
206 'patterns':[r".*: warning: unknown attribute '.+'"] },
Chih-Hung Hsieh99459fc2016-09-22 13:43:12 -0700207 { 'category':'C/C++', 'severity':severity.MEDIUM, 'option':'-Wignored-attributes',
Marco Nelissen594375d2009-07-14 09:04:04 -0700208 'description':'Attribute ignored',
Chih-Hung Hsieh8d145432016-07-01 15:48:06 -0700209 'patterns':[r".*: warning: '_*packed_*' attribute ignored",
210 r".*: warning: attribute declaration must precede definition .+ignored-attributes"] },
Chih-Hung Hsieh99459fc2016-09-22 13:43:12 -0700211 { 'category':'C/C++', 'severity':severity.MEDIUM, 'option':'-Wvisibility',
Chih-Hung Hsieh8d145432016-07-01 15:48:06 -0700212 'description':'Visibility problem',
213 'patterns':[r".*: warning: declaration of '.+' will not be visible outside of this function"] },
Chih-Hung Hsieh99459fc2016-09-22 13:43:12 -0700214 { 'category':'C/C++', 'severity':severity.MEDIUM, 'option':'-Wattributes',
Marco Nelissen594375d2009-07-14 09:04:04 -0700215 'description':'Visibility mismatch',
216 'patterns':[r".*: warning: '.+' declared with greater visibility than the type of its field '.+'"] },
Chih-Hung Hsieh99459fc2016-09-22 13:43:12 -0700217 { 'category':'C/C++', 'severity':severity.MEDIUM,
Marco Nelissen594375d2009-07-14 09:04:04 -0700218 'description':'Shift count greater than width of type',
219 'patterns':[r".*: warning: (left|right) shift count >= width of type"] },
Chih-Hung Hsieh99459fc2016-09-22 13:43:12 -0700220 { 'category':'C/C++', 'severity':severity.MEDIUM, 'option':'-Wextern-initializer',
Marco Nelissen594375d2009-07-14 09:04:04 -0700221 'description':'extern <foo> is initialized',
Chih-Hung Hsieh8d145432016-07-01 15:48:06 -0700222 'patterns':[r".*: warning: '.+' initialized and declared 'extern'",
223 r".*: warning: 'extern' variable has an initializer"] },
Chih-Hung Hsieh99459fc2016-09-22 13:43:12 -0700224 { 'category':'C/C++', 'severity':severity.MEDIUM, 'option':'-Wold-style-declaration',
Marco Nelissen594375d2009-07-14 09:04:04 -0700225 'description':'Old style declaration',
226 'patterns':[r".*: warning: 'static' is not at beginning of declaration"] },
Chih-Hung Hsieh99459fc2016-09-22 13:43:12 -0700227 { 'category':'C/C++', 'severity':severity.MEDIUM, 'option':'-Wreturn-type',
Chih-Hung Hsieh8d145432016-07-01 15:48:06 -0700228 'description':'Missing return value',
229 'patterns':[r".*: warning: control reaches end of non-void function"] },
Chih-Hung Hsieh99459fc2016-09-22 13:43:12 -0700230 { 'category':'C/C++', 'severity':severity.MEDIUM, 'option':'-Wimplicit-int',
Chih-Hung Hsieh8d145432016-07-01 15:48:06 -0700231 'description':'Implicit int type',
Chih-Hung Hsiehe41c99b2016-09-12 16:20:49 -0700232 'patterns':[r".*: warning: type specifier missing, defaults to 'int'",
233 r".*: warning: type defaults to 'int' in declaration of '.+'"] },
Chih-Hung Hsieh99459fc2016-09-22 13:43:12 -0700234 { 'category':'C/C++', 'severity':severity.MEDIUM, 'option':'-Wmain-return-type',
Chih-Hung Hsieh8d145432016-07-01 15:48:06 -0700235 'description':'Main function should return int',
236 'patterns':[r".*: warning: return type of 'main' is not 'int'"] },
Chih-Hung Hsieh99459fc2016-09-22 13:43:12 -0700237 { 'category':'C/C++', 'severity':severity.MEDIUM, 'option':'-Wuninitialized',
Marco Nelissen594375d2009-07-14 09:04:04 -0700238 'description':'Variable may be used uninitialized',
239 'patterns':[r".*: warning: '.+' may be used uninitialized in this function"] },
Chih-Hung Hsieh99459fc2016-09-22 13:43:12 -0700240 { 'category':'C/C++', 'severity':severity.HIGH, 'option':'-Wuninitialized',
Marco Nelissen594375d2009-07-14 09:04:04 -0700241 'description':'Variable is used uninitialized',
Chih-Hung Hsiehf8aaf602016-03-16 12:18:16 -0700242 'patterns':[r".*: warning: '.+' is used uninitialized in this function",
243 r".*: warning: variable '.+' is uninitialized when used here"] },
Chih-Hung Hsieh99459fc2016-09-22 13:43:12 -0700244 { 'category':'ld', 'severity':severity.MEDIUM, 'option':'-fshort-enums',
Marco Nelissen594375d2009-07-14 09:04:04 -0700245 'description':'ld: possible enum size mismatch',
246 'patterns':[r".*: warning: .* uses variable-size enums yet the output is to use 32-bit enums; use of enum values across objects may fail"] },
Chih-Hung Hsieh99459fc2016-09-22 13:43:12 -0700247 { 'category':'C/C++', 'severity':severity.MEDIUM, 'option':'-Wpointer-sign',
Marco Nelissen594375d2009-07-14 09:04:04 -0700248 'description':'Pointer targets differ in signedness',
249 'patterns':[r".*: warning: pointer targets in initialization differ in signedness",
250 r".*: warning: pointer targets in assignment differ in signedness",
251 r".*: warning: pointer targets in return differ in signedness",
252 r".*: warning: pointer targets in passing argument [0-9]+ of '.+' differ in signedness"] },
Chih-Hung Hsieh99459fc2016-09-22 13:43:12 -0700253 { 'category':'C/C++', 'severity':severity.MEDIUM, 'option':'-Wstrict-overflow',
Marco Nelissen594375d2009-07-14 09:04:04 -0700254 'description':'Assuming overflow does not occur',
255 'patterns':[r".*: warning: assuming signed overflow does not occur when assuming that .* is always (true|false)"] },
Chih-Hung Hsieh99459fc2016-09-22 13:43:12 -0700256 { 'category':'C/C++', 'severity':severity.MEDIUM, 'option':'-Wempty-body',
Marco Nelissen594375d2009-07-14 09:04:04 -0700257 'description':'Suggest adding braces around empty body',
258 'patterns':[r".*: warning: suggest braces around empty body in an 'if' statement",
259 r".*: warning: empty body in an if-statement",
260 r".*: warning: suggest braces around empty body in an 'else' statement",
261 r".*: warning: empty body in an else-statement"] },
Chih-Hung Hsieh99459fc2016-09-22 13:43:12 -0700262 { 'category':'C/C++', 'severity':severity.MEDIUM, 'option':'-Wparentheses',
Marco Nelissen594375d2009-07-14 09:04:04 -0700263 'description':'Suggest adding parentheses',
264 'patterns':[r".*: warning: suggest explicit braces to avoid ambiguous 'else'",
265 r".*: warning: suggest parentheses around arithmetic in operand of '.+'",
266 r".*: warning: suggest parentheses around comparison in operand of '.+'",
Chih-Hung Hsiehba0ddcd2016-03-21 11:28:30 -0700267 r".*: warning: logical not is only applied to the left hand side of this comparison",
268 r".*: warning: using the result of an assignment as a condition without parentheses",
269 r".*: warning: .+ has lower precedence than .+ be evaluated first .+Wparentheses",
Marco Nelissen594375d2009-07-14 09:04:04 -0700270 r".*: warning: suggest parentheses around '.+?' .+ '.+?'",
271 r".*: warning: suggest parentheses around assignment used as truth value"] },
Chih-Hung Hsieh99459fc2016-09-22 13:43:12 -0700272 { 'category':'C/C++', 'severity':severity.MEDIUM,
Marco Nelissen594375d2009-07-14 09:04:04 -0700273 'description':'Static variable used in non-static inline function',
274 'patterns':[r".*: warning: '.+' is static but used in inline function '.+' which is not static"] },
Chih-Hung Hsieh99459fc2016-09-22 13:43:12 -0700275 { 'category':'C/C++', 'severity':severity.MEDIUM, 'option':'-Wimplicit int',
Marco Nelissen594375d2009-07-14 09:04:04 -0700276 'description':'No type or storage class (will default to int)',
277 'patterns':[r".*: warning: data definition has no type or storage class"] },
Chih-Hung Hsieh99459fc2016-09-22 13:43:12 -0700278 { 'category':'C/C++', 'severity':severity.MEDIUM,
Chih-Hung Hsiehf8aaf602016-03-16 12:18:16 -0700279 'description':'Null pointer',
280 'patterns':[r".*: warning: Dereference of null pointer",
281 r".*: warning: Called .+ pointer is null",
282 r".*: warning: Forming reference to null pointer",
283 r".*: warning: Returning null reference",
284 r".*: warning: Null pointer passed as an argument to a 'nonnull' parameter",
285 r".*: warning: .+ results in a null pointer dereference",
286 r".*: warning: Access to .+ results in a dereference of a null pointer",
287 r".*: warning: Null pointer argument in"] },
Chih-Hung Hsieh99459fc2016-09-22 13:43:12 -0700288 { 'category':'cont.', 'severity':severity.SKIP,
Marco Nelissen594375d2009-07-14 09:04:04 -0700289 'description':'',
Marco Nelissen594375d2009-07-14 09:04:04 -0700290 'patterns':[r".*: warning: parameter names \(without types\) in function declaration"] },
Chih-Hung Hsieh99459fc2016-09-22 13:43:12 -0700291 { 'category':'C/C++', 'severity':severity.MEDIUM, 'option':'-Wstrict-aliasing',
Marco Nelissen594375d2009-07-14 09:04:04 -0700292 'description':'Dereferencing <foo> breaks strict aliasing rules',
293 'patterns':[r".*: warning: dereferencing .* break strict-aliasing rules"] },
Chih-Hung Hsieh99459fc2016-09-22 13:43:12 -0700294 { 'category':'C/C++', 'severity':severity.MEDIUM, 'option':'-Wpointer-to-int-cast',
Marco Nelissen594375d2009-07-14 09:04:04 -0700295 'description':'Cast from pointer to integer of different size',
Chih-Hung Hsieh8d145432016-07-01 15:48:06 -0700296 'patterns':[r".*: warning: cast from pointer to integer of different size",
297 r".*: warning: initialization makes pointer from integer without a cast"] } ,
Chih-Hung Hsieh99459fc2016-09-22 13:43:12 -0700298 { 'category':'C/C++', 'severity':severity.MEDIUM, 'option':'-Wint-to-pointer-cast',
Marco Nelissen594375d2009-07-14 09:04:04 -0700299 'description':'Cast to pointer from integer of different size',
300 'patterns':[r".*: warning: cast to pointer from integer of different size"] },
Chih-Hung Hsieh99459fc2016-09-22 13:43:12 -0700301 { 'category':'C/C++', 'severity':severity.MEDIUM,
Marco Nelissen594375d2009-07-14 09:04:04 -0700302 'description':'Symbol redefined',
303 'patterns':[r".*: warning: "".+"" redefined"] },
Chih-Hung Hsieh99459fc2016-09-22 13:43:12 -0700304 { 'category':'cont.', 'severity':severity.SKIP,
Marco Nelissen594375d2009-07-14 09:04:04 -0700305 'description':'',
306 'patterns':[r".*: warning: this is the location of the previous definition"] },
Chih-Hung Hsieh99459fc2016-09-22 13:43:12 -0700307 { 'category':'ld', 'severity':severity.MEDIUM,
Marco Nelissen594375d2009-07-14 09:04:04 -0700308 'description':'ld: type and size of dynamic symbol are not defined',
309 'patterns':[r".*: warning: type and size of dynamic symbol `.+' are not defined"] },
Chih-Hung Hsieh99459fc2016-09-22 13:43:12 -0700310 { 'category':'C/C++', 'severity':severity.MEDIUM,
Marco Nelissen594375d2009-07-14 09:04:04 -0700311 'description':'Pointer from integer without cast',
312 'patterns':[r".*: warning: assignment makes pointer from integer without a cast"] },
Chih-Hung Hsieh99459fc2016-09-22 13:43:12 -0700313 { 'category':'C/C++', 'severity':severity.MEDIUM,
Marco Nelissen594375d2009-07-14 09:04:04 -0700314 'description':'Pointer from integer without cast',
315 'patterns':[r".*: warning: passing argument [0-9]+ of '.+' makes pointer from integer without a cast"] },
Chih-Hung Hsieh99459fc2016-09-22 13:43:12 -0700316 { 'category':'C/C++', 'severity':severity.MEDIUM,
Marco Nelissen594375d2009-07-14 09:04:04 -0700317 'description':'Integer from pointer without cast',
318 'patterns':[r".*: warning: assignment makes integer from pointer without a cast"] },
Chih-Hung Hsieh99459fc2016-09-22 13:43:12 -0700319 { 'category':'C/C++', 'severity':severity.MEDIUM,
Marco Nelissen594375d2009-07-14 09:04:04 -0700320 'description':'Integer from pointer without cast',
321 'patterns':[r".*: warning: passing argument [0-9]+ of '.+' makes integer from pointer without a cast"] },
Chih-Hung Hsieh99459fc2016-09-22 13:43:12 -0700322 { 'category':'C/C++', 'severity':severity.MEDIUM,
Marco Nelissen594375d2009-07-14 09:04:04 -0700323 'description':'Integer from pointer without cast',
324 'patterns':[r".*: warning: return makes integer from pointer without a cast"] },
Chih-Hung Hsieh99459fc2016-09-22 13:43:12 -0700325 { 'category':'C/C++', 'severity':severity.MEDIUM, 'option':'-Wunknown-pragmas',
Marco Nelissen594375d2009-07-14 09:04:04 -0700326 'description':'Ignoring pragma',
327 'patterns':[r".*: warning: ignoring #pragma .+"] },
Chih-Hung Hsieh99459fc2016-09-22 13:43:12 -0700328 { 'category':'C/C++', 'severity':severity.MEDIUM, 'option':'-Wclobbered',
Marco Nelissen594375d2009-07-14 09:04:04 -0700329 'description':'Variable might be clobbered by longjmp or vfork',
330 'patterns':[r".*: warning: variable '.+' might be clobbered by 'longjmp' or 'vfork'"] },
Chih-Hung Hsieh99459fc2016-09-22 13:43:12 -0700331 { 'category':'C/C++', 'severity':severity.MEDIUM, 'option':'-Wclobbered',
Marco Nelissen594375d2009-07-14 09:04:04 -0700332 'description':'Argument might be clobbered by longjmp or vfork',
333 'patterns':[r".*: warning: argument '.+' might be clobbered by 'longjmp' or 'vfork'"] },
Chih-Hung Hsieh99459fc2016-09-22 13:43:12 -0700334 { 'category':'C/C++', 'severity':severity.MEDIUM, 'option':'-Wredundant-decls',
Marco Nelissen594375d2009-07-14 09:04:04 -0700335 'description':'Redundant declaration',
336 'patterns':[r".*: warning: redundant redeclaration of '.+'"] },
Chih-Hung Hsieh99459fc2016-09-22 13:43:12 -0700337 { 'category':'cont.', 'severity':severity.SKIP,
Marco Nelissen594375d2009-07-14 09:04:04 -0700338 'description':'',
339 'patterns':[r".*: warning: previous declaration of '.+' was here"] },
Chih-Hung Hsieh99459fc2016-09-22 13:43:12 -0700340 { 'category':'C/C++', 'severity':severity.MEDIUM, 'option':'-Wswitch-enum',
Marco Nelissen594375d2009-07-14 09:04:04 -0700341 'description':'Enum value not handled in switch',
Chih-Hung Hsiehba0ddcd2016-03-21 11:28:30 -0700342 'patterns':[r".*: warning: .*enumeration value.* not handled in switch.+Wswitch"] },
Chih-Hung Hsieh99459fc2016-09-22 13:43:12 -0700343 { 'category':'java', 'severity':severity.MEDIUM, 'option':'-encoding',
Marco Nelissen594375d2009-07-14 09:04:04 -0700344 'description':'Java: Non-ascii characters used, but ascii encoding specified',
345 'patterns':[r".*: warning: unmappable character for encoding ascii"] },
Chih-Hung Hsieh99459fc2016-09-22 13:43:12 -0700346 { 'category':'java', 'severity':severity.MEDIUM,
Marco Nelissen594375d2009-07-14 09:04:04 -0700347 'description':'Java: Non-varargs call of varargs method with inexact argument type for last parameter',
348 'patterns':[r".*: warning: non-varargs call of varargs method with inexact argument type for last parameter"] },
Chih-Hung Hsieh99459fc2016-09-22 13:43:12 -0700349 { 'category':'java', 'severity':severity.MEDIUM,
Chih-Hung Hsiehba0ddcd2016-03-21 11:28:30 -0700350 'description':'Java: Unchecked method invocation',
351 'patterns':[r".*: warning: \[unchecked\] unchecked method invocation: .+ in class .+"] },
Chih-Hung Hsieh99459fc2016-09-22 13:43:12 -0700352 { 'category':'java', 'severity':severity.MEDIUM,
Chih-Hung Hsiehba0ddcd2016-03-21 11:28:30 -0700353 'description':'Java: Unchecked conversion',
354 'patterns':[r".*: warning: \[unchecked\] unchecked conversion"] },
Chih-Hung Hsieh99459fc2016-09-22 13:43:12 -0700355 { 'category':'java', 'severity':severity.MEDIUM,
Chih-Hung Hsieh0862c482016-09-06 16:26:46 -0700356 'description':'_ used as an identifier',
357 'patterns':[r".*: warning: '_' used as an identifier"] },
Ian Rogers32bb9bd2016-05-09 23:19:42 -0700358
Ian Rogers6e520032016-05-13 08:59:00 -0700359 # Warnings from Error Prone.
360 {'category': 'java',
361 'severity': severity.MEDIUM,
Ian Rogers6e520032016-05-13 08:59:00 -0700362 'description': 'Java: Use of deprecated member',
363 'patterns': [r'.*: warning: \[deprecation\] .+']},
364 {'category': 'java',
365 'severity': severity.MEDIUM,
Ian Rogers6e520032016-05-13 08:59:00 -0700366 'description': 'Java: Unchecked conversion',
367 'patterns': [r'.*: warning: \[unchecked\] .+']},
Ian Rogers32bb9bd2016-05-09 23:19:42 -0700368
Ian Rogers6e520032016-05-13 08:59:00 -0700369 # Warnings from Error Prone (auto generated list).
370 {'category': 'java',
371 'severity': severity.LOW,
Ian Rogers6e520032016-05-13 08:59:00 -0700372 'description':
373 'Java: Deprecated item is not annotated with @Deprecated',
374 'patterns': [r".*: warning: \[DepAnn\] .+"]},
375 {'category': 'java',
376 'severity': severity.LOW,
Ian Rogers6e520032016-05-13 08:59:00 -0700377 'description':
378 'Java: Fallthrough warning suppression has no effect if warning is suppressed',
379 'patterns': [r".*: warning: \[FallthroughSuppression\] .+"]},
380 {'category': 'java',
381 'severity': severity.LOW,
Ian Rogers6e520032016-05-13 08:59:00 -0700382 'description':
383 'Java: Prefer \'L\' to \'l\' for the suffix to long literals',
384 'patterns': [r".*: warning: \[LongLiteralLowerCaseSuffix\] .+"]},
385 {'category': 'java',
386 'severity': severity.LOW,
Ian Rogers6e520032016-05-13 08:59:00 -0700387 'description':
388 'Java: @Binds is a more efficient and declaritive mechanism for delegating a binding.',
389 'patterns': [r".*: warning: \[UseBinds\] .+"]},
390 {'category': 'java',
391 'severity': severity.MEDIUM,
Ian Rogers6e520032016-05-13 08:59:00 -0700392 'description':
393 'Java: Assertions may be disabled at runtime and do not guarantee that execution will halt here; consider throwing an exception instead',
394 'patterns': [r".*: warning: \[AssertFalse\] .+"]},
395 {'category': 'java',
396 'severity': severity.MEDIUM,
Ian Rogers6e520032016-05-13 08:59:00 -0700397 'description':
398 'Java: Classes that implement Annotation must override equals and hashCode. Consider using AutoAnnotation instead of implementing Annotation by hand.',
399 'patterns': [r".*: warning: \[BadAnnotationImplementation\] .+"]},
400 {'category': 'java',
401 'severity': severity.MEDIUM,
Ian Rogers6e520032016-05-13 08:59:00 -0700402 'description':
403 'Java: BigDecimal(double) and BigDecimal.valueOf(double) may lose precision, prefer BigDecimal(String) or BigDecimal(long)',
404 'patterns': [r".*: warning: \[BigDecimalLiteralDouble\] .+"]},
405 {'category': 'java',
406 'severity': severity.MEDIUM,
Ian Rogers6e520032016-05-13 08:59:00 -0700407 'description':
408 'Java: Mockito cannot mock final classes',
409 'patterns': [r".*: warning: \[CannotMockFinalClass\] .+"]},
410 {'category': 'java',
411 'severity': severity.MEDIUM,
Ian Rogers6e520032016-05-13 08:59:00 -0700412 'description':
413 'Java: This code, which counts elements using a loop, can be replaced by a simpler library method',
414 'patterns': [r".*: warning: \[ElementsCountedInLoop\] .+"]},
415 {'category': 'java',
416 'severity': severity.MEDIUM,
Ian Rogers6e520032016-05-13 08:59:00 -0700417 'description':
418 'Java: Empty top-level type declaration',
419 'patterns': [r".*: warning: \[EmptyTopLevelDeclaration\] .+"]},
420 {'category': 'java',
421 'severity': severity.MEDIUM,
Ian Rogers6e520032016-05-13 08:59:00 -0700422 'description':
423 'Java: Classes that override equals should also override hashCode.',
424 'patterns': [r".*: warning: \[EqualsHashCode\] .+"]},
425 {'category': 'java',
426 'severity': severity.MEDIUM,
Ian Rogers6e520032016-05-13 08:59:00 -0700427 'description':
428 'Java: An equality test between objects with incompatible types always returns false',
429 'patterns': [r".*: warning: \[EqualsIncompatibleType\] .+"]},
430 {'category': 'java',
431 'severity': severity.MEDIUM,
Ian Rogers6e520032016-05-13 08:59:00 -0700432 'description':
433 '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.',
434 'patterns': [r".*: warning: \[Finally\] .+"]},
435 {'category': 'java',
436 'severity': severity.MEDIUM,
Ian Rogers6e520032016-05-13 08:59:00 -0700437 'description':
438 'Java: This annotation has incompatible modifiers as specified by its @IncompatibleModifiers annotation',
439 'patterns': [r".*: warning: \[IncompatibleModifiers\] .+"]},
440 {'category': 'java',
441 'severity': severity.MEDIUM,
Ian Rogers6e520032016-05-13 08:59:00 -0700442 'description':
443 'Java: Class should not implement both `Iterable` and `Iterator`',
444 'patterns': [r".*: warning: \[IterableAndIterator\] .+"]},
445 {'category': 'java',
446 'severity': severity.MEDIUM,
Ian Rogers6e520032016-05-13 08:59:00 -0700447 'description':
448 'Java: Floating-point comparison without error tolerance',
449 'patterns': [r".*: warning: \[JUnit3FloatingPointComparisonWithoutDelta\] .+"]},
450 {'category': 'java',
451 'severity': severity.MEDIUM,
Ian Rogers6e520032016-05-13 08:59:00 -0700452 'description':
453 'Java: Test class inherits from JUnit 3\'s TestCase but has JUnit 4 @Test annotations.',
454 'patterns': [r".*: warning: \[JUnitAmbiguousTestClass\] .+"]},
455 {'category': 'java',
456 'severity': severity.MEDIUM,
Ian Rogers6e520032016-05-13 08:59:00 -0700457 'description':
458 'Java: Enum switch statement is missing cases',
459 'patterns': [r".*: warning: \[MissingCasesInEnumSwitch\] .+"]},
460 {'category': 'java',
461 'severity': severity.MEDIUM,
Ian Rogers6e520032016-05-13 08:59:00 -0700462 'description':
463 'Java: Not calling fail() when expecting an exception masks bugs',
464 'patterns': [r".*: warning: \[MissingFail\] .+"]},
465 {'category': 'java',
466 'severity': severity.MEDIUM,
Ian Rogers6e520032016-05-13 08:59:00 -0700467 'description':
468 'Java: method overrides method in supertype; expected @Override',
469 'patterns': [r".*: warning: \[MissingOverride\] .+"]},
470 {'category': 'java',
471 'severity': severity.MEDIUM,
Ian Rogers6e520032016-05-13 08:59:00 -0700472 'description':
473 'Java: Source files should not contain multiple top-level class declarations',
474 'patterns': [r".*: warning: \[MultipleTopLevelClasses\] .+"]},
475 {'category': 'java',
476 'severity': severity.MEDIUM,
Ian Rogers6e520032016-05-13 08:59:00 -0700477 'description':
478 'Java: This update of a volatile variable is non-atomic',
479 'patterns': [r".*: warning: \[NonAtomicVolatileUpdate\] .+"]},
480 {'category': 'java',
481 'severity': severity.MEDIUM,
Ian Rogers6e520032016-05-13 08:59:00 -0700482 'description':
483 'Java: Static import of member uses non-canonical name',
484 'patterns': [r".*: warning: \[NonCanonicalStaticMemberImport\] .+"]},
485 {'category': 'java',
486 'severity': severity.MEDIUM,
Ian Rogers6e520032016-05-13 08:59:00 -0700487 'description':
488 'Java: equals method doesn\'t override Object.equals',
489 'patterns': [r".*: warning: \[NonOverridingEquals\] .+"]},
490 {'category': 'java',
491 'severity': severity.MEDIUM,
Ian Rogers6e520032016-05-13 08:59:00 -0700492 'description':
493 'Java: Constructors should not be annotated with @Nullable since they cannot return null',
494 'patterns': [r".*: warning: \[NullableConstructor\] .+"]},
495 {'category': 'java',
496 'severity': severity.MEDIUM,
Ian Rogers6e520032016-05-13 08:59:00 -0700497 'description':
498 'Java: @Nullable should not be used for primitive types since they cannot be null',
499 'patterns': [r".*: warning: \[NullablePrimitive\] .+"]},
500 {'category': 'java',
501 'severity': severity.MEDIUM,
Ian Rogers6e520032016-05-13 08:59:00 -0700502 'description':
503 'Java: void-returning methods should not be annotated with @Nullable, since they cannot return null',
504 'patterns': [r".*: warning: \[NullableVoid\] .+"]},
505 {'category': 'java',
506 'severity': severity.MEDIUM,
Ian Rogers6e520032016-05-13 08:59:00 -0700507 'description':
508 'Java: Package names should match the directory they are declared in',
509 'patterns': [r".*: warning: \[PackageLocation\] .+"]},
510 {'category': 'java',
511 'severity': severity.MEDIUM,
Ian Rogers6e520032016-05-13 08:59:00 -0700512 'description':
513 'Java: Second argument to Preconditions.* is a call to String.format(), which can be unwrapped',
514 'patterns': [r".*: warning: \[PreconditionsErrorMessageEagerEvaluation\] .+"]},
515 {'category': 'java',
516 'severity': severity.MEDIUM,
Ian Rogers6e520032016-05-13 08:59:00 -0700517 'description':
518 'Java: Preconditions only accepts the %s placeholder in error message strings',
519 'patterns': [r".*: warning: \[PreconditionsInvalidPlaceholder\] .+"]},
520 {'category': 'java',
521 'severity': severity.MEDIUM,
Ian Rogers6e520032016-05-13 08:59:00 -0700522 'description':
523 'Java: Passing a primitive array to a varargs method is usually wrong',
524 'patterns': [r".*: warning: \[PrimitiveArrayPassedToVarargsMethod\] .+"]},
525 {'category': 'java',
526 'severity': severity.MEDIUM,
Ian Rogers6e520032016-05-13 08:59:00 -0700527 'description':
528 'Java: Protobuf fields cannot be null, so this check is redundant',
529 'patterns': [r".*: warning: \[ProtoFieldPreconditionsCheckNotNull\] .+"]},
530 {'category': 'java',
531 'severity': severity.MEDIUM,
Ian Rogers6e520032016-05-13 08:59:00 -0700532 'description':
533 'Java: This annotation is missing required modifiers as specified by its @RequiredModifiers annotation',
534 'patterns': [r".*: warning: \[RequiredModifiers\] .+"]},
535 {'category': 'java',
536 'severity': severity.MEDIUM,
Ian Rogers6e520032016-05-13 08:59:00 -0700537 'description':
538 'Java: A static variable or method should not be accessed from an object instance',
539 'patterns': [r".*: warning: \[StaticAccessedFromInstance\] .+"]},
540 {'category': 'java',
541 'severity': severity.MEDIUM,
Ian Rogers6e520032016-05-13 08:59:00 -0700542 'description':
543 'Java: String comparison using reference equality instead of value equality',
544 'patterns': [r".*: warning: \[StringEquality\] .+"]},
545 {'category': 'java',
546 'severity': severity.MEDIUM,
Ian Rogers6e520032016-05-13 08:59:00 -0700547 'description':
548 '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.',
549 'patterns': [r".*: warning: \[TypeParameterUnusedInFormals\] .+"]},
550 {'category': 'java',
551 'severity': severity.MEDIUM,
Ian Rogers6e520032016-05-13 08:59:00 -0700552 'description':
553 'Java: Using static imports for types is unnecessary',
554 'patterns': [r".*: warning: \[UnnecessaryStaticImport\] .+"]},
555 {'category': 'java',
556 'severity': severity.MEDIUM,
Ian Rogers6e520032016-05-13 08:59:00 -0700557 'description':
558 'Java: Unsynchronized method overrides a synchronized method.',
559 'patterns': [r".*: warning: \[UnsynchronizedOverridesSynchronized\] .+"]},
560 {'category': 'java',
561 'severity': severity.MEDIUM,
Ian Rogers6e520032016-05-13 08:59:00 -0700562 'description':
563 'Java: Non-constant variable missing @Var annotation',
564 'patterns': [r".*: warning: \[Var\] .+"]},
565 {'category': 'java',
566 'severity': severity.MEDIUM,
Ian Rogers6e520032016-05-13 08:59:00 -0700567 'description':
568 'Java: Because of spurious wakeups, Object.wait() and Condition.await() must always be called in a loop',
569 'patterns': [r".*: warning: \[WaitNotInLoop\] .+"]},
570 {'category': 'java',
571 'severity': severity.MEDIUM,
Ian Rogers6e520032016-05-13 08:59:00 -0700572 'description':
573 'Java: Subclasses of Fragment must be instantiable via Class#newInstance(): the class must be public, static and have a public nullary constructor',
574 'patterns': [r".*: warning: \[FragmentNotInstantiable\] .+"]},
575 {'category': 'java',
576 'severity': severity.MEDIUM,
Ian Rogers6e520032016-05-13 08:59:00 -0700577 'description':
578 'Java: Hardcoded reference to /sdcard',
579 'patterns': [r".*: warning: \[HardCodedSdCardPath\] .+"]},
580 {'category': 'java',
581 'severity': severity.MEDIUM,
Ian Rogers6e520032016-05-13 08:59:00 -0700582 'description':
583 'Java: Incompatible type as argument to Object-accepting Java collections method',
584 'patterns': [r".*: warning: \[CollectionIncompatibleType\] .+"]},
585 {'category': 'java',
586 'severity': severity.MEDIUM,
Ian Rogers6e520032016-05-13 08:59:00 -0700587 'description':
588 'Java: @AssistedInject and @Inject should not be used on different constructors in the same class.',
589 'patterns': [r".*: warning: \[AssistedInjectAndInjectOnConstructors\] .+"]},
590 {'category': 'java',
591 'severity': severity.MEDIUM,
Ian Rogers6e520032016-05-13 08:59:00 -0700592 'description':
593 'Java: Although Guice allows injecting final fields, doing so is not recommended because the injected value may not be visible to other threads.',
594 'patterns': [r".*: warning: \[GuiceInjectOnFinalField\] .+"]},
595 {'category': 'java',
596 'severity': severity.MEDIUM,
Ian Rogers6e520032016-05-13 08:59:00 -0700597 'description':
598 '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.',
599 'patterns': [r".*: warning: \[OverridesGuiceInjectableMethod\] .+"]},
600 {'category': 'java',
601 'severity': severity.MEDIUM,
Ian Rogers6e520032016-05-13 08:59:00 -0700602 'description':
603 'Java: Double-checked locking on non-volatile fields is unsafe',
604 'patterns': [r".*: warning: \[DoubleCheckedLocking\] .+"]},
605 {'category': 'java',
606 'severity': severity.MEDIUM,
Ian Rogers6e520032016-05-13 08:59:00 -0700607 'description':
608 'Java: Writes to static fields should not be guarded by instance locks',
609 'patterns': [r".*: warning: \[StaticGuardedByInstance\] .+"]},
610 {'category': 'java',
611 'severity': severity.MEDIUM,
Ian Rogers6e520032016-05-13 08:59:00 -0700612 'description':
613 'Java: Synchronizing on non-final fields is not safe: if the field is ever updated, different threads may end up locking on different objects.',
614 'patterns': [r".*: warning: \[SynchronizeOnNonFinalField\] .+"]},
615 {'category': 'java',
616 'severity': severity.HIGH,
Ian Rogers6e520032016-05-13 08:59:00 -0700617 'description':
618 'Java: Reference equality used to compare arrays',
619 'patterns': [r".*: warning: \[ArrayEquals\] .+"]},
620 {'category': 'java',
621 'severity': severity.HIGH,
Ian Rogers6e520032016-05-13 08:59:00 -0700622 'description':
623 'Java: hashcode method on array does not hash array contents',
624 'patterns': [r".*: warning: \[ArrayHashCode\] .+"]},
625 {'category': 'java',
626 'severity': severity.HIGH,
Ian Rogers6e520032016-05-13 08:59:00 -0700627 'description':
628 'Java: Calling toString on an array does not provide useful information',
629 'patterns': [r".*: warning: \[ArrayToString.*\] .+"]},
630 {'category': 'java',
631 'severity': severity.HIGH,
Ian Rogers6e520032016-05-13 08:59:00 -0700632 'description':
633 'Java: Arrays.asList does not autobox primitive arrays, as one might expect.',
634 'patterns': [r".*: warning: \[ArraysAsListPrimitiveArray\] .+"]},
635 {'category': 'java',
636 'severity': severity.HIGH,
Ian Rogers6e520032016-05-13 08:59:00 -0700637 'description':
638 'Java: AsyncCallable should not return a null Future, only a Future whose result is null.',
639 'patterns': [r".*: warning: \[AsyncCallableReturnsNull\] .+"]},
640 {'category': 'java',
641 'severity': severity.HIGH,
Ian Rogers6e520032016-05-13 08:59:00 -0700642 'description':
643 'Java: AsyncFunction should not return a null Future, only a Future whose result is null.',
644 'patterns': [r".*: warning: \[AsyncFunctionReturnsNull\] .+"]},
645 {'category': 'java',
646 'severity': severity.HIGH,
Ian Rogers6e520032016-05-13 08:59:00 -0700647 'description':
648 'Java: Possible sign flip from narrowing conversion',
649 'patterns': [r".*: warning: \[BadComparable\] .+"]},
650 {'category': 'java',
651 'severity': severity.HIGH,
Ian Rogers6e520032016-05-13 08:59:00 -0700652 'description':
653 'Java: Shift by an amount that is out of range',
654 'patterns': [r".*: warning: \[BadShiftAmount\] .+"]},
655 {'category': 'java',
656 'severity': severity.HIGH,
Ian Rogers6e520032016-05-13 08:59:00 -0700657 'description':
658 'Java: valueOf provides better time and space performance',
659 'patterns': [r".*: warning: \[BoxedPrimitiveConstructor\] .+"]},
660 {'category': 'java',
661 'severity': severity.HIGH,
Ian Rogers6e520032016-05-13 08:59:00 -0700662 'description':
663 '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.',
664 'patterns': [r".*: warning: \[ChainingConstructorIgnoresParameter\] .+"]},
665 {'category': 'java',
666 'severity': severity.HIGH,
Ian Rogers6e520032016-05-13 08:59:00 -0700667 'description':
668 'Java: Ignored return value of method that is annotated with @CheckReturnValue',
669 'patterns': [r".*: warning: \[CheckReturnValue\] .+"]},
670 {'category': 'java',
671 'severity': severity.HIGH,
Ian Rogers6e520032016-05-13 08:59:00 -0700672 'description':
673 'Java: Inner class is non-static but does not reference enclosing class',
674 'patterns': [r".*: warning: \[ClassCanBeStatic\] .+"]},
675 {'category': 'java',
676 'severity': severity.HIGH,
Ian Rogers6e520032016-05-13 08:59:00 -0700677 'description':
678 'Java: The source file name should match the name of the top-level class it contains',
679 'patterns': [r".*: warning: \[ClassName\] .+"]},
680 {'category': 'java',
681 'severity': severity.HIGH,
Ian Rogers6e520032016-05-13 08:59:00 -0700682 'description':
683 'Java: This comparison method violates the contract',
684 'patterns': [r".*: warning: \[ComparisonContractViolated\] .+"]},
685 {'category': 'java',
686 'severity': severity.HIGH,
Ian Rogers6e520032016-05-13 08:59:00 -0700687 'description':
688 'Java: Comparison to value that is out of range for the compared type',
689 'patterns': [r".*: warning: \[ComparisonOutOfRange\] .+"]},
690 {'category': 'java',
691 'severity': severity.HIGH,
Ian Rogers6e520032016-05-13 08:59:00 -0700692 'description':
693 'Java: Non-compile-time constant expression passed to parameter with @CompileTimeConstant type annotation.',
694 'patterns': [r".*: warning: \[CompileTimeConstant\] .+"]},
695 {'category': 'java',
696 'severity': severity.HIGH,
Ian Rogers6e520032016-05-13 08:59:00 -0700697 'description':
698 'Java: Exception created but not thrown',
699 'patterns': [r".*: warning: \[DeadException\] .+"]},
700 {'category': 'java',
701 'severity': severity.HIGH,
Ian Rogers6e520032016-05-13 08:59:00 -0700702 'description':
703 'Java: Division by integer literal zero',
704 'patterns': [r".*: warning: \[DivZero\] .+"]},
705 {'category': 'java',
706 'severity': severity.HIGH,
Ian Rogers6e520032016-05-13 08:59:00 -0700707 'description':
708 'Java: Empty statement after if',
709 'patterns': [r".*: warning: \[EmptyIf\] .+"]},
710 {'category': 'java',
711 'severity': severity.HIGH,
Ian Rogers6e520032016-05-13 08:59:00 -0700712 'description':
713 'Java: == NaN always returns false; use the isNaN methods instead',
714 'patterns': [r".*: warning: \[EqualsNaN\] .+"]},
715 {'category': 'java',
716 'severity': severity.HIGH,
Ian Rogers6e520032016-05-13 08:59:00 -0700717 'description':
718 'Java: Method annotated @ForOverride must be protected or package-private and only invoked from declaring class',
719 'patterns': [r".*: warning: \[ForOverride\] .+"]},
720 {'category': 'java',
721 'severity': severity.HIGH,
Ian Rogers6e520032016-05-13 08:59:00 -0700722 'description':
723 'Java: Futures.getChecked requires a checked exception type with a standard constructor.',
724 'patterns': [r".*: warning: \[FuturesGetCheckedIllegalExceptionType\] .+"]},
725 {'category': 'java',
726 'severity': severity.HIGH,
Ian Rogers6e520032016-05-13 08:59:00 -0700727 'description':
728 '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',
729 'patterns': [r".*: warning: \[GetClassOnClass\] .+"]},
730 {'category': 'java',
731 'severity': severity.HIGH,
Ian Rogers6e520032016-05-13 08:59:00 -0700732 'description':
733 'Java: An object is tested for equality to itself using Guava Libraries',
734 'patterns': [r".*: warning: \[GuavaSelfEquals\] .+"]},
735 {'category': 'java',
736 'severity': severity.HIGH,
Ian Rogers6e520032016-05-13 08:59:00 -0700737 'description':
738 'Java: contains() is a legacy method that is equivalent to containsValue()',
739 'patterns': [r".*: warning: \[HashtableContains\] .+"]},
740 {'category': 'java',
741 'severity': severity.HIGH,
Ian Rogers6e520032016-05-13 08:59:00 -0700742 'description':
743 'Java: Cipher.getInstance() is invoked using either the default settings or ECB mode',
744 'patterns': [r".*: warning: \[InsecureCipherMode\] .+"]},
745 {'category': 'java',
746 'severity': severity.HIGH,
Ian Rogers6e520032016-05-13 08:59:00 -0700747 'description':
748 'Java: Invalid syntax used for a regular expression',
749 'patterns': [r".*: warning: \[InvalidPatternSyntax\] .+"]},
750 {'category': 'java',
751 'severity': severity.HIGH,
Ian Rogers6e520032016-05-13 08:59:00 -0700752 'description':
753 'Java: The argument to Class#isInstance(Object) should not be a Class',
754 'patterns': [r".*: warning: \[IsInstanceOfClass\] .+"]},
755 {'category': 'java',
756 'severity': severity.HIGH,
Ian Rogers6e520032016-05-13 08:59:00 -0700757 'description':
758 'Java: jMock tests must have a @RunWith(JMock.class) annotation, or the Mockery field must have a @Rule JUnit annotation',
759 'patterns': [r".*: warning: \[JMockTestWithoutRunWithOrRuleAnnotation\] .+"]},
760 {'category': 'java',
761 'severity': severity.HIGH,
Ian Rogers6e520032016-05-13 08:59:00 -0700762 'description':
763 'Java: Test method will not be run; please prefix name with "test"',
764 'patterns': [r".*: warning: \[JUnit3TestNotRun\] .+"]},
765 {'category': 'java',
766 'severity': severity.HIGH,
Ian Rogers6e520032016-05-13 08:59:00 -0700767 'description':
768 'Java: setUp() method will not be run; Please add a @Before annotation',
769 'patterns': [r".*: warning: \[JUnit4SetUpNotRun\] .+"]},
770 {'category': 'java',
771 'severity': severity.HIGH,
Ian Rogers6e520032016-05-13 08:59:00 -0700772 'description':
773 'Java: tearDown() method will not be run; Please add an @After annotation',
774 'patterns': [r".*: warning: \[JUnit4TearDownNotRun\] .+"]},
775 {'category': 'java',
776 'severity': severity.HIGH,
Ian Rogers6e520032016-05-13 08:59:00 -0700777 'description':
778 'Java: Test method will not be run; please add @Test annotation',
779 'patterns': [r".*: warning: \[JUnit4TestNotRun\] .+"]},
780 {'category': 'java',
781 'severity': severity.HIGH,
Ian Rogers6e520032016-05-13 08:59:00 -0700782 'description':
783 'Java: Printf-like format string does not match its arguments',
784 'patterns': [r".*: warning: \[MalformedFormatString\] .+"]},
785 {'category': 'java',
786 'severity': severity.HIGH,
Ian Rogers6e520032016-05-13 08:59:00 -0700787 'description':
788 'Java: Use of "YYYY" (week year) in a date pattern without "ww" (week in year). You probably meant to use "yyyy" (year) instead.',
789 'patterns': [r".*: warning: \[MisusedWeekYear\] .+"]},
790 {'category': 'java',
791 'severity': severity.HIGH,
Ian Rogers6e520032016-05-13 08:59:00 -0700792 'description':
793 'Java: A bug in Mockito will cause this test to fail at runtime with a ClassCastException',
794 'patterns': [r".*: warning: \[MockitoCast\] .+"]},
795 {'category': 'java',
796 'severity': severity.HIGH,
Ian Rogers6e520032016-05-13 08:59:00 -0700797 'description':
798 'Java: Missing method call for verify(mock) here',
799 'patterns': [r".*: warning: \[MockitoUsage\] .+"]},
800 {'category': 'java',
801 'severity': severity.HIGH,
Ian Rogers6e520032016-05-13 08:59:00 -0700802 'description':
803 'Java: Modifying a collection with itself',
804 'patterns': [r".*: warning: \[ModifyingCollectionWithItself\] .+"]},
805 {'category': 'java',
806 'severity': severity.HIGH,
Ian Rogers6e520032016-05-13 08:59:00 -0700807 'description':
808 'Java: Compound assignments to bytes, shorts, chars, and floats hide dangerous casts',
809 'patterns': [r".*: warning: \[NarrowingCompoundAssignment\] .+"]},
810 {'category': 'java',
811 'severity': severity.HIGH,
Ian Rogers6e520032016-05-13 08:59:00 -0700812 'description':
813 'Java: @NoAllocation was specified on this method, but something was found that would trigger an allocation',
814 'patterns': [r".*: warning: \[NoAllocation\] .+"]},
815 {'category': 'java',
816 'severity': severity.HIGH,
Ian Rogers6e520032016-05-13 08:59:00 -0700817 'description':
818 'Java: Static import of type uses non-canonical name',
819 'patterns': [r".*: warning: \[NonCanonicalStaticImport\] .+"]},
820 {'category': 'java',
821 'severity': severity.HIGH,
Ian Rogers6e520032016-05-13 08:59:00 -0700822 'description':
823 'Java: @CompileTimeConstant parameters should be final',
824 'patterns': [r".*: warning: \[NonFinalCompileTimeConstant\] .+"]},
825 {'category': 'java',
826 'severity': severity.HIGH,
Ian Rogers6e520032016-05-13 08:59:00 -0700827 'description':
828 'Java: Calling getAnnotation on an annotation that is not retained at runtime.',
829 'patterns': [r".*: warning: \[NonRuntimeAnnotation\] .+"]},
830 {'category': 'java',
831 'severity': severity.HIGH,
Ian Rogers6e520032016-05-13 08:59:00 -0700832 'description':
833 'Java: Numeric comparison using reference equality instead of value equality',
834 'patterns': [r".*: warning: \[NumericEquality\] .+"]},
835 {'category': 'java',
836 'severity': severity.HIGH,
Ian Rogers6e520032016-05-13 08:59:00 -0700837 'description':
838 'Java: Comparison using reference equality instead of value equality',
839 'patterns': [r".*: warning: \[OptionalEquality\] .+"]},
840 {'category': 'java',
841 'severity': severity.HIGH,
Ian Rogers6e520032016-05-13 08:59:00 -0700842 'description':
843 'Java: Varargs doesn\'t agree for overridden method',
844 'patterns': [r".*: warning: \[Overrides\] .+"]},
845 {'category': 'java',
846 'severity': severity.HIGH,
Ian Rogers6e520032016-05-13 08:59:00 -0700847 'description':
848 'Java: Literal passed as first argument to Preconditions.checkNotNull() can never be null',
849 'patterns': [r".*: warning: \[PreconditionsCheckNotNull\] .+"]},
850 {'category': 'java',
851 'severity': severity.HIGH,
Ian Rogers6e520032016-05-13 08:59:00 -0700852 'description':
853 'Java: First argument to `Preconditions.checkNotNull()` is a primitive rather than an object reference',
854 'patterns': [r".*: warning: \[PreconditionsCheckNotNullPrimitive\] .+"]},
855 {'category': 'java',
856 'severity': severity.HIGH,
Ian Rogers6e520032016-05-13 08:59:00 -0700857 'description':
858 'Java: Protobuf fields cannot be null',
859 'patterns': [r".*: warning: \[ProtoFieldNullComparison\] .+"]},
860 {'category': 'java',
861 'severity': severity.HIGH,
Ian Rogers6e520032016-05-13 08:59:00 -0700862 'description':
863 'Java: Comparing protobuf fields of type String using reference equality',
864 'patterns': [r".*: warning: \[ProtoStringFieldReferenceEquality\] .+"]},
865 {'category': 'java',
866 'severity': severity.HIGH,
Ian Rogers6e520032016-05-13 08:59:00 -0700867 'description':
868 'Java: Check for non-whitelisted callers to RestrictedApiChecker.',
869 'patterns': [r".*: warning: \[RestrictedApiChecker\] .+"]},
870 {'category': 'java',
871 'severity': severity.HIGH,
Ian Rogers6e520032016-05-13 08:59:00 -0700872 'description':
873 'Java: Return value of this method must be used',
874 'patterns': [r".*: warning: \[ReturnValueIgnored\] .+"]},
875 {'category': 'java',
876 'severity': severity.HIGH,
Ian Rogers6e520032016-05-13 08:59:00 -0700877 'description':
878 'Java: Variable assigned to itself',
879 'patterns': [r".*: warning: \[SelfAssignment\] .+"]},
880 {'category': 'java',
881 'severity': severity.HIGH,
Ian Rogers6e520032016-05-13 08:59:00 -0700882 'description':
883 'Java: An object is compared to itself',
884 'patterns': [r".*: warning: \[SelfComparision\] .+"]},
885 {'category': 'java',
886 'severity': severity.HIGH,
Ian Rogers6e520032016-05-13 08:59:00 -0700887 'description':
888 'Java: Variable compared to itself',
889 'patterns': [r".*: warning: \[SelfEquality\] .+"]},
890 {'category': 'java',
891 'severity': severity.HIGH,
Ian Rogers6e520032016-05-13 08:59:00 -0700892 'description':
893 'Java: An object is tested for equality to itself',
894 'patterns': [r".*: warning: \[SelfEquals\] .+"]},
895 {'category': 'java',
896 'severity': severity.HIGH,
Ian Rogers6e520032016-05-13 08:59:00 -0700897 'description':
898 'Java: Comparison of a size >= 0 is always true, did you intend to check for non-emptiness?',
899 'patterns': [r".*: warning: \[SizeGreaterThanOrEqualsZero\] .+"]},
900 {'category': 'java',
901 'severity': severity.HIGH,
Ian Rogers6e520032016-05-13 08:59:00 -0700902 'description':
903 'Java: Calling toString on a Stream does not provide useful information',
904 'patterns': [r".*: warning: \[StreamToString\] .+"]},
905 {'category': 'java',
906 'severity': severity.HIGH,
Ian Rogers6e520032016-05-13 08:59:00 -0700907 'description':
908 'Java: StringBuilder does not have a char constructor; this invokes the int constructor.',
909 'patterns': [r".*: warning: \[StringBuilderInitWithChar\] .+"]},
910 {'category': 'java',
911 'severity': severity.HIGH,
Ian Rogers6e520032016-05-13 08:59:00 -0700912 'description':
913 'Java: Suppressing "deprecated" is probably a typo for "deprecation"',
914 'patterns': [r".*: warning: \[SuppressWarningsDeprecated\] .+"]},
915 {'category': 'java',
916 'severity': severity.HIGH,
Ian Rogers6e520032016-05-13 08:59:00 -0700917 'description':
918 'Java: throwIfUnchecked(knownCheckedException) is a no-op.',
919 'patterns': [r".*: warning: \[ThrowIfUncheckedKnownChecked\] .+"]},
920 {'category': 'java',
921 'severity': severity.HIGH,
Ian Rogers6e520032016-05-13 08:59:00 -0700922 'description':
923 'Java: Catching Throwable/Error masks failures from fail() or assert*() in the try block',
924 'patterns': [r".*: warning: \[TryFailThrowable\] .+"]},
925 {'category': 'java',
926 'severity': severity.HIGH,
Ian Rogers6e520032016-05-13 08:59:00 -0700927 'description':
928 'Java: Type parameter used as type qualifier',
929 'patterns': [r".*: warning: \[TypeParameterQualifier\] .+"]},
930 {'category': 'java',
931 'severity': severity.HIGH,
Ian Rogers6e520032016-05-13 08:59:00 -0700932 'description':
933 'Java: Non-generic methods should not be invoked with type arguments',
934 'patterns': [r".*: warning: \[UnnecessaryTypeArgument\] .+"]},
935 {'category': 'java',
936 'severity': severity.HIGH,
Ian Rogers6e520032016-05-13 08:59:00 -0700937 'description':
938 'Java: Instance created but never used',
939 'patterns': [r".*: warning: \[UnusedAnonymousClass\] .+"]},
940 {'category': 'java',
941 'severity': severity.HIGH,
Ian Rogers6e520032016-05-13 08:59:00 -0700942 'description':
943 'Java: Use of wildcard imports is forbidden',
944 'patterns': [r".*: warning: \[WildcardImport\] .+"]},
945 {'category': 'java',
946 'severity': severity.HIGH,
Ian Rogers6e520032016-05-13 08:59:00 -0700947 'description':
948 'Java: Method parameter has wrong package',
949 'patterns': [r".*: warning: \[ParameterPackage\] .+"]},
950 {'category': 'java',
951 'severity': severity.HIGH,
Ian Rogers6e520032016-05-13 08:59:00 -0700952 'description':
953 'Java: Certain resources in `android.R.string` have names that do not match their content',
954 'patterns': [r".*: warning: \[MislabeledAndroidString\] .+"]},
955 {'category': 'java',
956 'severity': severity.HIGH,
Ian Rogers6e520032016-05-13 08:59:00 -0700957 'description':
958 'Java: Return value of android.graphics.Rect.intersect() must be checked',
959 'patterns': [r".*: warning: \[RectIntersectReturnValueIgnored\] .+"]},
960 {'category': 'java',
961 'severity': severity.HIGH,
Ian Rogers6e520032016-05-13 08:59:00 -0700962 'description':
963 'Java: Invalid printf-style format string',
964 'patterns': [r".*: warning: \[FormatString\] .+"]},
965 {'category': 'java',
966 'severity': severity.HIGH,
Ian Rogers6e520032016-05-13 08:59:00 -0700967 'description':
968 'Java: @AssistedInject and @Inject cannot be used on the same constructor.',
969 'patterns': [r".*: warning: \[AssistedInjectAndInjectOnSameConstructor\] .+"]},
970 {'category': 'java',
971 'severity': severity.HIGH,
Ian Rogers6e520032016-05-13 08:59:00 -0700972 'description':
973 'Java: Injected constructors cannot be optional nor have binding annotations',
974 'patterns': [r".*: warning: \[InjectedConstructorAnnotations\] .+"]},
975 {'category': 'java',
976 'severity': severity.HIGH,
Ian Rogers6e520032016-05-13 08:59:00 -0700977 'description':
978 'Java: The target of a scoping annotation must be set to METHOD and/or TYPE.',
979 'patterns': [r".*: warning: \[InjectInvalidTargetingOnScopingAnnotation\] .+"]},
980 {'category': 'java',
981 'severity': severity.HIGH,
Ian Rogers6e520032016-05-13 08:59:00 -0700982 'description':
983 'Java: Abstract methods are not injectable with javax.inject.Inject.',
984 'patterns': [r".*: warning: \[JavaxInjectOnAbstractMethod\] .+"]},
985 {'category': 'java',
986 'severity': severity.HIGH,
Ian Rogers6e520032016-05-13 08:59:00 -0700987 'description':
988 'Java: @javax.inject.Inject cannot be put on a final field.',
989 'patterns': [r".*: warning: \[JavaxInjectOnFinalField\] .+"]},
990 {'category': 'java',
991 'severity': severity.HIGH,
Ian Rogers6e520032016-05-13 08:59:00 -0700992 'description':
993 'Java: A class may not have more than one injectable constructor.',
994 'patterns': [r".*: warning: \[MoreThanOneInjectableConstructor\] .+"]},
995 {'category': 'java',
996 'severity': severity.HIGH,
Ian Rogers6e520032016-05-13 08:59:00 -0700997 'description':
998 'Java: Using more than one qualifier annotation on the same element is not allowed.',
999 'patterns': [r".*: warning: \[InjectMoreThanOneQualifier\] .+"]},
1000 {'category': 'java',
1001 'severity': severity.HIGH,
Ian Rogers6e520032016-05-13 08:59:00 -07001002 'description':
1003 'Java: A class can be annotated with at most one scope annotation',
1004 'patterns': [r".*: warning: \[InjectMoreThanOneScopeAnnotationOnClass\] .+"]},
1005 {'category': 'java',
1006 'severity': severity.HIGH,
Ian Rogers6e520032016-05-13 08:59:00 -07001007 'description':
1008 'Java: Annotations cannot be both Qualifiers/BindingAnnotations and Scopes',
1009 'patterns': [r".*: warning: \[OverlappingQualifierAndScopeAnnotation\] .+"]},
1010 {'category': 'java',
1011 'severity': severity.HIGH,
Ian Rogers6e520032016-05-13 08:59:00 -07001012 'description':
1013 'Java: Scope annotation on an interface or abstact class is not allowed',
1014 'patterns': [r".*: warning: \[InjectScopeAnnotationOnInterfaceOrAbstractClass\] .+"]},
1015 {'category': 'java',
1016 'severity': severity.HIGH,
Ian Rogers6e520032016-05-13 08:59:00 -07001017 'description':
1018 'Java: Scoping and qualifier annotations must have runtime retention.',
1019 'patterns': [r".*: warning: \[InjectScopeOrQualifierAnnotationRetention\] .+"]},
1020 {'category': 'java',
1021 'severity': severity.HIGH,
Ian Rogers6e520032016-05-13 08:59:00 -07001022 'description':
1023 'Java: Dagger @Provides methods may not return null unless annotated with @Nullable',
1024 'patterns': [r".*: warning: \[DaggerProvidesNull\] .+"]},
1025 {'category': 'java',
1026 'severity': severity.HIGH,
Ian Rogers6e520032016-05-13 08:59:00 -07001027 'description':
1028 'Java: Scope annotation on implementation class of AssistedInject factory is not allowed',
1029 'patterns': [r".*: warning: \[GuiceAssistedInjectScoping\] .+"]},
1030 {'category': 'java',
1031 'severity': severity.HIGH,
Ian Rogers6e520032016-05-13 08:59:00 -07001032 'description':
1033 'Java: A constructor cannot have two @Assisted parameters of the same type unless they are disambiguated with named @Assisted annotations. ',
1034 'patterns': [r".*: warning: \[GuiceAssistedParameters\] .+"]},
1035 {'category': 'java',
1036 'severity': severity.HIGH,
Ian Rogers6e520032016-05-13 08:59:00 -07001037 'description':
1038 'Java: This method is not annotated with @Inject, but it overrides a method that is annotated with @javax.inject.Inject.',
1039 'patterns': [r".*: warning: \[OverridesJavaxInjectableMethod\] .+"]},
1040 {'category': 'java',
1041 'severity': severity.HIGH,
Ian Rogers6e520032016-05-13 08:59:00 -07001042 'description':
1043 'Java: Checks for unguarded accesses to fields and methods with @GuardedBy annotations',
1044 'patterns': [r".*: warning: \[GuardedByChecker\] .+"]},
1045 {'category': 'java',
1046 'severity': severity.HIGH,
Ian Rogers6e520032016-05-13 08:59:00 -07001047 'description':
1048 'Java: Invalid @GuardedBy expression',
1049 'patterns': [r".*: warning: \[GuardedByValidator\] .+"]},
1050 {'category': 'java',
1051 'severity': severity.HIGH,
Ian Rogers6e520032016-05-13 08:59:00 -07001052 'description':
1053 'Java: Type declaration annotated with @Immutable is not immutable',
1054 'patterns': [r".*: warning: \[Immutable\] .+"]},
1055 {'category': 'java',
1056 'severity': severity.HIGH,
Ian Rogers6e520032016-05-13 08:59:00 -07001057 'description':
1058 'Java: This method does not acquire the locks specified by its @LockMethod annotation',
1059 'patterns': [r".*: warning: \[LockMethodChecker\] .+"]},
1060 {'category': 'java',
1061 'severity': severity.HIGH,
Ian Rogers6e520032016-05-13 08:59:00 -07001062 'description':
1063 'Java: This method does not acquire the locks specified by its @UnlockMethod annotation',
1064 'patterns': [r".*: warning: \[UnlockMethod\] .+"]},
Ian Rogers32bb9bd2016-05-09 23:19:42 -07001065
Ian Rogers6e520032016-05-13 08:59:00 -07001066 {'category': 'java',
1067 'severity': severity.UNKNOWN,
Ian Rogers6e520032016-05-13 08:59:00 -07001068 'description': 'Java: Unclassified/unrecognized warnings',
1069 'patterns': [r".*: warning: \[.+\] .+"]},
Ian Rogers32bb9bd2016-05-09 23:19:42 -07001070
Chih-Hung Hsieh99459fc2016-09-22 13:43:12 -07001071 { 'category':'aapt', 'severity':severity.MEDIUM,
Marco Nelissen8e201962010-03-10 16:16:02 -08001072 'description':'aapt: No default translation',
1073 'patterns':[r".*: warning: string '.+' has no default translation in .*"] },
Chih-Hung Hsieh99459fc2016-09-22 13:43:12 -07001074 { 'category':'aapt', 'severity':severity.MEDIUM,
Marco Nelissen8e201962010-03-10 16:16:02 -08001075 'description':'aapt: Missing default or required localization',
1076 'patterns':[r".*: warning: \*\*\*\* string '.+' has no default or required localization for '.+' in .+"] },
Chih-Hung Hsieh99459fc2016-09-22 13:43:12 -07001077 { 'category':'aapt', 'severity':severity.MEDIUM,
Marco Nelissen594375d2009-07-14 09:04:04 -07001078 'description':'aapt: String marked untranslatable, but translation exists',
1079 'patterns':[r".*: warning: string '.+' in .* marked untranslatable but exists in locale '??_??'"] },
Chih-Hung Hsieh99459fc2016-09-22 13:43:12 -07001080 { 'category':'aapt', 'severity':severity.MEDIUM,
Marco Nelissen594375d2009-07-14 09:04:04 -07001081 'description':'aapt: empty span in string',
1082 'patterns':[r".*: warning: empty '.+' span found in text '.+"] },
Chih-Hung Hsieh99459fc2016-09-22 13:43:12 -07001083 { 'category':'C/C++', 'severity':severity.MEDIUM,
Marco Nelissen594375d2009-07-14 09:04:04 -07001084 'description':'Taking address of temporary',
1085 'patterns':[r".*: warning: taking address of temporary"] },
Chih-Hung Hsieh99459fc2016-09-22 13:43:12 -07001086 { 'category':'C/C++', 'severity':severity.MEDIUM,
Marco Nelissen594375d2009-07-14 09:04:04 -07001087 'description':'Possible broken line continuation',
1088 'patterns':[r".*: warning: backslash and newline separated by space"] },
Chih-Hung Hsieh99459fc2016-09-22 13:43:12 -07001089 { 'category':'C/C++', 'severity':severity.MEDIUM, 'option':'-Wundefined-var-template',
Chih-Hung Hsiehc21ddbd2016-07-20 10:08:51 -07001090 'description':'Undefined variable template',
1091 'patterns':[r".*: warning: instantiation of variable .* no definition is available"] },
Chih-Hung Hsieh99459fc2016-09-22 13:43:12 -07001092 { 'category':'C/C++', 'severity':severity.MEDIUM, 'option':'-Wundefined-inline',
Chih-Hung Hsieh8d145432016-07-01 15:48:06 -07001093 'description':'Inline function is not defined',
1094 'patterns':[r".*: warning: inline function '.*' is not defined"] },
Chih-Hung Hsieh99459fc2016-09-22 13:43:12 -07001095 { 'category':'C/C++', 'severity':severity.MEDIUM, 'option':'-Warray-bounds',
Marco Nelissen594375d2009-07-14 09:04:04 -07001096 'description':'Array subscript out of bounds',
Marco Nelissen8e201962010-03-10 16:16:02 -08001097 'patterns':[r".*: warning: array subscript is above array bounds",
Chih-Hung Hsiehba0ddcd2016-03-21 11:28:30 -07001098 r".*: warning: Array subscript is undefined",
Marco Nelissen8e201962010-03-10 16:16:02 -08001099 r".*: warning: array subscript is below array bounds"] },
Chih-Hung Hsieh99459fc2016-09-22 13:43:12 -07001100 { 'category':'C/C++', 'severity':severity.MEDIUM,
Chih-Hung Hsiehba0ddcd2016-03-21 11:28:30 -07001101 'description':'Excess elements in initializer',
1102 'patterns':[r".*: warning: excess elements in .+ initializer"] },
Chih-Hung Hsieh99459fc2016-09-22 13:43:12 -07001103 { 'category':'C/C++', 'severity':severity.MEDIUM,
Marco Nelissen594375d2009-07-14 09:04:04 -07001104 'description':'Decimal constant is unsigned only in ISO C90',
1105 'patterns':[r".*: warning: this decimal constant is unsigned only in ISO C90"] },
Chih-Hung Hsieh99459fc2016-09-22 13:43:12 -07001106 { 'category':'C/C++', 'severity':severity.MEDIUM, 'option':'-Wmain',
Marco Nelissen594375d2009-07-14 09:04:04 -07001107 'description':'main is usually a function',
1108 'patterns':[r".*: warning: 'main' is usually a function"] },
Chih-Hung Hsieh99459fc2016-09-22 13:43:12 -07001109 { 'category':'C/C++', 'severity':severity.MEDIUM,
Marco Nelissen594375d2009-07-14 09:04:04 -07001110 'description':'Typedef ignored',
1111 'patterns':[r".*: warning: 'typedef' was ignored in this declaration"] },
Chih-Hung Hsieh99459fc2016-09-22 13:43:12 -07001112 { 'category':'C/C++', 'severity':severity.HIGH, 'option':'-Waddress',
Marco Nelissen594375d2009-07-14 09:04:04 -07001113 'description':'Address always evaluates to true',
1114 'patterns':[r".*: warning: the address of '.+' will always evaluate as 'true'"] },
Chih-Hung Hsieh99459fc2016-09-22 13:43:12 -07001115 { 'category':'C/C++', 'severity':severity.FIXMENOW,
Marco Nelissen594375d2009-07-14 09:04:04 -07001116 'description':'Freeing a non-heap object',
1117 'patterns':[r".*: warning: attempt to free a non-heap object '.+'"] },
Chih-Hung Hsieh99459fc2016-09-22 13:43:12 -07001118 { 'category':'C/C++', 'severity':severity.MEDIUM, 'option':'-Wchar-subscripts',
Marco Nelissen594375d2009-07-14 09:04:04 -07001119 'description':'Array subscript has type char',
Chih-Hung Hsiehf8aaf602016-03-16 12:18:16 -07001120 'patterns':[r".*: warning: array subscript .+ type 'char'.+Wchar-subscripts"] },
Chih-Hung Hsieh99459fc2016-09-22 13:43:12 -07001121 { 'category':'C/C++', 'severity':severity.MEDIUM,
Marco Nelissen594375d2009-07-14 09:04:04 -07001122 'description':'Constant too large for type',
1123 'patterns':[r".*: warning: integer constant is too large for '.+' type"] },
Chih-Hung Hsieh99459fc2016-09-22 13:43:12 -07001124 { 'category':'C/C++', 'severity':severity.MEDIUM, 'option':'-Woverflow',
Marco Nelissen594375d2009-07-14 09:04:04 -07001125 'description':'Constant too large for type, truncated',
1126 'patterns':[r".*: warning: large integer implicitly truncated to unsigned type"] },
Chih-Hung Hsieh99459fc2016-09-22 13:43:12 -07001127 { 'category':'C/C++', 'severity':severity.MEDIUM, 'option':'-Winteger-overflow',
Chih-Hung Hsieh8d145432016-07-01 15:48:06 -07001128 'description':'Overflow in expression',
1129 'patterns':[r".*: warning: overflow in expression; .*Winteger-overflow"] },
Chih-Hung Hsieh99459fc2016-09-22 13:43:12 -07001130 { 'category':'C/C++', 'severity':severity.MEDIUM, 'option':'-Woverflow',
Marco Nelissen594375d2009-07-14 09:04:04 -07001131 'description':'Overflow in implicit constant conversion',
1132 'patterns':[r".*: warning: overflow in implicit constant conversion"] },
Chih-Hung Hsieh99459fc2016-09-22 13:43:12 -07001133 { 'category':'C/C++', 'severity':severity.MEDIUM,
Marco Nelissen594375d2009-07-14 09:04:04 -07001134 'description':'Declaration does not declare anything',
1135 'patterns':[r".*: warning: declaration 'class .+' does not declare anything"] },
Chih-Hung Hsieh99459fc2016-09-22 13:43:12 -07001136 { 'category':'C/C++', 'severity':severity.MEDIUM, 'option':'-Wreorder',
Marco Nelissen594375d2009-07-14 09:04:04 -07001137 'description':'Initialization order will be different',
Chih-Hung Hsiehba0ddcd2016-03-21 11:28:30 -07001138 'patterns':[r".*: warning: '.+' will be initialized after",
1139 r".*: warning: field .+ will be initialized after .+Wreorder"] },
Chih-Hung Hsieh99459fc2016-09-22 13:43:12 -07001140 { 'category':'cont.', 'severity':severity.SKIP,
Marco Nelissen594375d2009-07-14 09:04:04 -07001141 'description':'',
1142 'patterns':[r".*: warning: '.+'"] },
Chih-Hung Hsieh99459fc2016-09-22 13:43:12 -07001143 { 'category':'cont.', 'severity':severity.SKIP,
Marco Nelissen594375d2009-07-14 09:04:04 -07001144 'description':'',
Marco Nelissen8e201962010-03-10 16:16:02 -08001145 'patterns':[r".*: warning: base '.+'"] },
Chih-Hung Hsieh99459fc2016-09-22 13:43:12 -07001146 { 'category':'cont.', 'severity':severity.SKIP,
Marco Nelissen8e201962010-03-10 16:16:02 -08001147 'description':'',
Marco Nelissen594375d2009-07-14 09:04:04 -07001148 'patterns':[r".*: warning: when initialized here"] },
Chih-Hung Hsieh99459fc2016-09-22 13:43:12 -07001149 { 'category':'C/C++', 'severity':severity.MEDIUM, 'option':'-Wmissing-parameter-type',
Marco Nelissen594375d2009-07-14 09:04:04 -07001150 'description':'Parameter type not specified',
1151 'patterns':[r".*: warning: type of '.+' defaults to 'int'"] },
Chih-Hung Hsieh99459fc2016-09-22 13:43:12 -07001152 { 'category':'C/C++', 'severity':severity.MEDIUM, 'option':'-Wmissing-declarations',
Chih-Hung Hsieh8d145432016-07-01 15:48:06 -07001153 'description':'Missing declarations',
1154 'patterns':[r".*: warning: declaration does not declare anything"] },
Chih-Hung Hsieh99459fc2016-09-22 13:43:12 -07001155 { 'category':'C/C++', 'severity':severity.MEDIUM, 'option':'-Wmissing-noreturn',
Chih-Hung Hsieh8d145432016-07-01 15:48:06 -07001156 'description':'Missing noreturn',
1157 'patterns':[r".*: warning: function '.*' could be declared with attribute 'noreturn'"] },
Chih-Hung Hsieh99459fc2016-09-22 13:43:12 -07001158 { 'category':'gcc', 'severity':severity.MEDIUM,
Marco Nelissen594375d2009-07-14 09:04:04 -07001159 'description':'Invalid option for C file',
1160 'patterns':[r".*: warning: command line option "".+"" is valid for C\+\+\/ObjC\+\+ but not for C"] },
Chih-Hung Hsieh99459fc2016-09-22 13:43:12 -07001161 { 'category':'C/C++', 'severity':severity.MEDIUM,
Marco Nelissen594375d2009-07-14 09:04:04 -07001162 'description':'User warning',
1163 'patterns':[r".*: warning: #warning "".+"""] },
Chih-Hung Hsieh99459fc2016-09-22 13:43:12 -07001164 { 'category':'C/C++', 'severity':severity.MEDIUM, 'option':'-Wvexing-parse',
Chih-Hung Hsieh8d145432016-07-01 15:48:06 -07001165 'description':'Vexing parsing problem',
1166 'patterns':[r".*: warning: empty parentheses interpreted as a function declaration"] },
Chih-Hung Hsieh99459fc2016-09-22 13:43:12 -07001167 { 'category':'C/C++', 'severity':severity.MEDIUM, 'option':'-Wextra',
Marco Nelissen594375d2009-07-14 09:04:04 -07001168 'description':'Dereferencing void*',
1169 'patterns':[r".*: warning: dereferencing 'void \*' pointer"] },
Chih-Hung Hsieh99459fc2016-09-22 13:43:12 -07001170 { 'category':'C/C++', 'severity':severity.MEDIUM,
Chih-Hung Hsieh8d145432016-07-01 15:48:06 -07001171 'description':'Comparison of pointer and integer',
1172 'patterns':[r".*: warning: ordered comparison of pointer with integer zero",
1173 r".*: warning: .*comparison between pointer and integer"] },
Chih-Hung Hsieh99459fc2016-09-22 13:43:12 -07001174 { 'category':'C/C++', 'severity':severity.MEDIUM,
Chih-Hung Hsieh8d145432016-07-01 15:48:06 -07001175 'description':'Use of error-prone unary operator',
1176 'patterns':[r".*: warning: use of unary operator that may be intended as compound assignment"] },
Chih-Hung Hsieh99459fc2016-09-22 13:43:12 -07001177 { 'category':'C/C++', 'severity':severity.MEDIUM, 'option':'-Wwrite-strings',
Marco Nelissen594375d2009-07-14 09:04:04 -07001178 'description':'Conversion of string constant to non-const char*',
1179 'patterns':[r".*: warning: deprecated conversion from string constant to '.+'"] },
Chih-Hung Hsieh99459fc2016-09-22 13:43:12 -07001180 { 'category':'C/C++', 'severity':severity.MEDIUM, 'option':'-Wstrict-prototypes',
Marco Nelissen594375d2009-07-14 09:04:04 -07001181 'description':'Function declaration isn''t a prototype',
1182 'patterns':[r".*: warning: function declaration isn't a prototype"] },
Chih-Hung Hsieh99459fc2016-09-22 13:43:12 -07001183 { 'category':'C/C++', 'severity':severity.MEDIUM, 'option':'-Wignored-qualifiers',
Marco Nelissen594375d2009-07-14 09:04:04 -07001184 'description':'Type qualifiers ignored on function return value',
Chih-Hung Hsiehf8aaf602016-03-16 12:18:16 -07001185 'patterns':[r".*: warning: type qualifiers ignored on function return type",
1186 r".*: warning: .+ type qualifier .+ has no effect .+Wignored-qualifiers"] },
Chih-Hung Hsieh99459fc2016-09-22 13:43:12 -07001187 { 'category':'C/C++', 'severity':severity.MEDIUM,
Marco Nelissen594375d2009-07-14 09:04:04 -07001188 'description':'<foo> declared inside parameter list, scope limited to this definition',
1189 'patterns':[r".*: warning: '.+' declared inside parameter list"] },
Chih-Hung Hsieh99459fc2016-09-22 13:43:12 -07001190 { 'category':'cont.', 'severity':severity.SKIP,
Marco Nelissen594375d2009-07-14 09:04:04 -07001191 'description':'',
1192 'patterns':[r".*: warning: its scope is only this definition or declaration, which is probably not what you want"] },
Chih-Hung Hsieh99459fc2016-09-22 13:43:12 -07001193 { 'category':'C/C++', 'severity':severity.LOW, 'option':'-Wcomment',
Marco Nelissen594375d2009-07-14 09:04:04 -07001194 'description':'Line continuation inside comment',
1195 'patterns':[r".*: warning: multi-line comment"] },
Chih-Hung Hsieh99459fc2016-09-22 13:43:12 -07001196 { 'category':'C/C++', 'severity':severity.LOW, 'option':'-Wcomment',
Marco Nelissen8e201962010-03-10 16:16:02 -08001197 'description':'Comment inside comment',
1198 'patterns':[r".*: warning: "".+"" within comment"] },
Chih-Hung Hsieh0862c482016-09-06 16:26:46 -07001199 # Warning "value stored is never read" could be from clang-tidy or clang static analyzer.
Chih-Hung Hsieh99459fc2016-09-22 13:43:12 -07001200 { 'category':'C/C++', 'severity':severity.TIDY,
Chih-Hung Hsieh0862c482016-09-06 16:26:46 -07001201 'description':'clang-tidy Value stored is never read',
1202 'patterns':[r".*: warning: Value stored to .+ is never read.*clang-analyzer-deadcode.DeadStores"] },
Chih-Hung Hsieh99459fc2016-09-22 13:43:12 -07001203 { 'category':'C/C++', 'severity':severity.LOW,
Chih-Hung Hsiehf8aaf602016-03-16 12:18:16 -07001204 'description':'Value stored is never read',
1205 'patterns':[r".*: warning: Value stored to .+ is never read"] },
Chih-Hung Hsieh99459fc2016-09-22 13:43:12 -07001206 { 'category':'C/C++', 'severity':severity.LOW, 'option':'-Wdeprecated-declarations',
Chih-Hung Hsiehf8aaf602016-03-16 12:18:16 -07001207 'description':'Deprecated declarations',
1208 'patterns':[r".*: warning: .+ is deprecated.+deprecated-declarations"] },
Chih-Hung Hsieh99459fc2016-09-22 13:43:12 -07001209 { 'category':'C/C++', 'severity':severity.LOW, 'option':'-Wdeprecated-register',
Chih-Hung Hsieh90d46192016-03-29 15:33:11 -07001210 'description':'Deprecated register',
1211 'patterns':[r".*: warning: 'register' storage class specifier is deprecated"] },
Chih-Hung Hsieh99459fc2016-09-22 13:43:12 -07001212 { 'category':'C/C++', 'severity':severity.LOW, 'option':'-Wpointer-sign',
Chih-Hung Hsiehf8aaf602016-03-16 12:18:16 -07001213 'description':'Converts between pointers to integer types with different sign',
1214 'patterns':[r".*: warning: .+ converts between pointers to integer types with different sign"] },
Chih-Hung Hsieh99459fc2016-09-22 13:43:12 -07001215 { 'category':'C/C++', 'severity':severity.HARMLESS,
Marco Nelissen594375d2009-07-14 09:04:04 -07001216 'description':'Extra tokens after #endif',
1217 'patterns':[r".*: warning: extra tokens at end of #endif directive"] },
Chih-Hung Hsieh99459fc2016-09-22 13:43:12 -07001218 { 'category':'C/C++', 'severity':severity.MEDIUM, 'option':'-Wenum-compare',
Marco Nelissen594375d2009-07-14 09:04:04 -07001219 'description':'Comparison between different enums',
Chih-Hung Hsiehf8aaf602016-03-16 12:18:16 -07001220 'patterns':[r".*: warning: comparison between '.+' and '.+'.+Wenum-compare"] },
Chih-Hung Hsieh99459fc2016-09-22 13:43:12 -07001221 { 'category':'C/C++', 'severity':severity.MEDIUM, 'option':'-Wconversion',
Chih-Hung Hsieh8d145432016-07-01 15:48:06 -07001222 'description':'Conversion may change value',
1223 'patterns':[r".*: warning: converting negative value '.+' to '.+'",
Chih-Hung Hsieh01530a62016-08-24 12:24:32 -07001224 r".*: warning: conversion to '.+' .+ may (alter|change)"] },
Chih-Hung Hsieh99459fc2016-09-22 13:43:12 -07001225 { 'category':'C/C++', 'severity':severity.MEDIUM, 'option':'-Wconversion-null',
Chih-Hung Hsieh8d145432016-07-01 15:48:06 -07001226 'description':'Converting to non-pointer type from NULL',
1227 'patterns':[r".*: warning: converting to non-pointer type '.+' from NULL"] },
Chih-Hung Hsieh99459fc2016-09-22 13:43:12 -07001228 { 'category':'C/C++', 'severity':severity.MEDIUM, 'option':'-Wnull-conversion',
Chih-Hung Hsieh8d145432016-07-01 15:48:06 -07001229 'description':'Converting NULL to non-pointer type',
1230 'patterns':[r".*: warning: implicit conversion of NULL constant to '.+'"] },
Chih-Hung Hsieh99459fc2016-09-22 13:43:12 -07001231 { 'category':'C/C++', 'severity':severity.MEDIUM, 'option':'-Wnon-literal-null-conversion',
Chih-Hung Hsieh8d145432016-07-01 15:48:06 -07001232 'description':'Zero used as null pointer',
1233 'patterns':[r".*: warning: expression .* zero treated as a null pointer constant"] },
Chih-Hung Hsieh99459fc2016-09-22 13:43:12 -07001234 { 'category':'C/C++', 'severity':severity.MEDIUM,
Chih-Hung Hsieh8d145432016-07-01 15:48:06 -07001235 'description':'Implicit conversion changes value',
Chih-Hung Hsiehc21ddbd2016-07-20 10:08:51 -07001236 'patterns':[r".*: warning: implicit conversion .* changes value from .* to .*-conversion"] },
Chih-Hung Hsieh99459fc2016-09-22 13:43:12 -07001237 { 'category':'C/C++', 'severity':severity.MEDIUM,
Marco Nelissen594375d2009-07-14 09:04:04 -07001238 'description':'Passing NULL as non-pointer argument',
Marco Nelissen5236fbd2009-07-31 08:30:34 -07001239 'patterns':[r".*: warning: passing NULL to non-pointer argument [0-9]+ of '.+'"] },
Chih-Hung Hsieh99459fc2016-09-22 13:43:12 -07001240 { 'category':'C/C++', 'severity':severity.MEDIUM, 'option':'-Wctor-dtor-privacy',
Marco Nelissen594375d2009-07-14 09:04:04 -07001241 'description':'Class seems unusable because of private ctor/dtor' ,
1242 'patterns':[r".*: warning: all member functions in class '.+' are private"] },
1243 # skip this next one, because it only points out some RefBase-based classes where having a private destructor is perfectly fine
Chih-Hung Hsieh99459fc2016-09-22 13:43:12 -07001244 { 'category':'C/C++', 'severity':severity.SKIP, 'option':'-Wctor-dtor-privacy',
Marco Nelissen594375d2009-07-14 09:04:04 -07001245 'description':'Class seems unusable because of private ctor/dtor' ,
1246 'patterns':[r".*: warning: 'class .+' only defines a private destructor and has no friends"] },
Chih-Hung Hsieh99459fc2016-09-22 13:43:12 -07001247 { 'category':'C/C++', 'severity':severity.MEDIUM, 'option':'-Wctor-dtor-privacy',
Marco Nelissen594375d2009-07-14 09:04:04 -07001248 'description':'Class seems unusable because of private ctor/dtor' ,
1249 'patterns':[r".*: warning: 'class .+' only defines private constructors and has no friends"] },
Chih-Hung Hsieh99459fc2016-09-22 13:43:12 -07001250 { 'category':'C/C++', 'severity':severity.MEDIUM, 'option':'-Wgnu-static-float-init',
Chih-Hung Hsiehba0ddcd2016-03-21 11:28:30 -07001251 'description':'In-class initializer for static const float/double' ,
1252 'patterns':[r".*: warning: in-class initializer for static data member of .+const (float|double)"] },
Chih-Hung Hsieh99459fc2016-09-22 13:43:12 -07001253 { 'category':'C/C++', 'severity':severity.MEDIUM, 'option':'-Wpointer-arith',
Marco Nelissen594375d2009-07-14 09:04:04 -07001254 'description':'void* used in arithmetic' ,
1255 'patterns':[r".*: warning: pointer of type 'void \*' used in (arithmetic|subtraction)",
Chih-Hung Hsiehf8aaf602016-03-16 12:18:16 -07001256 r".*: warning: arithmetic on .+ to void is a GNU extension.*Wpointer-arith",
Marco Nelissen594375d2009-07-14 09:04:04 -07001257 r".*: warning: wrong type argument to increment"] },
Chih-Hung Hsieh99459fc2016-09-22 13:43:12 -07001258 { 'category':'C/C++', 'severity':severity.MEDIUM, 'option':'-Wsign-promo',
Marco Nelissen594375d2009-07-14 09:04:04 -07001259 'description':'Overload resolution chose to promote from unsigned or enum to signed type' ,
Chih-Hung Hsieh0862c482016-09-06 16:26:46 -07001260 'patterns':[r".*: warning: passing '.+' chooses '.+' over '.+'.*Wsign-promo"] },
Chih-Hung Hsieh99459fc2016-09-22 13:43:12 -07001261 { 'category':'cont.', 'severity':severity.SKIP,
Marco Nelissen594375d2009-07-14 09:04:04 -07001262 'description':'',
1263 'patterns':[r".*: warning: in call to '.+'"] },
Chih-Hung Hsieh99459fc2016-09-22 13:43:12 -07001264 { 'category':'C/C++', 'severity':severity.HIGH, 'option':'-Wextra',
Marco Nelissen5236fbd2009-07-31 08:30:34 -07001265 'description':'Base should be explicitly initialized in copy constructor',
1266 'patterns':[r".*: warning: base class '.+' should be explicitly initialized in the copy constructor"] },
Chih-Hung Hsieh99459fc2016-09-22 13:43:12 -07001267 { 'category':'C/C++', 'severity':severity.MEDIUM,
Chih-Hung Hsiehf8aaf602016-03-16 12:18:16 -07001268 'description':'VLA has zero or negative size',
1269 'patterns':[r".*: warning: Declared variable-length array \(VLA\) has .+ size"] },
Chih-Hung Hsieh99459fc2016-09-22 13:43:12 -07001270 { 'category':'C/C++', 'severity':severity.MEDIUM,
Marco Nelissen8e201962010-03-10 16:16:02 -08001271 'description':'Return value from void function',
1272 'patterns':[r".*: warning: 'return' with a value, in function returning void"] },
Chih-Hung Hsieh99459fc2016-09-22 13:43:12 -07001273 { 'category':'C/C++', 'severity':severity.MEDIUM, 'option':'multichar',
Chih-Hung Hsiehf8aaf602016-03-16 12:18:16 -07001274 'description':'Multi-character character constant',
1275 'patterns':[r".*: warning: multi-character character constant"] },
Chih-Hung Hsieh99459fc2016-09-22 13:43:12 -07001276 { 'category':'C/C++', 'severity':severity.MEDIUM, 'option':'writable-strings',
Chih-Hung Hsiehba0ddcd2016-03-21 11:28:30 -07001277 'description':'Conversion from string literal to char*',
1278 'patterns':[r".*: warning: .+ does not allow conversion from string literal to 'char \*'"] },
Chih-Hung Hsieh99459fc2016-09-22 13:43:12 -07001279 { 'category':'C/C++', 'severity':severity.LOW, 'option':'-Wextra-semi',
Chih-Hung Hsieh8d145432016-07-01 15:48:06 -07001280 'description':'Extra \';\'',
1281 'patterns':[r".*: warning: extra ';' .+extra-semi"] },
Chih-Hung Hsieh99459fc2016-09-22 13:43:12 -07001282 { 'category':'C/C++', 'severity':severity.LOW,
Marco Nelissen8e201962010-03-10 16:16:02 -08001283 'description':'Useless specifier',
1284 'patterns':[r".*: warning: useless storage class specifier in empty declaration"] },
Chih-Hung Hsieh99459fc2016-09-22 13:43:12 -07001285 { 'category':'C/C++', 'severity':severity.LOW, 'option':'-Wduplicate-decl-specifier',
Chih-Hung Hsieh90d46192016-03-29 15:33:11 -07001286 'description':'Duplicate declaration specifier',
1287 'patterns':[r".*: warning: duplicate '.+' declaration specifier"] },
Chih-Hung Hsieh99459fc2016-09-22 13:43:12 -07001288 { 'category':'logtags', 'severity':severity.LOW,
Marco Nelissen8e201962010-03-10 16:16:02 -08001289 'description':'Duplicate logtag',
Chih-Hung Hsieh90d46192016-03-29 15:33:11 -07001290 'patterns':[r".*: warning: tag \".+\" \(.+\) duplicated in .+"] },
Chih-Hung Hsieh99459fc2016-09-22 13:43:12 -07001291 { 'category':'logtags', 'severity':severity.LOW, 'option':'typedef-redefinition',
Chih-Hung Hsiehf8aaf602016-03-16 12:18:16 -07001292 'description':'Typedef redefinition',
1293 'patterns':[r".*: warning: redefinition of typedef '.+' is a C11 feature"] },
Chih-Hung Hsieh99459fc2016-09-22 13:43:12 -07001294 { 'category':'logtags', 'severity':severity.LOW, 'option':'gnu-designator',
Chih-Hung Hsiehf8aaf602016-03-16 12:18:16 -07001295 'description':'GNU old-style field designator',
1296 'patterns':[r".*: warning: use of GNU old-style field designator extension"] },
Chih-Hung Hsieh99459fc2016-09-22 13:43:12 -07001297 { 'category':'logtags', 'severity':severity.LOW, 'option':'missing-field-initializers',
Chih-Hung Hsiehf8aaf602016-03-16 12:18:16 -07001298 'description':'Missing field initializers',
1299 'patterns':[r".*: warning: missing field '.+' initializer"] },
Chih-Hung Hsieh99459fc2016-09-22 13:43:12 -07001300 { 'category':'logtags', 'severity':severity.LOW, 'option':'missing-braces',
Chih-Hung Hsiehf8aaf602016-03-16 12:18:16 -07001301 'description':'Missing braces',
1302 'patterns':[r".*: warning: suggest braces around initialization of",
Chih-Hung Hsiehba0ddcd2016-03-21 11:28:30 -07001303 r".*: warning: too many braces around scalar initializer .+Wmany-braces-around-scalar-init",
Chih-Hung Hsiehf8aaf602016-03-16 12:18:16 -07001304 r".*: warning: braces around scalar initializer"] },
Chih-Hung Hsieh99459fc2016-09-22 13:43:12 -07001305 { 'category':'logtags', 'severity':severity.LOW, 'option':'sign-compare',
Chih-Hung Hsiehf8aaf602016-03-16 12:18:16 -07001306 'description':'Comparison of integers of different signs',
1307 'patterns':[r".*: warning: comparison of integers of different signs.+sign-compare"] },
Chih-Hung Hsieh99459fc2016-09-22 13:43:12 -07001308 { 'category':'logtags', 'severity':severity.LOW, 'option':'dangling-else',
Chih-Hung Hsiehf8aaf602016-03-16 12:18:16 -07001309 'description':'Add braces to avoid dangling else',
1310 'patterns':[r".*: warning: add explicit braces to avoid dangling else"] },
Chih-Hung Hsieh99459fc2016-09-22 13:43:12 -07001311 { 'category':'logtags', 'severity':severity.LOW, 'option':'initializer-overrides',
Chih-Hung Hsiehf8aaf602016-03-16 12:18:16 -07001312 'description':'Initializer overrides prior initialization',
1313 'patterns':[r".*: warning: initializer overrides prior initialization of this subobject"] },
Chih-Hung Hsieh99459fc2016-09-22 13:43:12 -07001314 { 'category':'logtags', 'severity':severity.LOW, 'option':'self-assign',
Chih-Hung Hsiehf8aaf602016-03-16 12:18:16 -07001315 'description':'Assigning value to self',
1316 'patterns':[r".*: warning: explicitly assigning value of .+ to itself"] },
Chih-Hung Hsieh99459fc2016-09-22 13:43:12 -07001317 { 'category':'logtags', 'severity':severity.LOW, 'option':'gnu-variable-sized-type-not-at-end',
Chih-Hung Hsiehf8aaf602016-03-16 12:18:16 -07001318 'description':'GNU extension, variable sized type not at end',
1319 'patterns':[r".*: warning: field '.+' with variable sized type '.+' not at the end of a struct or class"] },
Chih-Hung Hsieh99459fc2016-09-22 13:43:12 -07001320 { 'category':'logtags', 'severity':severity.LOW, 'option':'tautological-constant-out-of-range-compare',
Chih-Hung Hsiehf8aaf602016-03-16 12:18:16 -07001321 'description':'Comparison of constant is always false/true',
1322 'patterns':[r".*: comparison of .+ is always .+Wtautological-constant-out-of-range-compare"] },
Chih-Hung Hsieh99459fc2016-09-22 13:43:12 -07001323 { 'category':'logtags', 'severity':severity.LOW, 'option':'overloaded-virtual',
Chih-Hung Hsiehf8aaf602016-03-16 12:18:16 -07001324 'description':'Hides overloaded virtual function',
1325 'patterns':[r".*: '.+' hides overloaded virtual function"] },
Chih-Hung Hsieh99459fc2016-09-22 13:43:12 -07001326 { 'category':'logtags', 'severity':severity.LOW, 'option':'incompatible-pointer-types',
Chih-Hung Hsiehf8aaf602016-03-16 12:18:16 -07001327 'description':'Incompatible pointer types',
1328 'patterns':[r".*: warning: incompatible pointer types .+Wincompatible-pointer-types"] },
Chih-Hung Hsieh99459fc2016-09-22 13:43:12 -07001329 { 'category':'logtags', 'severity':severity.LOW, 'option':'asm-operand-widths',
Chih-Hung Hsiehba0ddcd2016-03-21 11:28:30 -07001330 'description':'ASM value size does not match register size',
Chih-Hung Hsiehf8aaf602016-03-16 12:18:16 -07001331 'patterns':[r".*: warning: value size does not match register size specified by the constraint and modifier"] },
Chih-Hung Hsieh99459fc2016-09-22 13:43:12 -07001332 { 'category':'C/C++', 'severity':severity.LOW, 'option':'tautological-compare',
Chih-Hung Hsieh8d145432016-07-01 15:48:06 -07001333 'description':'Comparison of self is always false',
1334 'patterns':[r".*: self-comparison always evaluates to false"] },
Chih-Hung Hsieh99459fc2016-09-22 13:43:12 -07001335 { 'category':'C/C++', 'severity':severity.LOW, 'option':'constant-logical-operand',
Chih-Hung Hsieh8d145432016-07-01 15:48:06 -07001336 'description':'Logical op with constant operand',
1337 'patterns':[r".*: use of logical '.+' with constant operand"] },
Chih-Hung Hsieh99459fc2016-09-22 13:43:12 -07001338 { 'category':'C/C++', 'severity':severity.LOW, 'option':'literal-suffix',
Chih-Hung Hsiehf8aaf602016-03-16 12:18:16 -07001339 'description':'Needs a space between literal and string macro',
1340 'patterns':[r".*: warning: invalid suffix on literal.+ requires a space .+Wliteral-suffix"] },
Chih-Hung Hsieh99459fc2016-09-22 13:43:12 -07001341 { 'category':'C/C++', 'severity':severity.LOW, 'option':'#warnings',
Chih-Hung Hsiehf8aaf602016-03-16 12:18:16 -07001342 'description':'Warnings from #warning',
1343 'patterns':[r".*: warning: .+-W#warnings"] },
Chih-Hung Hsieh99459fc2016-09-22 13:43:12 -07001344 { 'category':'C/C++', 'severity':severity.LOW, 'option':'absolute-value',
Chih-Hung Hsiehba0ddcd2016-03-21 11:28:30 -07001345 'description':'Using float/int absolute value function with int/float argument',
Chih-Hung Hsieh8d145432016-07-01 15:48:06 -07001346 'patterns':[r".*: warning: using .+ absolute value function .+ when argument is .+ type .+Wabsolute-value",
1347 r".*: warning: absolute value function '.+' given .+ which may cause truncation .+Wabsolute-value"] },
Chih-Hung Hsieh99459fc2016-09-22 13:43:12 -07001348 { 'category':'C/C++', 'severity':severity.LOW, 'option':'-Wc++11-extensions',
Chih-Hung Hsieh8d145432016-07-01 15:48:06 -07001349 'description':'Using C++11 extensions',
1350 'patterns':[r".*: warning: 'auto' type specifier is a C\+\+11 extension"] },
Chih-Hung Hsieh99459fc2016-09-22 13:43:12 -07001351 { 'category':'C/C++', 'severity':severity.LOW,
Chih-Hung Hsiehba0ddcd2016-03-21 11:28:30 -07001352 'description':'Refers to implicitly defined namespace',
1353 'patterns':[r".*: warning: using directive refers to implicitly-defined namespace .+"] },
Chih-Hung Hsieh99459fc2016-09-22 13:43:12 -07001354 { 'category':'C/C++', 'severity':severity.LOW, 'option':'-Winvalid-pp-token',
Chih-Hung Hsieh90d46192016-03-29 15:33:11 -07001355 'description':'Invalid pp token',
1356 'patterns':[r".*: warning: missing .+Winvalid-pp-token"] },
Chih-Hung Hsiehf8aaf602016-03-16 12:18:16 -07001357
Chih-Hung Hsieh99459fc2016-09-22 13:43:12 -07001358 { 'category':'C/C++', 'severity':severity.MEDIUM,
Marco Nelissen8e201962010-03-10 16:16:02 -08001359 'description':'Operator new returns NULL',
1360 'patterns':[r".*: warning: 'operator new' must not return NULL unless it is declared 'throw\(\)' .+"] },
Chih-Hung Hsieh99459fc2016-09-22 13:43:12 -07001361 { 'category':'C/C++', 'severity':severity.MEDIUM, 'option':'-Wnull-arithmetic',
Marco Nelissen8e201962010-03-10 16:16:02 -08001362 'description':'NULL used in arithmetic',
Chih-Hung Hsieh8d145432016-07-01 15:48:06 -07001363 'patterns':[r".*: warning: NULL used in arithmetic",
1364 r".*: warning: comparison between NULL and non-pointer"] },
Chih-Hung Hsieh99459fc2016-09-22 13:43:12 -07001365 { 'category':'C/C++', 'severity':severity.MEDIUM, 'option':'header-guard',
Chih-Hung Hsiehba0ddcd2016-03-21 11:28:30 -07001366 'description':'Misspelled header guard',
1367 'patterns':[r".*: warning: '.+' is used as a header guard .+ followed by .+ different macro"] },
Chih-Hung Hsieh99459fc2016-09-22 13:43:12 -07001368 { 'category':'C/C++', 'severity':severity.MEDIUM, 'option':'empty-body',
Chih-Hung Hsiehba0ddcd2016-03-21 11:28:30 -07001369 'description':'Empty loop body',
1370 'patterns':[r".*: warning: .+ loop has empty body"] },
Chih-Hung Hsieh99459fc2016-09-22 13:43:12 -07001371 { 'category':'C/C++', 'severity':severity.MEDIUM, 'option':'enum-conversion',
Chih-Hung Hsiehf8aaf602016-03-16 12:18:16 -07001372 'description':'Implicit conversion from enumeration type',
1373 'patterns':[r".*: warning: implicit conversion from enumeration type '.+'"] },
Chih-Hung Hsieh99459fc2016-09-22 13:43:12 -07001374 { 'category':'C/C++', 'severity':severity.MEDIUM, 'option':'switch',
Chih-Hung Hsiehf8aaf602016-03-16 12:18:16 -07001375 'description':'case value not in enumerated type',
1376 'patterns':[r".*: warning: case value not in enumerated type '.+'"] },
Chih-Hung Hsieh99459fc2016-09-22 13:43:12 -07001377 { 'category':'C/C++', 'severity':severity.MEDIUM,
Chih-Hung Hsiehf8aaf602016-03-16 12:18:16 -07001378 'description':'Undefined result',
1379 'patterns':[r".*: warning: The result of .+ is undefined",
Chih-Hung Hsieh4354a332016-07-22 14:09:31 -07001380 r".*: warning: passing an object that .+ has undefined behavior \[-Wvarargs\]",
Chih-Hung Hsiehf8aaf602016-03-16 12:18:16 -07001381 r".*: warning: 'this' pointer cannot be null in well-defined C\+\+ code;",
1382 r".*: warning: shifting a negative signed value is undefined"] },
Chih-Hung Hsieh99459fc2016-09-22 13:43:12 -07001383 { 'category':'C/C++', 'severity':severity.MEDIUM,
Chih-Hung Hsiehf8aaf602016-03-16 12:18:16 -07001384 'description':'Division by zero',
1385 'patterns':[r".*: warning: Division by zero"] },
Chih-Hung Hsieh99459fc2016-09-22 13:43:12 -07001386 { 'category':'C/C++', 'severity':severity.MEDIUM,
Marco Nelissen8e201962010-03-10 16:16:02 -08001387 'description':'Use of deprecated method',
1388 'patterns':[r".*: warning: '.+' is deprecated .+"] },
Chih-Hung Hsieh99459fc2016-09-22 13:43:12 -07001389 { 'category':'C/C++', 'severity':severity.MEDIUM,
Chih-Hung Hsiehf8aaf602016-03-16 12:18:16 -07001390 'description':'Use of garbage or uninitialized value',
1391 'patterns':[r".*: warning: .+ is a garbage value",
1392 r".*: warning: Function call argument is an uninitialized value",
1393 r".*: warning: Undefined or garbage value returned to caller",
Chih-Hung Hsiehba0ddcd2016-03-21 11:28:30 -07001394 r".*: warning: Called .+ pointer is.+uninitialized",
1395 r".*: warning: Called .+ pointer is.+uninitalized", # match a typo in compiler message
1396 r".*: warning: Use of zero-allocated memory",
Chih-Hung Hsiehf8aaf602016-03-16 12:18:16 -07001397 r".*: warning: Dereference of undefined pointer value",
1398 r".*: warning: Passed-by-value .+ contains uninitialized data",
1399 r".*: warning: Branch condition evaluates to a garbage value",
1400 r".*: warning: The .+ of .+ is an uninitialized value.",
1401 r".*: warning: .+ is used uninitialized whenever .+sometimes-uninitialized",
1402 r".*: warning: Assigned value is garbage or undefined"] },
Chih-Hung Hsieh99459fc2016-09-22 13:43:12 -07001403 { 'category':'C/C++', 'severity':severity.MEDIUM,
Chih-Hung Hsiehf8aaf602016-03-16 12:18:16 -07001404 'description':'Result of malloc type incompatible with sizeof operand type',
1405 'patterns':[r".*: warning: Result of '.+' is converted to .+ incompatible with sizeof operand type"] },
Chih-Hung Hsieh99459fc2016-09-22 13:43:12 -07001406 { 'category':'C/C++', 'severity':severity.MEDIUM, 'option':'-Wsizeof-array-argument',
Chih-Hung Hsieh8d145432016-07-01 15:48:06 -07001407 'description':'Sizeof on array argument',
1408 'patterns':[r".*: warning: sizeof on array function parameter will return"] },
Chih-Hung Hsieh99459fc2016-09-22 13:43:12 -07001409 { 'category':'C/C++', 'severity':severity.MEDIUM, 'option':'-Wsizeof-pointer-memacces',
Chih-Hung Hsieh8d145432016-07-01 15:48:06 -07001410 'description':'Bad argument size of memory access functions',
1411 'patterns':[r".*: warning: .+\[-Wsizeof-pointer-memaccess\]"] },
Chih-Hung Hsieh99459fc2016-09-22 13:43:12 -07001412 { 'category':'C/C++', 'severity':severity.MEDIUM,
Chih-Hung Hsiehf8aaf602016-03-16 12:18:16 -07001413 'description':'Return value not checked',
1414 'patterns':[r".*: warning: The return value from .+ is not checked"] },
Chih-Hung Hsieh99459fc2016-09-22 13:43:12 -07001415 { 'category':'C/C++', 'severity':severity.MEDIUM,
Chih-Hung Hsiehf8aaf602016-03-16 12:18:16 -07001416 'description':'Possible heap pollution',
1417 'patterns':[r".*: warning: .*Possible heap pollution from .+ type .+"] },
Chih-Hung Hsieh99459fc2016-09-22 13:43:12 -07001418 { 'category':'C/C++', 'severity':severity.MEDIUM,
Chih-Hung Hsiehf8aaf602016-03-16 12:18:16 -07001419 'description':'Allocation size of 0 byte',
1420 'patterns':[r".*: warning: Call to .+ has an allocation size of 0 byte"] },
Chih-Hung Hsieh99459fc2016-09-22 13:43:12 -07001421 { 'category':'C/C++', 'severity':severity.MEDIUM,
Chih-Hung Hsiehf8aaf602016-03-16 12:18:16 -07001422 'description':'Result of malloc type incompatible with sizeof operand type',
1423 'patterns':[r".*: warning: Result of '.+' is converted to .+ incompatible with sizeof operand type"] },
Chih-Hung Hsieh99459fc2016-09-22 13:43:12 -07001424 { 'category':'C/C++', 'severity':severity.MEDIUM, 'option':'-Wfor-loop-analysis',
Chih-Hung Hsieh0862c482016-09-06 16:26:46 -07001425 'description':'Variable used in loop condition not modified in loop body',
1426 'patterns':[r".*: warning: variable '.+' used in loop condition.*Wfor-loop-analysis"] },
Chih-Hung Hsieh99459fc2016-09-22 13:43:12 -07001427 { 'category':'C/C++', 'severity':severity.MEDIUM,
Chih-Hung Hsieh0862c482016-09-06 16:26:46 -07001428 'description':'Closing a previously closed file',
1429 'patterns':[r".*: warning: Closing a previously closed file"] },
Chih-Hung Hsiehf8aaf602016-03-16 12:18:16 -07001430
Chih-Hung Hsieh99459fc2016-09-22 13:43:12 -07001431 { 'category':'C/C++', 'severity':severity.HARMLESS,
Chih-Hung Hsiehf8aaf602016-03-16 12:18:16 -07001432 'description':'Discarded qualifier from pointer target type',
1433 'patterns':[r".*: warning: .+ discards '.+' qualifier from pointer target type"] },
Chih-Hung Hsieh99459fc2016-09-22 13:43:12 -07001434 { 'category':'C/C++', 'severity':severity.HARMLESS,
Chih-Hung Hsiehf8aaf602016-03-16 12:18:16 -07001435 'description':'Use snprintf instead of sprintf',
1436 'patterns':[r".*: warning: .*sprintf is often misused; please use snprintf"] },
Chih-Hung Hsieh99459fc2016-09-22 13:43:12 -07001437 { 'category':'C/C++', 'severity':severity.HARMLESS,
Chih-Hung Hsiehf8aaf602016-03-16 12:18:16 -07001438 'description':'Unsupported optimizaton flag',
1439 'patterns':[r".*: warning: optimization flag '.+' is not supported"] },
Chih-Hung Hsieh99459fc2016-09-22 13:43:12 -07001440 { 'category':'C/C++', 'severity':severity.HARMLESS,
Chih-Hung Hsiehf8aaf602016-03-16 12:18:16 -07001441 'description':'Extra or missing parentheses',
1442 'patterns':[r".*: warning: equality comparison with extraneous parentheses",
1443 r".*: warning: .+ within .+Wlogical-op-parentheses"] },
Chih-Hung Hsieh99459fc2016-09-22 13:43:12 -07001444 { 'category':'C/C++', 'severity':severity.HARMLESS, 'option':'mismatched-tags',
Chih-Hung Hsiehf8aaf602016-03-16 12:18:16 -07001445 'description':'Mismatched class vs struct tags',
1446 'patterns':[r".*: warning: '.+' defined as a .+ here but previously declared as a .+mismatched-tags",
1447 r".*: warning: .+ was previously declared as a .+mismatched-tags"] },
Marco Nelissen594375d2009-07-14 09:04:04 -07001448
1449 # these next ones are to deal with formatting problems resulting from the log being mixed up by 'make -j'
Chih-Hung Hsieh99459fc2016-09-22 13:43:12 -07001450 { 'category':'C/C++', 'severity':severity.SKIP,
Marco Nelissen594375d2009-07-14 09:04:04 -07001451 'description':'',
1452 'patterns':[r".*: warning: ,$"] },
Chih-Hung Hsieh99459fc2016-09-22 13:43:12 -07001453 { 'category':'C/C++', 'severity':severity.SKIP,
Marco Nelissen594375d2009-07-14 09:04:04 -07001454 'description':'',
1455 'patterns':[r".*: warning: $"] },
Chih-Hung Hsieh99459fc2016-09-22 13:43:12 -07001456 { 'category':'C/C++', 'severity':severity.SKIP,
Marco Nelissen594375d2009-07-14 09:04:04 -07001457 'description':'',
1458 'patterns':[r".*: warning: In file included from .+,"] },
1459
Chih-Hung Hsieh90d46192016-03-29 15:33:11 -07001460 # warnings from clang-tidy
Chih-Hung Hsieh99459fc2016-09-22 13:43:12 -07001461 { 'category':'C/C++', 'severity':severity.TIDY,
Chih-Hung Hsieh90d46192016-03-29 15:33:11 -07001462 'description':'clang-tidy readability',
1463 'patterns':[r".*: .+\[readability-.+\]$"] },
Chih-Hung Hsieh99459fc2016-09-22 13:43:12 -07001464 { 'category':'C/C++', 'severity':severity.TIDY,
Chih-Hung Hsieh90d46192016-03-29 15:33:11 -07001465 'description':'clang-tidy c++ core guidelines',
1466 'patterns':[r".*: .+\[cppcoreguidelines-.+\]$"] },
Chih-Hung Hsieh99459fc2016-09-22 13:43:12 -07001467 { 'category':'C/C++', 'severity':severity.TIDY,
Chih-Hung Hsiehc21ddbd2016-07-20 10:08:51 -07001468 'description':'clang-tidy google-default-arguments',
1469 'patterns':[r".*: .+\[google-default-arguments\]$"] },
Chih-Hung Hsieh99459fc2016-09-22 13:43:12 -07001470 { 'category':'C/C++', 'severity':severity.TIDY,
Chih-Hung Hsiehc21ddbd2016-07-20 10:08:51 -07001471 'description':'clang-tidy google-runtime-int',
1472 'patterns':[r".*: .+\[google-runtime-int\]$"] },
Chih-Hung Hsieh99459fc2016-09-22 13:43:12 -07001473 { 'category':'C/C++', 'severity':severity.TIDY,
Chih-Hung Hsiehc21ddbd2016-07-20 10:08:51 -07001474 'description':'clang-tidy google-runtime-operator',
1475 'patterns':[r".*: .+\[google-runtime-operator\]$"] },
Chih-Hung Hsieh99459fc2016-09-22 13:43:12 -07001476 { 'category':'C/C++', 'severity':severity.TIDY,
Chih-Hung Hsiehc21ddbd2016-07-20 10:08:51 -07001477 'description':'clang-tidy google-runtime-references',
1478 'patterns':[r".*: .+\[google-runtime-references\]$"] },
Chih-Hung Hsieh99459fc2016-09-22 13:43:12 -07001479 { 'category':'C/C++', 'severity':severity.TIDY,
Chih-Hung Hsieh90d46192016-03-29 15:33:11 -07001480 'description':'clang-tidy google-build',
1481 'patterns':[r".*: .+\[google-build-.+\]$"] },
Chih-Hung Hsieh99459fc2016-09-22 13:43:12 -07001482 { 'category':'C/C++', 'severity':severity.TIDY,
Chih-Hung Hsieh90d46192016-03-29 15:33:11 -07001483 'description':'clang-tidy google-explicit',
1484 'patterns':[r".*: .+\[google-explicit-.+\]$"] },
Chih-Hung Hsieh99459fc2016-09-22 13:43:12 -07001485 { 'category':'C/C++', 'severity':severity.TIDY,
Chih-Hung Hsiehd742e902016-03-31 16:14:55 -07001486 'description':'clang-tidy google-readability',
1487 'patterns':[r".*: .+\[google-readability-.+\]$"] },
Chih-Hung Hsieh99459fc2016-09-22 13:43:12 -07001488 { 'category':'C/C++', 'severity':severity.TIDY,
Chih-Hung Hsiehd742e902016-03-31 16:14:55 -07001489 'description':'clang-tidy google-global',
1490 'patterns':[r".*: .+\[google-global-.+\]$"] },
Chih-Hung Hsieh99459fc2016-09-22 13:43:12 -07001491 { 'category':'C/C++', 'severity':severity.TIDY,
Chih-Hung Hsiehc21ddbd2016-07-20 10:08:51 -07001492 'description':'clang-tidy google- other',
1493 'patterns':[r".*: .+\[google-.+\]$"] },
Chih-Hung Hsieh99459fc2016-09-22 13:43:12 -07001494 { 'category':'C/C++', 'severity':severity.TIDY,
Chih-Hung Hsieh90d46192016-03-29 15:33:11 -07001495 'description':'clang-tidy modernize',
1496 'patterns':[r".*: .+\[modernize-.+\]$"] },
Chih-Hung Hsieh99459fc2016-09-22 13:43:12 -07001497 { 'category':'C/C++', 'severity':severity.TIDY,
Chih-Hung Hsieh90d46192016-03-29 15:33:11 -07001498 'description':'clang-tidy misc',
1499 'patterns':[r".*: .+\[misc-.+\]$"] },
Chih-Hung Hsieh99459fc2016-09-22 13:43:12 -07001500 { 'category':'C/C++', 'severity':severity.TIDY,
Chih-Hung Hsiehc8682932016-07-26 14:27:03 -07001501 'description':'clang-tidy performance-faster-string-find',
1502 'patterns':[r".*: .+\[performance-faster-string-find\]$"] },
Chih-Hung Hsieh99459fc2016-09-22 13:43:12 -07001503 { 'category':'C/C++', 'severity':severity.TIDY,
Chih-Hung Hsiehc8682932016-07-26 14:27:03 -07001504 'description':'clang-tidy performance-for-range-copy',
1505 'patterns':[r".*: .+\[performance-for-range-copy\]$"] },
Chih-Hung Hsieh99459fc2016-09-22 13:43:12 -07001506 { 'category':'C/C++', 'severity':severity.TIDY,
Chih-Hung Hsiehc8682932016-07-26 14:27:03 -07001507 'description':'clang-tidy performance-implicit-cast-in-loop',
1508 'patterns':[r".*: .+\[performance-implicit-cast-in-loop\]$"] },
Chih-Hung Hsieh99459fc2016-09-22 13:43:12 -07001509 { 'category':'C/C++', 'severity':severity.TIDY,
Chih-Hung Hsiehc8682932016-07-26 14:27:03 -07001510 'description':'clang-tidy performance-unnecessary-copy-initialization',
1511 'patterns':[r".*: .+\[performance-unnecessary-copy-initialization\]$"] },
Chih-Hung Hsieh99459fc2016-09-22 13:43:12 -07001512 { 'category':'C/C++', 'severity':severity.TIDY,
Chih-Hung Hsiehc8682932016-07-26 14:27:03 -07001513 'description':'clang-tidy performance-unnecessary-value-param',
1514 'patterns':[r".*: .+\[performance-unnecessary-value-param\]$"] },
Chih-Hung Hsieh99459fc2016-09-22 13:43:12 -07001515 { 'category':'C/C++', 'severity':severity.TIDY,
Chih-Hung Hsieh0862c482016-09-06 16:26:46 -07001516 'description':'clang-analyzer Unreachable code',
1517 'patterns':[r".*: warning: This statement is never executed.*UnreachableCode"] },
Chih-Hung Hsieh99459fc2016-09-22 13:43:12 -07001518 { 'category':'C/C++', 'severity':severity.TIDY,
Chih-Hung Hsieh0862c482016-09-06 16:26:46 -07001519 'description':'clang-analyzer Size of malloc may overflow',
1520 'patterns':[r".*: warning: .* size of .* may overflow .*MallocOverflow"] },
Chih-Hung Hsieh99459fc2016-09-22 13:43:12 -07001521 { 'category':'C/C++', 'severity':severity.TIDY,
Chih-Hung Hsieh0862c482016-09-06 16:26:46 -07001522 'description':'clang-analyzer Stream pointer might be NULL',
1523 'patterns':[r".*: warning: Stream pointer might be NULL .*unix.Stream"] },
Chih-Hung Hsieh99459fc2016-09-22 13:43:12 -07001524 { 'category':'C/C++', 'severity':severity.TIDY,
Chih-Hung Hsieh0862c482016-09-06 16:26:46 -07001525 'description':'clang-analyzer Opened file never closed',
1526 'patterns':[r".*: warning: Opened File never closed.*unix.Stream"] },
Chih-Hung Hsieh99459fc2016-09-22 13:43:12 -07001527 { 'category':'C/C++', 'severity':severity.TIDY,
Chih-Hung Hsieh0862c482016-09-06 16:26:46 -07001528 'description':'clang-analyzer sozeof() on a pointer type',
1529 'patterns':[r".*: warning: .*calls sizeof.* on a pointer type.*SizeofPtr"] },
Chih-Hung Hsieh99459fc2016-09-22 13:43:12 -07001530 { 'category':'C/C++', 'severity':severity.TIDY,
Chih-Hung Hsieh0862c482016-09-06 16:26:46 -07001531 'description':'clang-analyzer Pointer arithmetic on non-array variables',
1532 'patterns':[r".*: warning: Pointer arithmetic on non-array variables .*PointerArithm"] },
Chih-Hung Hsieh99459fc2016-09-22 13:43:12 -07001533 { 'category':'C/C++', 'severity':severity.TIDY,
Chih-Hung Hsieh0862c482016-09-06 16:26:46 -07001534 'description':'clang-analyzer Subtraction of pointers of different memory chunks',
1535 'patterns':[r".*: warning: Subtraction of two pointers .*PointerSub"] },
Chih-Hung Hsieh99459fc2016-09-22 13:43:12 -07001536 { 'category':'C/C++', 'severity':severity.TIDY,
Chih-Hung Hsieh0862c482016-09-06 16:26:46 -07001537 'description':'clang-analyzer Access out-of-bound array element',
1538 'patterns':[r".*: warning: Access out-of-bound array element .*ArrayBound"] },
Chih-Hung Hsieh99459fc2016-09-22 13:43:12 -07001539 { 'category':'C/C++', 'severity':severity.TIDY,
Chih-Hung Hsieh0862c482016-09-06 16:26:46 -07001540 'description':'clang-analyzer Out of bound memory access',
1541 'patterns':[r".*: warning: Out of bound memory access .*ArrayBoundV2"] },
Chih-Hung Hsieh99459fc2016-09-22 13:43:12 -07001542 { 'category':'C/C++', 'severity':severity.TIDY,
Chih-Hung Hsieh0862c482016-09-06 16:26:46 -07001543 'description':'clang-analyzer Possible lock order reversal',
1544 'patterns':[r".*: warning: .* Possible lock order reversal.*PthreadLock"] },
Chih-Hung Hsieh99459fc2016-09-22 13:43:12 -07001545 { 'category':'C/C++', 'severity':severity.TIDY,
Chih-Hung Hsieh0862c482016-09-06 16:26:46 -07001546 'description':'clang-analyzer Argument is a pointer to uninitialized value',
1547 'patterns':[r".*: warning: .* argument is a pointer to uninitialized value .*CallAndMessage"] },
Chih-Hung Hsieh99459fc2016-09-22 13:43:12 -07001548 { 'category':'C/C++', 'severity':severity.TIDY,
Chih-Hung Hsieh0862c482016-09-06 16:26:46 -07001549 'description':'clang-analyzer cast to struct',
1550 'patterns':[r".*: warning: Casting a non-structure type to a structure type .*CastToStruct"] },
Chih-Hung Hsieh99459fc2016-09-22 13:43:12 -07001551 { 'category':'C/C++', 'severity':severity.TIDY,
Chih-Hung Hsieh0862c482016-09-06 16:26:46 -07001552 'description':'clang-analyzer call path problems',
1553 'patterns':[r".*: warning: Call Path : .+"] },
Chih-Hung Hsieh99459fc2016-09-22 13:43:12 -07001554 { 'category':'C/C++', 'severity':severity.TIDY,
Chih-Hung Hsieh0862c482016-09-06 16:26:46 -07001555 'description':'clang-analyzer other',
1556 'patterns':[r".*: .+\[clang-analyzer-.+\]$",
1557 r".*: Call Path : .+$"] },
Chih-Hung Hsieh99459fc2016-09-22 13:43:12 -07001558 { 'category':'C/C++', 'severity':severity.TIDY,
Chih-Hung Hsieh90d46192016-03-29 15:33:11 -07001559 'description':'clang-tidy CERT',
1560 'patterns':[r".*: .+\[cert-.+\]$"] },
Chih-Hung Hsieh99459fc2016-09-22 13:43:12 -07001561 { 'category':'C/C++', 'severity':severity.TIDY,
Chih-Hung Hsieh90d46192016-03-29 15:33:11 -07001562 'description':'clang-tidy llvm',
1563 'patterns':[r".*: .+\[llvm-.+\]$"] },
Chih-Hung Hsieh99459fc2016-09-22 13:43:12 -07001564 { 'category':'C/C++', 'severity':severity.TIDY,
Chih-Hung Hsieh0862c482016-09-06 16:26:46 -07001565 'description':'clang-diagnostic',
Chih-Hung Hsieh90d46192016-03-29 15:33:11 -07001566 'patterns':[r".*: .+\[clang-diagnostic-.+\]$"] },
Chih-Hung Hsieh90d46192016-03-29 15:33:11 -07001567
Marco Nelissen594375d2009-07-14 09:04:04 -07001568 # catch-all for warnings this script doesn't know about yet
Chih-Hung Hsieh99459fc2016-09-22 13:43:12 -07001569 { 'category':'C/C++', 'severity':severity.UNKNOWN,
Marco Nelissen594375d2009-07-14 09:04:04 -07001570 'description':'Unclassified/unrecognized warnings',
1571 'patterns':[r".*: warning: .+"] },
1572]
1573
Chih-Hung Hsieh99459fc2016-09-22 13:43:12 -07001574for w in warnpatterns:
1575 w['members'] = []
1576 if 'option' not in w:
1577 w['option'] = ''
1578
Chih-Hung Hsieh48a16ba2016-07-21 14:22:53 -07001579# A list of [project_name, file_path_pattern].
1580# project_name should not contain comma, to be used in CSV output.
1581projectlist = [
Chih-Hung Hsieh4354a332016-07-22 14:09:31 -07001582 ['art', r"(^|.*/)art/.*: warning:"],
1583 ['bionic', r"(^|.*/)bionic/.*: warning:"],
1584 ['bootable', r"(^|.*/)bootable/.*: warning:"],
1585 ['build', r"(^|.*/)build/.*: warning:"],
1586 ['cts', r"(^|.*/)cts/.*: warning:"],
1587 ['dalvik', r"(^|.*/)dalvik/.*: warning:"],
1588 ['developers', r"(^|.*/)developers/.*: warning:"],
1589 ['development', r"(^|.*/)development/.*: warning:"],
1590 ['device', r"(^|.*/)device/.*: warning:"],
1591 ['doc', r"(^|.*/)doc/.*: warning:"],
1592 # match external/google* before external/
1593 ['external/google', r"(^|.*/)external/google.*: warning:"],
1594 ['external/non-google', r"(^|.*/)external/.*: warning:"],
1595 ['frameworks', r"(^|.*/)frameworks/.*: warning:"],
1596 ['hardware', r"(^|.*/)hardware/.*: warning:"],
1597 ['kernel', r"(^|.*/)kernel/.*: warning:"],
1598 ['libcore', r"(^|.*/)libcore/.*: warning:"],
1599 ['libnativehelper', r"(^|.*/)libnativehelper/.*: warning:"],
1600 ['ndk', r"(^|.*/)ndk/.*: warning:"],
1601 ['packages', r"(^|.*/)packages/.*: warning:"],
1602 ['pdk', r"(^|.*/)pdk/.*: warning:"],
1603 ['prebuilts', r"(^|.*/)prebuilts/.*: warning:"],
1604 ['system', r"(^|.*/)system/.*: warning:"],
1605 ['toolchain', r"(^|.*/)toolchain/.*: warning:"],
1606 ['test', r"(^|.*/)test/.*: warning:"],
1607 ['tools', r"(^|.*/)tools/.*: warning:"],
1608 # match vendor/google* before vendor/
1609 ['vendor/google', r"(^|.*/)vendor/google.*: warning:"],
1610 ['vendor/non-google', r"(^|.*/)vendor/.*: warning:"],
1611 # keep out/obj and other patterns at the end.
1612 ['out/obj', r".*/(gen|obj[^/]*)/(include|EXECUTABLES|SHARED_LIBRARIES|STATIC_LIBRARIES)/.*: warning:"],
1613 ['other', r".*: warning:"],
Chih-Hung Hsieh48a16ba2016-07-21 14:22:53 -07001614]
1615
1616projectpatterns = []
1617for p in projectlist:
1618 projectpatterns.append({'description':p[0], 'members':[], 'pattern':re.compile(p[1])})
1619
Chih-Hung Hsiehe41c99b2016-09-12 16:20:49 -07001620projectnames = [p[0] for p in projectlist]
1621
Chih-Hung Hsieh4354a332016-07-22 14:09:31 -07001622# Each warning pattern has 3 dictionaries:
1623# (1) 'projects' maps a project name to number of warnings in that project.
1624# (2) 'projectanchor' maps a project name to its anchor number for HTML.
1625# (3) 'projectwarning' maps a project name to a list of warning of that project.
Chih-Hung Hsieh48a16ba2016-07-21 14:22:53 -07001626for w in warnpatterns:
1627 w['projects'] = {}
Chih-Hung Hsieh4354a332016-07-22 14:09:31 -07001628 w['projectanchor'] = {}
1629 w['projectwarning'] = {}
Chih-Hung Hsieh48a16ba2016-07-21 14:22:53 -07001630
1631platformversion = 'unknown'
1632targetproduct = 'unknown'
1633targetvariant = 'unknown'
1634
1635
1636##### Data and functions to dump html file. ##################################
1637
Marco Nelissen594375d2009-07-14 09:04:04 -07001638anchor = 0
Chih-Hung Hsieh465b6102016-06-22 19:15:12 -07001639cur_row_class = 0
1640
1641html_script_style = """\
1642 <script type="text/javascript">
1643 function expand(id) {
1644 var e = document.getElementById(id);
1645 var f = document.getElementById(id + "_mark");
1646 if (e.style.display == 'block') {
1647 e.style.display = 'none';
1648 f.innerHTML = '&#x2295';
1649 }
1650 else {
1651 e.style.display = 'block';
1652 f.innerHTML = '&#x2296';
1653 }
1654 };
1655 function expand_collapse(show) {
1656 for (var id = 1; ; id++) {
1657 var e = document.getElementById(id + "");
1658 var f = document.getElementById(id + "_mark");
1659 if (!e || !f) break;
1660 e.style.display = (show ? 'block' : 'none');
1661 f.innerHTML = (show ? '&#x2296' : '&#x2295');
1662 }
1663 };
1664 </script>
1665 <style type="text/css">
Chih-Hung Hsiehe41c99b2016-09-12 16:20:49 -07001666 th,td{border-collapse:collapse; border:1px solid black;}
Chih-Hung Hsieh465b6102016-06-22 19:15:12 -07001667 .button{color:blue;font-size:110%;font-weight:bolder;}
1668 .bt{color:black;background-color:transparent;border:none;outline:none;
1669 font-size:140%;font-weight:bolder;}
1670 .c0{background-color:#e0e0e0;}
1671 .c1{background-color:#d0d0d0;}
Chih-Hung Hsiehe41c99b2016-09-12 16:20:49 -07001672 .t1{border-collapse:collapse; width:100%; border:1px solid black;}
Chih-Hung Hsieh465b6102016-06-22 19:15:12 -07001673 </style>\n"""
1674
Marco Nelissen594375d2009-07-14 09:04:04 -07001675
1676def output(text):
1677 print text,
1678
1679def htmlbig(param):
1680 return '<font size="+2">' + param + '</font>'
1681
1682def dumphtmlprologue(title):
Chih-Hung Hsieh465b6102016-06-22 19:15:12 -07001683 output('<html>\n<head>\n')
1684 output('<title>' + title + '</title>\n')
1685 output(html_script_style)
1686 output('</head>\n<body>\n')
Marco Nelissen594375d2009-07-14 09:04:04 -07001687 output(htmlbig(title))
1688 output('<p>\n')
1689
Chih-Hung Hsieh465b6102016-06-22 19:15:12 -07001690def dumphtmlepilogue():
1691 output('</body>\n</head>\n</html>\n')
1692
Marco Nelissen594375d2009-07-14 09:04:04 -07001693def tablerow(text):
Chih-Hung Hsieh465b6102016-06-22 19:15:12 -07001694 global cur_row_class
Chih-Hung Hsieh465b6102016-06-22 19:15:12 -07001695 cur_row_class = 1 - cur_row_class
Chih-Hung Hsieh99459fc2016-09-22 13:43:12 -07001696 # remove last '\n'
1697 t = text[:-1] if text[-1] == '\n' else text
1698 output('<tr><td class="c' + str(cur_row_class) + '">' + t + '</td></tr>\n')
Marco Nelissen594375d2009-07-14 09:04:04 -07001699
Chih-Hung Hsieh48a16ba2016-07-21 14:22:53 -07001700def sortwarnings():
1701 for i in warnpatterns:
1702 i['members'] = sorted(set(i['members']))
1703
Chih-Hung Hsiehe41c99b2016-09-12 16:20:49 -07001704# dump a table of warnings per project and severity
1705def dumpstatsbyproject():
1706 projects = set(projectnames)
1707 severities = set(severity.kinds)
1708
1709 # warnings[p][s] is number of warnings in project p of severity s.
1710 warnings = {p:{s:0 for s in severity.kinds} for p in projectnames}
1711 for i in warnpatterns:
1712 s = i['severity']
1713 for p in i['projects']:
1714 warnings[p][s] += i['projects'][p]
1715
Chih-Hung Hsieh99459fc2016-09-22 13:43:12 -07001716 # totalbyproject[p] is number of warnings in project p.
1717 totalbyproject = {p:sum(warnings[p][s] for s in severity.kinds)
1718 for p in projectnames}
1719
Chih-Hung Hsiehe41c99b2016-09-12 16:20:49 -07001720 # totalbyseverity[s] is number of warnings of severity s.
Chih-Hung Hsieh99459fc2016-09-22 13:43:12 -07001721 totalbyseverity = {s:sum(warnings[p][s] for p in projectnames)
1722 for s in severity.kinds}
Chih-Hung Hsiehe41c99b2016-09-12 16:20:49 -07001723
1724 # emit table header
Chih-Hung Hsieh99459fc2016-09-22 13:43:12 -07001725 output('<blockquote><table border=1>\n<tr><th>Project</th>\n')
Chih-Hung Hsiehe41c99b2016-09-12 16:20:49 -07001726 for s in severity.kinds:
Chih-Hung Hsieh99459fc2016-09-22 13:43:12 -07001727 if totalbyseverity[s]:
1728 output('<th width="8%"><span style="background-color:{}">{}</span></th>'.
1729 format(severity.color[s], severity.columnheader[s]))
Chih-Hung Hsiehe41c99b2016-09-12 16:20:49 -07001730 output('<th>TOTAL</th></tr>\n')
1731
Chih-Hung Hsieh99459fc2016-09-22 13:43:12 -07001732 # emit a row of warning counts per project, skip no-warning projects
Chih-Hung Hsiehe41c99b2016-09-12 16:20:49 -07001733 totalallprojects = 0
1734 for p in projectnames:
Chih-Hung Hsieh99459fc2016-09-22 13:43:12 -07001735 if totalbyproject[p]:
1736 output('<tr><td align="left">{}</td>'.format(p))
1737 for s in severity.kinds:
1738 if totalbyseverity[s]:
1739 output('<td align="right">{}</td>'.format(warnings[p][s]))
1740 output('<td align="right">{}</td>'.format(totalbyproject[p]))
1741 totalallprojects += totalbyproject[p]
1742 output('</tr>\n')
Chih-Hung Hsiehe41c99b2016-09-12 16:20:49 -07001743
1744 # emit a row of warning counts per severity
1745 totalallseverities = 0
1746 output('<tr><td align="right">TOTAL</td>')
1747 for s in severity.kinds:
Chih-Hung Hsieh99459fc2016-09-22 13:43:12 -07001748 if totalbyseverity[s]:
1749 output('<td align="right">{}</td>'.format(totalbyseverity[s]))
1750 totalallseverities += totalbyseverity[s]
Chih-Hung Hsiehe41c99b2016-09-12 16:20:49 -07001751 output('<td align="right">{}</td></tr>\n'.format(totalallprojects))
1752
1753 # at the end of table, verify total counts
1754 output('</table></blockquote><br>\n')
1755 if totalallprojects != totalallseverities:
1756 output('<h3>ERROR: Sum of warnings by project ' +
1757 '!= Sum of warnings by severity.</h3>\n')
1758
Marco Nelissen594375d2009-07-14 09:04:04 -07001759# dump some stats about total number of warnings and such
1760def dumpstats():
1761 known = 0
Chih-Hung Hsiehe41c99b2016-09-12 16:20:49 -07001762 skipped = 0
Marco Nelissen594375d2009-07-14 09:04:04 -07001763 unknown = 0
Chih-Hung Hsieh48a16ba2016-07-21 14:22:53 -07001764 sortwarnings()
Marco Nelissen594375d2009-07-14 09:04:04 -07001765 for i in warnpatterns:
1766 if i['severity'] == severity.UNKNOWN:
1767 unknown += len(i['members'])
Chih-Hung Hsiehe41c99b2016-09-12 16:20:49 -07001768 elif i['severity'] == severity.SKIP:
1769 skipped += len(i['members'])
1770 else:
Marco Nelissen594375d2009-07-14 09:04:04 -07001771 known += len(i['members'])
Chih-Hung Hsieha9be47e2016-03-21 14:11:03 -07001772 output('\nNumber of classified warnings: <b>' + str(known) + '</b><br>' )
Chih-Hung Hsiehe41c99b2016-09-12 16:20:49 -07001773 output('\nNumber of skipped warnings: <b>' + str(skipped) + '</b><br>')
Chih-Hung Hsieha9be47e2016-03-21 14:11:03 -07001774 output('\nNumber of unclassified warnings: <b>' + str(unknown) + '</b><br>')
Chih-Hung Hsiehe41c99b2016-09-12 16:20:49 -07001775 total = unknown + known + skipped
Chih-Hung Hsieha9be47e2016-03-21 14:11:03 -07001776 output('\nTotal number of warnings: <b>' + str(total) + '</b>')
Marco Nelissen594375d2009-07-14 09:04:04 -07001777 if total < 1000:
1778 output('(low count may indicate incremental build)')
Chih-Hung Hsieh465b6102016-06-22 19:15:12 -07001779 output('<br><br>\n')
Chih-Hung Hsiehe41c99b2016-09-12 16:20:49 -07001780
1781def emitbuttons():
Chih-Hung Hsieh465b6102016-06-22 19:15:12 -07001782 output('<button class="button" onclick="expand_collapse(1);">' +
Chih-Hung Hsiehe41c99b2016-09-12 16:20:49 -07001783 'Expand all warnings</button>\n' +
Chih-Hung Hsieh465b6102016-06-22 19:15:12 -07001784 '<button class="button" onclick="expand_collapse(0);">' +
Chih-Hung Hsiehe41c99b2016-09-12 16:20:49 -07001785 'Collapse all warnings</button><br>\n')
Chih-Hung Hsieha9be47e2016-03-21 14:11:03 -07001786
Chih-Hung Hsieh465b6102016-06-22 19:15:12 -07001787# dump everything for a given severity
1788def dumpseverity(sev):
1789 global anchor
Chih-Hung Hsiehe41c99b2016-09-12 16:20:49 -07001790 total = 0
1791 for i in warnpatterns:
1792 if i['severity'] == sev:
1793 total = total + len(i['members'])
Chih-Hung Hsieh99459fc2016-09-22 13:43:12 -07001794 output('\n<br><span style="background-color:' + severity.color[sev] + '"><b>' +
1795 severity.header[sev] + ': ' + str(total) + '</b></span>\n')
Chih-Hung Hsieh90d46192016-03-29 15:33:11 -07001796 output('<blockquote>\n')
Chih-Hung Hsieha9be47e2016-03-21 14:11:03 -07001797 for i in warnpatterns:
Chih-Hung Hsiehe41c99b2016-09-12 16:20:49 -07001798 if i['severity'] == sev and len(i['members']) > 0:
1799 anchor += 1
1800 i['anchor'] = str(anchor)
1801 if args.byproject:
1802 dumpcategorybyproject(sev, i)
1803 else:
1804 dumpcategory(sev, i)
Chih-Hung Hsieh465b6102016-06-22 19:15:12 -07001805 output('</blockquote>\n')
Marco Nelissen594375d2009-07-14 09:04:04 -07001806
Chih-Hung Hsiehe41c99b2016-09-12 16:20:49 -07001807# emit all skipped project anchors for expand_collapse.
1808def dumpskippedanchors():
1809 output('<div style="display:none;">\n') # hide these fake elements
1810 for i in warnpatterns:
1811 if i['severity'] == severity.SKIP and len(i['members']) > 0:
1812 projects = i['projectwarning'].keys()
1813 for p in projects:
1814 output('<div id="' + i['projectanchor'][p] + '"></div>' +
1815 '<div id="' + i['projectanchor'][p] + '_mark"></div>\n')
1816 output('</div>\n')
1817
Marco Nelissen594375d2009-07-14 09:04:04 -07001818def allpatterns(cat):
1819 pats = ''
1820 for i in cat['patterns']:
1821 pats += i
1822 pats += ' / '
1823 return pats
1824
1825def descriptionfor(cat):
1826 if cat['description'] != '':
1827 return cat['description']
1828 return allpatterns(cat)
1829
1830
1831# show which warnings no longer occur
1832def dumpfixed():
Chih-Hung Hsieh465b6102016-06-22 19:15:12 -07001833 global anchor
1834 anchor += 1
1835 mark = str(anchor) + '_mark'
1836 output('\n<br><p style="background-color:lightblue"><b>' +
1837 '<button id="' + mark + '" ' +
1838 'class="bt" onclick="expand(' + str(anchor) + ');">' +
1839 '&#x2295</button> Fixed warnings. ' +
1840 'No more occurences. Please consider turning these into ' +
1841 'errors if possible, before they are reintroduced in to the build' +
1842 ':</b></p>\n')
1843 output('<blockquote>\n')
1844 fixed_patterns = []
Marco Nelissen594375d2009-07-14 09:04:04 -07001845 for i in warnpatterns:
Chih-Hung Hsiehe41c99b2016-09-12 16:20:49 -07001846 if len(i['members']) == 0:
Chih-Hung Hsieh465b6102016-06-22 19:15:12 -07001847 fixed_patterns.append(i['description'] + ' (' +
Chih-Hung Hsieh99459fc2016-09-22 13:43:12 -07001848 allpatterns(i) + ')')
1849 if i['option']:
1850 fixed_patterns.append(' ' + i['option'])
Chih-Hung Hsieh465b6102016-06-22 19:15:12 -07001851 fixed_patterns.sort()
1852 output('<div id="' + str(anchor) + '" style="display:none;"><table>\n')
1853 for i in fixed_patterns:
1854 tablerow(i)
1855 output('</table></div>\n')
1856 output('</blockquote>\n')
Marco Nelissen594375d2009-07-14 09:04:04 -07001857
Ian Rogersf3829732016-05-10 12:06:01 -07001858def warningwithurl(line):
1859 if not args.url:
1860 return line
1861 m = re.search( r'^([^ :]+):(\d+):(.+)', line, re.M|re.I)
1862 if not m:
1863 return line
1864 filepath = m.group(1)
1865 linenumber = m.group(2)
1866 warning = m.group(3)
1867 if args.separator:
1868 return '<a href="' + args.url + '/' + filepath + args.separator + linenumber + '">' + filepath + ':' + linenumber + '</a>:' + warning
1869 else:
1870 return '<a href="' + args.url + '/' + filepath + '">' + filepath + '</a>:' + linenumber + ':' + warning
Marco Nelissen594375d2009-07-14 09:04:04 -07001871
Chih-Hung Hsieh4354a332016-07-22 14:09:31 -07001872def dumpgroup(sev, anchor, description, warnings):
1873 mark = anchor + '_mark'
Chih-Hung Hsiehe41c99b2016-09-12 16:20:49 -07001874 output('\n<table class="t1">\n')
Chih-Hung Hsieh99459fc2016-09-22 13:43:12 -07001875 output('<tr bgcolor="' + severity.color[sev] + '">' +
Chih-Hung Hsieh4354a332016-07-22 14:09:31 -07001876 '<td><button class="bt" id="' + mark +
1877 '" onclick="expand(\'' + anchor + '\');">' +
1878 '&#x2295</button> ' + description + '</td></tr>\n')
1879 output('</table>\n')
1880 output('<div id="' + anchor + '" style="display:none;">')
Chih-Hung Hsiehe41c99b2016-09-12 16:20:49 -07001881 output('<table class="t1">\n')
Chih-Hung Hsieh4354a332016-07-22 14:09:31 -07001882 for i in warnings:
1883 tablerow(warningwithurl(i))
1884 output('</table></div>\n')
Chih-Hung Hsieh465b6102016-06-22 19:15:12 -07001885
Chih-Hung Hsieh4354a332016-07-22 14:09:31 -07001886# dump warnings in a category
1887def dumpcategory(sev, cat):
1888 description = descriptionfor(cat) + ' (' + str(len(cat['members'])) + ')'
1889 dumpgroup(sev, cat['anchor'], description, cat['members'])
Marco Nelissen594375d2009-07-14 09:04:04 -07001890
Chih-Hung Hsieh4354a332016-07-22 14:09:31 -07001891# similar to dumpcategory but output one table per project.
1892def dumpcategorybyproject(sev, cat):
1893 warning = descriptionfor(cat)
1894 projects = cat['projectwarning'].keys()
1895 projects.sort()
1896 for p in projects:
1897 anchor = cat['projectanchor'][p]
1898 projectwarnings = cat['projectwarning'][p]
1899 description = '{}, in {} ({})'.format(warning, p, len(projectwarnings))
1900 dumpgroup(sev, anchor, description, projectwarnings)
Marco Nelissen594375d2009-07-14 09:04:04 -07001901
Chih-Hung Hsieh48a16ba2016-07-21 14:22:53 -07001902def findproject(line):
1903 for p in projectpatterns:
1904 if p['pattern'].match(line):
1905 return p['description']
1906 return '???'
1907
Marco Nelissen594375d2009-07-14 09:04:04 -07001908def classifywarning(line):
Chih-Hung Hsieh4354a332016-07-22 14:09:31 -07001909 global anchor
Marco Nelissen594375d2009-07-14 09:04:04 -07001910 for i in warnpatterns:
Marco Nelissen2bdc7ec2009-09-29 10:19:29 -07001911 for cpat in i['compiledpatterns']:
1912 if cpat.match(line):
Marco Nelissen594375d2009-07-14 09:04:04 -07001913 i['members'].append(line)
Chih-Hung Hsieh48a16ba2016-07-21 14:22:53 -07001914 pname = findproject(line)
Chih-Hung Hsieh4354a332016-07-22 14:09:31 -07001915 # Count warnings by project.
Chih-Hung Hsieh48a16ba2016-07-21 14:22:53 -07001916 if pname in i['projects']:
Chih-Hung Hsieh4354a332016-07-22 14:09:31 -07001917 i['projects'][pname] += 1
Chih-Hung Hsieh48a16ba2016-07-21 14:22:53 -07001918 else:
Chih-Hung Hsieh4354a332016-07-22 14:09:31 -07001919 i['projects'][pname] = 1
1920 # Collect warnings by project.
1921 if args.byproject:
1922 if pname in i['projectwarning']:
1923 i['projectwarning'][pname].append(line)
1924 else:
1925 i['projectwarning'][pname] = [line]
1926 if pname not in i['projectanchor']:
1927 anchor += 1
1928 i['projectanchor'][pname] = str(anchor)
Marco Nelissen594375d2009-07-14 09:04:04 -07001929 return
Chih-Hung Hsieh48a16ba2016-07-21 14:22:53 -07001930 else:
1931 # If we end up here, there was a problem parsing the log
1932 # probably caused by 'make -j' mixing the output from
1933 # 2 or more concurrent compiles
1934 pass
Marco Nelissen594375d2009-07-14 09:04:04 -07001935
Marco Nelissen2bdc7ec2009-09-29 10:19:29 -07001936# precompiling every pattern speeds up parsing by about 30x
1937def compilepatterns():
1938 for i in warnpatterns:
1939 i['compiledpatterns'] = []
1940 for pat in i['patterns']:
1941 i['compiledpatterns'].append(re.compile(pat))
Marco Nelissen594375d2009-07-14 09:04:04 -07001942
Chih-Hung Hsieh48a16ba2016-07-21 14:22:53 -07001943def parseinputfile():
1944 global platformversion
1945 global targetproduct
1946 global targetvariant
1947 infile = open(args.buildlog, 'r')
1948 linecounter = 0
Marco Nelissen594375d2009-07-14 09:04:04 -07001949
Chih-Hung Hsieh48a16ba2016-07-21 14:22:53 -07001950 warningpattern = re.compile('.* warning:.*')
1951 compilepatterns()
Marco Nelissen594375d2009-07-14 09:04:04 -07001952
Chih-Hung Hsieh48a16ba2016-07-21 14:22:53 -07001953 # read the log file and classify all the warnings
1954 warninglines = set()
1955 for line in infile:
1956 # replace fancy quotes with plain ol' quotes
1957 line = line.replace("‘", "'");
1958 line = line.replace("’", "'");
1959 if warningpattern.match(line):
1960 if line not in warninglines:
1961 classifywarning(line)
1962 warninglines.add(line)
1963 else:
1964 # save a little bit of time by only doing this for the first few lines
1965 if linecounter < 50:
1966 linecounter +=1
1967 m = re.search('(?<=^PLATFORM_VERSION=).*', line)
1968 if m != None:
1969 platformversion = m.group(0)
1970 m = re.search('(?<=^TARGET_PRODUCT=).*', line)
1971 if m != None:
1972 targetproduct = m.group(0)
1973 m = re.search('(?<=^TARGET_BUILD_VARIANT=).*', line)
1974 if m != None:
1975 targetvariant = m.group(0)
Marco Nelissen594375d2009-07-14 09:04:04 -07001976
1977
1978# dump the html output to stdout
Chih-Hung Hsieh48a16ba2016-07-21 14:22:53 -07001979def dumphtml():
1980 dumphtmlprologue('Warnings for ' + platformversion + ' - ' + targetproduct + ' - ' + targetvariant)
1981 dumpstats()
Chih-Hung Hsiehe41c99b2016-09-12 16:20:49 -07001982 dumpstatsbyproject()
1983 emitbuttons()
Chih-Hung Hsieh48a16ba2016-07-21 14:22:53 -07001984 # sort table based on number of members once dumpstats has deduplicated the
1985 # members.
1986 warnpatterns.sort(reverse=True, key=lambda i: len(i['members']))
Chih-Hung Hsiehe41c99b2016-09-12 16:20:49 -07001987 # Dump warnings by severity. If severity.SKIP warnings are not dumpped,
1988 # the project anchors should be dumped through dumpskippedanchors.
1989 for s in severity.kinds:
1990 dumpseverity(s)
Chih-Hung Hsieh48a16ba2016-07-21 14:22:53 -07001991 dumpfixed()
1992 dumphtmlepilogue()
1993
1994
1995##### Functions to count warnings and dump csv file. #########################
1996
1997def descriptionforcsv(cat):
1998 if cat['description'] == '':
1999 return '?'
2000 return cat['description']
2001
2002def stringforcsv(s):
2003 if ',' in s:
2004 return '"{}"'.format(s)
2005 return s
2006
2007def countseverity(sev, kind):
2008 sum = 0
2009 for i in warnpatterns:
2010 if i['severity'] == sev and len(i['members']) > 0:
2011 n = len(i['members'])
2012 sum += n
2013 warning = stringforcsv(kind + ': ' + descriptionforcsv(i))
2014 print '{},,{}'.format(n, warning)
2015 # print number of warnings for each project, ordered by project name.
2016 projects = i['projects'].keys()
2017 projects.sort()
2018 for p in projects:
2019 print '{},{},{}'.format(i['projects'][p], p, warning)
2020 print '{},,{}'.format(sum, kind + ' warnings')
2021 return sum
2022
2023# dump number of warnings in csv format to stdout
2024def dumpcsv():
2025 sortwarnings()
2026 total = 0
Chih-Hung Hsiehe41c99b2016-09-12 16:20:49 -07002027 for s in severity.kinds:
Chih-Hung Hsieh99459fc2016-09-22 13:43:12 -07002028 total += countseverity(s, severity.columnheader[s])
Chih-Hung Hsieh48a16ba2016-07-21 14:22:53 -07002029 print '{},,{}'.format(total, 'All warnings')
2030
2031
2032parseinputfile()
2033if args.gencsv:
2034 dumpcsv()
2035else:
2036 dumphtml()