1 #!/usr/bin/python 2 # This file uses the following encoding: utf-8 3 4 """Grep warnings messages and output HTML tables or warning counts in CSV. 5 6 Default is to output warnings in HTML tables grouped by warning severity. 7 Use option --byproject to output tables grouped by source file projects. 8 Use option --gencsv to output warning counts in CSV format. 9 """ 10 11 # List of important data structures and functions in this script. 12 # 13 # To parse and keep warning message in the input file: 14 # severity: classification of message severity 15 # severity.range [0, 1, ... last_severity_level] 16 # severity.colors for header background 17 # severity.column_headers for the warning count table 18 # severity.headers for warning message tables 19 # warn_patterns: 20 # warn_patterns[w]['category'] tool that issued the warning, not used now 21 # warn_patterns[w]['description'] table heading 22 # warn_patterns[w]['members'] matched warnings from input 23 # warn_patterns[w]['option'] compiler flag to control the warning 24 # warn_patterns[w]['patterns'] regular expressions to match warnings 25 # warn_patterns[w]['projects'][p] number of warnings of pattern w in p 26 # warn_patterns[w]['severity'] severity level 27 # project_list[p][0] project name 28 # project_list[p][1] regular expression to match a project path 29 # project_patterns[p] re.compile(project_list[p][1]) 30 # project_names[p] project_list[p][0] 31 # warning_messages array of each warning message, without source url 32 # warning_records array of [idx to warn_patterns, 33 # idx to project_names, 34 # idx to warning_messages] 35 # android_root 36 # platform_version 37 # target_product 38 # target_variant 39 # compile_patterns, parse_input_file 40 # 41 # To emit html page of warning messages: 42 # flags: --byproject, --url, --separator 43 # Old stuff for static html components: 44 # html_script_style: static html scripts and styles 45 # htmlbig: 46 # dump_stats, dump_html_prologue, dump_html_epilogue: 47 # emit_buttons: 48 # dump_fixed 49 # sort_warnings: 50 # emit_stats_by_project: 51 # all_patterns, 52 # findproject, classify_warning 53 # dump_html 54 # 55 # New dynamic HTML page's static JavaScript data: 56 # Some data are copied from Python to JavaScript, to generate HTML elements. 57 # FlagURL args.url 58 # FlagSeparator args.separator 59 # SeverityColors: severity.colors 60 # SeverityHeaders: severity.headers 61 # SeverityColumnHeaders: severity.column_headers 62 # ProjectNames: project_names, or project_list[*][0] 63 # WarnPatternsSeverity: warn_patterns[*]['severity'] 64 # WarnPatternsDescription: warn_patterns[*]['description'] 65 # WarnPatternsOption: warn_patterns[*]['option'] 66 # WarningMessages: warning_messages 67 # Warnings: warning_records 68 # StatsHeader: warning count table header row 69 # StatsRows: array of warning count table rows 70 # 71 # New dynamic HTML page's dynamic JavaScript data: 72 # 73 # New dynamic HTML related function to emit data: 74 # escape_string, strip_escape_string, emit_warning_arrays 75 # emit_js_data(): 76 77 import argparse 78 import csv 79 import multiprocessing 80 import os 81 import re 82 import signal 83 import sys 84 85 parser = argparse.ArgumentParser(description='Convert a build log into HTML') 86 parser.add_argument('--csvpath', 87 help='Save CSV warning file to the passed absolute path', 88 default=None) 89 parser.add_argument('--gencsv', 90 help='Generate a CSV file with number of various warnings', 91 action='store_true', 92 default=False) 93 parser.add_argument('--byproject', 94 help='Separate warnings in HTML output by project names', 95 action='store_true', 96 default=False) 97 parser.add_argument('--url', 98 help='Root URL of an Android source code tree prefixed ' 99 'before files in warnings') 100 parser.add_argument('--separator', 101 help='Separator between the end of a URL and the line ' 102 'number argument. e.g. #') 103 parser.add_argument('--processes', 104 type=int, 105 default=multiprocessing.cpu_count(), 106 help='Number of parallel processes to process warnings') 107 parser.add_argument(dest='buildlog', metavar='build.log', 108 help='Path to build.log file') 109 args = parser.parse_args() 110 111 112 class Severity(object): 113 """Severity levels and attributes.""" 114 # numbered by dump order 115 FIXMENOW = 0 116 HIGH = 1 117 MEDIUM = 2 118 LOW = 3 119 ANALYZER = 4 120 TIDY = 5 121 HARMLESS = 6 122 UNKNOWN = 7 123 SKIP = 8 124 range = range(SKIP + 1) 125 attributes = [ 126 # pylint:disable=bad-whitespace 127 ['fuchsia', 'FixNow', 'Critical warnings, fix me now'], 128 ['red', 'High', 'High severity warnings'], 129 ['orange', 'Medium', 'Medium severity warnings'], 130 ['yellow', 'Low', 'Low severity warnings'], 131 ['hotpink', 'Analyzer', 'Clang-Analyzer warnings'], 132 ['peachpuff', 'Tidy', 'Clang-Tidy warnings'], 133 ['limegreen', 'Harmless', 'Harmless warnings'], 134 ['lightblue', 'Unknown', 'Unknown warnings'], 135 ['grey', 'Unhandled', 'Unhandled warnings'] 136 ] 137 colors = [a[0] for a in attributes] 138 column_headers = [a[1] for a in attributes] 139 headers = [a[2] for a in attributes] 140 141 142 def tidy_warn_pattern(description, pattern): 143 return { 144 'category': 'C/C++', 145 'severity': Severity.TIDY, 146 'description': 'clang-tidy ' + description, 147 'patterns': [r'.*: .+\[' + pattern + r'\]$'] 148 } 149 150 151 def simple_tidy_warn_pattern(description): 152 return tidy_warn_pattern(description, description) 153 154 155 def group_tidy_warn_pattern(description): 156 return tidy_warn_pattern(description, description + r'-.+') 157 158 159 warn_patterns = [ 160 # pylint:disable=line-too-long,g-inconsistent-quotes 161 {'category': 'C/C++', 'severity': Severity.ANALYZER, 162 'description': 'clang-analyzer Security warning', 163 'patterns': [r".*: warning: .+\[clang-analyzer-security.*\]"]}, 164 {'category': 'make', 'severity': Severity.MEDIUM, 165 'description': 'make: overriding commands/ignoring old commands', 166 'patterns': [r".*: warning: overriding commands for target .+", 167 r".*: warning: ignoring old commands for target .+"]}, 168 {'category': 'make', 'severity': Severity.HIGH, 169 'description': 'make: LOCAL_CLANG is false', 170 'patterns': [r".*: warning: LOCAL_CLANG is set to false"]}, 171 {'category': 'make', 'severity': Severity.HIGH, 172 'description': 'SDK App using platform shared library', 173 'patterns': [r".*: warning: .+ \(.*app:sdk.*\) should not link to .+ \(native:platform\)"]}, 174 {'category': 'make', 'severity': Severity.HIGH, 175 'description': 'System module linking to a vendor module', 176 'patterns': [r".*: warning: .+ \(.+\) should not link to .+ \(partition:.+\)"]}, 177 {'category': 'make', 'severity': Severity.MEDIUM, 178 'description': 'Invalid SDK/NDK linking', 179 'patterns': [r".*: warning: .+ \(.+\) should not link to .+ \(.+\)"]}, 180 {'category': 'C/C++', 'severity': Severity.HIGH, 'option': '-Wimplicit-function-declaration', 181 'description': 'Implicit function declaration', 182 'patterns': [r".*: warning: implicit declaration of function .+", 183 r".*: warning: implicitly declaring library function"]}, 184 {'category': 'C/C++', 'severity': Severity.SKIP, 185 'description': 'skip, conflicting types for ...', 186 'patterns': [r".*: warning: conflicting types for '.+'"]}, 187 {'category': 'C/C++', 'severity': Severity.HIGH, 'option': '-Wtype-limits', 188 'description': 'Expression always evaluates to true or false', 189 'patterns': [r".*: warning: comparison is always .+ due to limited range of data type", 190 r".*: warning: comparison of unsigned .*expression .+ is always true", 191 r".*: warning: comparison of unsigned .*expression .+ is always false"]}, 192 {'category': 'C/C++', 'severity': Severity.HIGH, 193 'description': 'Potential leak of memory, bad free, use after free', 194 'patterns': [r".*: warning: Potential leak of memory", 195 r".*: warning: Potential memory leak", 196 r".*: warning: Memory allocated by alloca\(\) should not be deallocated", 197 r".*: warning: Memory allocated by .+ should be deallocated by .+ not .+", 198 r".*: warning: 'delete' applied to a pointer that was allocated", 199 r".*: warning: Use of memory after it is freed", 200 r".*: warning: Argument to .+ is the address of .+ variable", 201 r".*: warning: Argument to free\(\) is offset by .+ of memory allocated by", 202 r".*: warning: Attempt to .+ released memory"]}, 203 {'category': 'C/C++', 'severity': Severity.HIGH, 204 'description': 'Use transient memory for control value', 205 'patterns': [r".*: warning: .+Using such transient memory for the control value is .*dangerous."]}, 206 {'category': 'C/C++', 'severity': Severity.HIGH, 207 'description': 'Return address of stack memory', 208 'patterns': [r".*: warning: Address of stack memory .+ returned to caller", 209 r".*: warning: Address of stack memory .+ will be a dangling reference"]}, 210 {'category': 'C/C++', 'severity': Severity.HIGH, 211 'description': 'Problem with vfork', 212 'patterns': [r".*: warning: This .+ is prohibited after a successful vfork", 213 r".*: warning: Call to function '.+' is insecure "]}, 214 {'category': 'C/C++', 'severity': Severity.HIGH, 'option': 'infinite-recursion', 215 'description': 'Infinite recursion', 216 'patterns': [r".*: warning: all paths through this function will call itself"]}, 217 {'category': 'C/C++', 'severity': Severity.HIGH, 218 'description': 'Potential buffer overflow', 219 'patterns': [r".*: warning: Size argument is greater than .+ the destination buffer", 220 r".*: warning: Potential buffer overflow.", 221 r".*: warning: String copy function overflows destination buffer"]}, 222 {'category': 'C/C++', 'severity': Severity.MEDIUM, 223 'description': 'Incompatible pointer types', 224 'patterns': [r".*: warning: assignment from incompatible pointer type", 225 r".*: warning: return from incompatible pointer type", 226 r".*: warning: passing argument [0-9]+ of '.*' from incompatible pointer type", 227 r".*: warning: initialization from incompatible pointer type"]}, 228 {'category': 'C/C++', 'severity': Severity.HIGH, 'option': '-fno-builtin', 229 'description': 'Incompatible declaration of built in function', 230 'patterns': [r".*: warning: incompatible implicit declaration of built-in function .+"]}, 231 {'category': 'C/C++', 'severity': Severity.HIGH, 'option': '-Wincompatible-library-redeclaration', 232 'description': 'Incompatible redeclaration of library function', 233 'patterns': [r".*: warning: incompatible redeclaration of library function .+"]}, 234 {'category': 'C/C++', 'severity': Severity.HIGH, 235 'description': 'Null passed as non-null argument', 236 'patterns': [r".*: warning: Null passed to a callee that requires a non-null"]}, 237 {'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': '-Wunused-parameter', 238 'description': 'Unused parameter', 239 'patterns': [r".*: warning: unused parameter '.*'"]}, 240 {'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': '-Wunused', 241 'description': 'Unused function, variable or label', 242 'patterns': [r".*: warning: '.+' defined but not used", 243 r".*: warning: unused function '.+'", 244 r".*: warning: lambda capture .* is not used", 245 r".*: warning: private field '.+' is not used", 246 r".*: warning: unused variable '.+'"]}, 247 {'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': '-Wunused-value', 248 'description': 'Statement with no effect or result unused', 249 'patterns': [r".*: warning: statement with no effect", 250 r".*: warning: expression result unused"]}, 251 {'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': '-Wunused-result', 252 'description': 'Ignoreing return value of function', 253 'patterns': [r".*: warning: ignoring return value of function .+Wunused-result"]}, 254 {'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': '-Wmissing-field-initializers', 255 'description': 'Missing initializer', 256 'patterns': [r".*: warning: missing initializer"]}, 257 {'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': '-Wdelete-non-virtual-dtor', 258 'description': 'Need virtual destructor', 259 'patterns': [r".*: warning: delete called .* has virtual functions but non-virtual destructor"]}, 260 {'category': 'cont.', 'severity': Severity.SKIP, 261 'description': 'skip, near initialization for ...', 262 'patterns': [r".*: warning: \(near initialization for '.+'\)"]}, 263 {'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': '-Wdate-time', 264 'description': 'Expansion of data or time macro', 265 'patterns': [r".*: warning: expansion of date or time macro is not reproducible"]}, 266 {'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': '-Wformat', 267 'description': 'Format string does not match arguments', 268 'patterns': [r".*: warning: format '.+' expects type '.+', but argument [0-9]+ has type '.+'", 269 r".*: warning: more '%' conversions than data arguments", 270 r".*: warning: data argument not used by format string", 271 r".*: warning: incomplete format specifier", 272 r".*: warning: unknown conversion type .* in format", 273 r".*: warning: format .+ expects .+ but argument .+Wformat=", 274 r".*: warning: field precision should have .+ but argument has .+Wformat", 275 r".*: warning: format specifies type .+ but the argument has .*type .+Wformat"]}, 276 {'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': '-Wformat-extra-args', 277 'description': 'Too many arguments for format string', 278 'patterns': [r".*: warning: too many arguments for format"]}, 279 {'category': 'C/C++', 'severity': Severity.MEDIUM, 280 'description': 'Too many arguments in call', 281 'patterns': [r".*: warning: too many arguments in call to "]}, 282 {'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': '-Wformat-invalid-specifier', 283 'description': 'Invalid format specifier', 284 'patterns': [r".*: warning: invalid .+ specifier '.+'.+format-invalid-specifier"]}, 285 {'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': '-Wsign-compare', 286 'description': 'Comparison between signed and unsigned', 287 'patterns': [r".*: warning: comparison between signed and unsigned", 288 r".*: warning: comparison of promoted \~unsigned with unsigned", 289 r".*: warning: signed and unsigned type in conditional expression"]}, 290 {'category': 'C/C++', 'severity': Severity.MEDIUM, 291 'description': 'Comparison between enum and non-enum', 292 'patterns': [r".*: warning: enumeral and non-enumeral type in conditional expression"]}, 293 {'category': 'libpng', 'severity': Severity.MEDIUM, 294 'description': 'libpng: zero area', 295 'patterns': [r".*libpng warning: Ignoring attempt to set cHRM RGB triangle with zero area"]}, 296 {'category': 'aapt', 'severity': Severity.MEDIUM, 297 'description': 'aapt: no comment for public symbol', 298 'patterns': [r".*: warning: No comment for public symbol .+"]}, 299 {'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': '-Wmissing-braces', 300 'description': 'Missing braces around initializer', 301 'patterns': [r".*: warning: missing braces around initializer.*"]}, 302 {'category': 'C/C++', 'severity': Severity.HARMLESS, 303 'description': 'No newline at end of file', 304 'patterns': [r".*: warning: no newline at end of file"]}, 305 {'category': 'C/C++', 'severity': Severity.HARMLESS, 306 'description': 'Missing space after macro name', 307 'patterns': [r".*: warning: missing whitespace after the macro name"]}, 308 {'category': 'C/C++', 'severity': Severity.LOW, 'option': '-Wcast-align', 309 'description': 'Cast increases required alignment', 310 'patterns': [r".*: warning: cast from .* to .* increases required alignment .*"]}, 311 {'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': '-Wcast-qual', 312 'description': 'Qualifier discarded', 313 'patterns': [r".*: warning: passing argument [0-9]+ of '.+' discards qualifiers from pointer target type", 314 r".*: warning: assignment discards qualifiers from pointer target type", 315 r".*: warning: passing .+ to parameter of type .+ discards qualifiers", 316 r".*: warning: assigning to .+ from .+ discards qualifiers", 317 r".*: warning: initializing .+ discards qualifiers .+types-discards-qualifiers", 318 r".*: warning: return discards qualifiers from pointer target type"]}, 319 {'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': '-Wunknown-attributes', 320 'description': 'Unknown attribute', 321 'patterns': [r".*: warning: unknown attribute '.+'"]}, 322 {'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': '-Wignored-attributes', 323 'description': 'Attribute ignored', 324 'patterns': [r".*: warning: '_*packed_*' attribute ignored", 325 r".*: warning: attribute declaration must precede definition .+ignored-attributes"]}, 326 {'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': '-Wvisibility', 327 'description': 'Visibility problem', 328 'patterns': [r".*: warning: declaration of '.+' will not be visible outside of this function"]}, 329 {'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': '-Wattributes', 330 'description': 'Visibility mismatch', 331 'patterns': [r".*: warning: '.+' declared with greater visibility than the type of its field '.+'"]}, 332 {'category': 'C/C++', 'severity': Severity.MEDIUM, 333 'description': 'Shift count greater than width of type', 334 'patterns': [r".*: warning: (left|right) shift count >= width of type"]}, 335 {'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': '-Wextern-initializer', 336 'description': 'extern <foo> is initialized', 337 'patterns': [r".*: warning: '.+' initialized and declared 'extern'", 338 r".*: warning: 'extern' variable has an initializer"]}, 339 {'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': '-Wold-style-declaration', 340 'description': 'Old style declaration', 341 'patterns': [r".*: warning: 'static' is not at beginning of declaration"]}, 342 {'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': '-Wreturn-type', 343 'description': 'Missing return value', 344 'patterns': [r".*: warning: control reaches end of non-void function"]}, 345 {'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': '-Wimplicit-int', 346 'description': 'Implicit int type', 347 'patterns': [r".*: warning: type specifier missing, defaults to 'int'", 348 r".*: warning: type defaults to 'int' in declaration of '.+'"]}, 349 {'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': '-Wmain-return-type', 350 'description': 'Main function should return int', 351 'patterns': [r".*: warning: return type of 'main' is not 'int'"]}, 352 {'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': '-Wuninitialized', 353 'description': 'Variable may be used uninitialized', 354 'patterns': [r".*: warning: '.+' may be used uninitialized in this function"]}, 355 {'category': 'C/C++', 'severity': Severity.HIGH, 'option': '-Wuninitialized', 356 'description': 'Variable is used uninitialized', 357 'patterns': [r".*: warning: '.+' is used uninitialized in this function", 358 r".*: warning: variable '.+' is uninitialized when used here"]}, 359 {'category': 'ld', 'severity': Severity.MEDIUM, 'option': '-fshort-enums', 360 'description': 'ld: possible enum size mismatch', 361 'patterns': [r".*: warning: .* uses variable-size enums yet the output is to use 32-bit enums; use of enum values across objects may fail"]}, 362 {'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': '-Wpointer-sign', 363 'description': 'Pointer targets differ in signedness', 364 'patterns': [r".*: warning: pointer targets in initialization differ in signedness", 365 r".*: warning: pointer targets in assignment differ in signedness", 366 r".*: warning: pointer targets in return differ in signedness", 367 r".*: warning: pointer targets in passing argument [0-9]+ of '.+' differ in signedness"]}, 368 {'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': '-Wstrict-overflow', 369 'description': 'Assuming overflow does not occur', 370 'patterns': [r".*: warning: assuming signed overflow does not occur when assuming that .* is always (true|false)"]}, 371 {'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': '-Wempty-body', 372 'description': 'Suggest adding braces around empty body', 373 'patterns': [r".*: warning: suggest braces around empty body in an 'if' statement", 374 r".*: warning: empty body in an if-statement", 375 r".*: warning: suggest braces around empty body in an 'else' statement", 376 r".*: warning: empty body in an else-statement"]}, 377 {'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': '-Wparentheses', 378 'description': 'Suggest adding parentheses', 379 'patterns': [r".*: warning: suggest explicit braces to avoid ambiguous 'else'", 380 r".*: warning: suggest parentheses around arithmetic in operand of '.+'", 381 r".*: warning: suggest parentheses around comparison in operand of '.+'", 382 r".*: warning: logical not is only applied to the left hand side of this comparison", 383 r".*: warning: using the result of an assignment as a condition without parentheses", 384 r".*: warning: .+ has lower precedence than .+ be evaluated first .+Wparentheses", 385 r".*: warning: suggest parentheses around '.+?' .+ '.+?'", 386 r".*: warning: suggest parentheses around assignment used as truth value"]}, 387 {'category': 'C/C++', 'severity': Severity.MEDIUM, 388 'description': 'Static variable used in non-static inline function', 389 'patterns': [r".*: warning: '.+' is static but used in inline function '.+' which is not static"]}, 390 {'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': '-Wimplicit int', 391 'description': 'No type or storage class (will default to int)', 392 'patterns': [r".*: warning: data definition has no type or storage class"]}, 393 {'category': 'C/C++', 'severity': Severity.MEDIUM, 394 'description': 'Null pointer', 395 'patterns': [r".*: warning: Dereference of null pointer", 396 r".*: warning: Called .+ pointer is null", 397 r".*: warning: Forming reference to null pointer", 398 r".*: warning: Returning null reference", 399 r".*: warning: Null pointer passed as an argument to a 'nonnull' parameter", 400 r".*: warning: .+ results in a null pointer dereference", 401 r".*: warning: Access to .+ results in a dereference of a null pointer", 402 r".*: warning: Null pointer argument in"]}, 403 {'category': 'cont.', 'severity': Severity.SKIP, 404 'description': 'skip, parameter name (without types) in function declaration', 405 'patterns': [r".*: warning: parameter names \(without types\) in function declaration"]}, 406 {'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': '-Wstrict-aliasing', 407 'description': 'Dereferencing <foo> breaks strict aliasing rules', 408 'patterns': [r".*: warning: dereferencing .* break strict-aliasing rules"]}, 409 {'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': '-Wpointer-to-int-cast', 410 'description': 'Cast from pointer to integer of different size', 411 'patterns': [r".*: warning: cast from pointer to integer of different size", 412 r".*: warning: initialization makes pointer from integer without a cast"]}, 413 {'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': '-Wint-to-pointer-cast', 414 'description': 'Cast to pointer from integer of different size', 415 'patterns': [r".*: warning: cast to pointer from integer of different size"]}, 416 {'category': 'C/C++', 'severity': Severity.MEDIUM, 417 'description': 'Symbol redefined', 418 'patterns': [r".*: warning: "".+"" redefined"]}, 419 {'category': 'cont.', 'severity': Severity.SKIP, 420 'description': 'skip, ... location of the previous definition', 421 'patterns': [r".*: warning: this is the location of the previous definition"]}, 422 {'category': 'ld', 'severity': Severity.MEDIUM, 423 'description': 'ld: type and size of dynamic symbol are not defined', 424 'patterns': [r".*: warning: type and size of dynamic symbol `.+' are not defined"]}, 425 {'category': 'C/C++', 'severity': Severity.MEDIUM, 426 'description': 'Pointer from integer without cast', 427 'patterns': [r".*: warning: assignment makes pointer from integer without a cast"]}, 428 {'category': 'C/C++', 'severity': Severity.MEDIUM, 429 'description': 'Pointer from integer without cast', 430 'patterns': [r".*: warning: passing argument [0-9]+ of '.+' makes pointer from integer without a cast"]}, 431 {'category': 'C/C++', 'severity': Severity.MEDIUM, 432 'description': 'Integer from pointer without cast', 433 'patterns': [r".*: warning: assignment makes integer from pointer without a cast"]}, 434 {'category': 'C/C++', 'severity': Severity.MEDIUM, 435 'description': 'Integer from pointer without cast', 436 'patterns': [r".*: warning: passing argument [0-9]+ of '.+' makes integer from pointer without a cast"]}, 437 {'category': 'C/C++', 'severity': Severity.MEDIUM, 438 'description': 'Integer from pointer without cast', 439 'patterns': [r".*: warning: return makes integer from pointer without a cast"]}, 440 {'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': '-Wunknown-pragmas', 441 'description': 'Ignoring pragma', 442 'patterns': [r".*: warning: ignoring #pragma .+"]}, 443 {'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': '-W#pragma-messages', 444 'description': 'Pragma warning messages', 445 'patterns': [r".*: warning: .+W#pragma-messages"]}, 446 {'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': '-Wclobbered', 447 'description': 'Variable might be clobbered by longjmp or vfork', 448 'patterns': [r".*: warning: variable '.+' might be clobbered by 'longjmp' or 'vfork'"]}, 449 {'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': '-Wclobbered', 450 'description': 'Argument might be clobbered by longjmp or vfork', 451 'patterns': [r".*: warning: argument '.+' might be clobbered by 'longjmp' or 'vfork'"]}, 452 {'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': '-Wredundant-decls', 453 'description': 'Redundant declaration', 454 'patterns': [r".*: warning: redundant redeclaration of '.+'"]}, 455 {'category': 'cont.', 'severity': Severity.SKIP, 456 'description': 'skip, previous declaration ... was here', 457 'patterns': [r".*: warning: previous declaration of '.+' was here"]}, 458 {'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': '-Wswitch-enum', 459 'description': 'Enum value not handled in switch', 460 'patterns': [r".*: warning: .*enumeration value.* not handled in switch.+Wswitch"]}, 461 {'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': '-Wuser-defined-warnings', 462 'description': 'User defined warnings', 463 'patterns': [r".*: warning: .* \[-Wuser-defined-warnings\]$"]}, 464 {'category': 'java', 'severity': Severity.MEDIUM, 'option': '-encoding', 465 'description': 'Java: Non-ascii characters used, but ascii encoding specified', 466 'patterns': [r".*: warning: unmappable character for encoding ascii"]}, 467 {'category': 'java', 'severity': Severity.MEDIUM, 468 'description': 'Java: Non-varargs call of varargs method with inexact argument type for last parameter', 469 'patterns': [r".*: warning: non-varargs call of varargs method with inexact argument type for last parameter"]}, 470 {'category': 'java', 'severity': Severity.MEDIUM, 471 'description': 'Java: Unchecked method invocation', 472 'patterns': [r".*: warning: \[unchecked\] unchecked method invocation: .+ in class .+"]}, 473 {'category': 'java', 'severity': Severity.MEDIUM, 474 'description': 'Java: Unchecked conversion', 475 'patterns': [r".*: warning: \[unchecked\] unchecked conversion"]}, 476 {'category': 'java', 'severity': Severity.MEDIUM, 477 'description': '_ used as an identifier', 478 'patterns': [r".*: warning: '_' used as an identifier"]}, 479 {'category': 'java', 'severity': Severity.HIGH, 480 'description': 'Use of internal proprietary API', 481 'patterns': [r".*: warning: .* is internal proprietary API and may be removed"]}, 482 483 # Warnings from Javac 484 {'category': 'java', 485 'severity': Severity.MEDIUM, 486 'description': 'Java: Use of deprecated member', 487 'patterns': [r'.*: warning: \[deprecation\] .+']}, 488 {'category': 'java', 489 'severity': Severity.MEDIUM, 490 'description': 'Java: Unchecked conversion', 491 'patterns': [r'.*: warning: \[unchecked\] .+']}, 492 493 # Begin warnings generated by Error Prone 494 {'category': 'java', 495 'severity': Severity.LOW, 496 'description': 497 'Java: @Multibinds is a more efficient and declarative mechanism for ensuring that a set multibinding is present in the graph.', 498 'patterns': [r".*: warning: \[EmptySetMultibindingContributions\] .+"]}, 499 {'category': 'java', 500 'severity': Severity.LOW, 501 'description': 502 'Java: Add a private constructor to modules that will not be instantiated by Dagger.', 503 'patterns': [r".*: warning: \[PrivateConstructorForNoninstantiableModuleTest\] .+"]}, 504 {'category': 'java', 505 'severity': Severity.LOW, 506 'description': 507 'Java: @Binds is a more efficient and declarative mechanism for delegating a binding.', 508 'patterns': [r".*: warning: \[UseBinds\] .+"]}, 509 {'category': 'java', 510 'severity': Severity.LOW, 511 'description': 512 'Java: Field name is CONSTANT CASE, but field is not static and final', 513 'patterns': [r".*: warning: \[ConstantField\] .+"]}, 514 {'category': 'java', 515 'severity': Severity.LOW, 516 'description': 517 'Java: Deprecated item is not annotated with @Deprecated', 518 'patterns': [r".*: warning: \[DepAnn\] .+"]}, 519 {'category': 'java', 520 'severity': Severity.LOW, 521 'description': 522 'Java: Prefer \'L\' to \'l\' for the suffix to long literals', 523 'patterns': [r".*: warning: \[LongLiteralLowerCaseSuffix\] .+"]}, 524 {'category': 'java', 525 'severity': Severity.LOW, 526 'description': 527 'Java: C-style array declarations should not be used', 528 'patterns': [r".*: warning: \[MixedArrayDimensions\] .+"]}, 529 {'category': 'java', 530 'severity': Severity.LOW, 531 'description': 532 'Java: Variable declarations should declare only one variable', 533 'patterns': [r".*: warning: \[MultiVariableDeclaration\] .+"]}, 534 {'category': 'java', 535 'severity': Severity.LOW, 536 'description': 537 'Java: Source files should not contain multiple top-level class declarations', 538 'patterns': [r".*: warning: \[MultipleTopLevelClasses\] .+"]}, 539 {'category': 'java', 540 'severity': Severity.LOW, 541 'description': 542 'Java: Package names should match the directory they are declared in', 543 'patterns': [r".*: warning: \[PackageLocation\] .+"]}, 544 {'category': 'java', 545 'severity': Severity.LOW, 546 'description': 547 'Java: Utility classes (only static members) are not designed to be instantiated and should be made noninstantiable with a default constructor.', 548 'patterns': [r".*: warning: \[PrivateConstructorForUtilityClass\] .+"]}, 549 {'category': 'java', 550 'severity': Severity.LOW, 551 'description': 552 'Java: Unused imports', 553 'patterns': [r".*: warning: \[RemoveUnusedImports\] .+"]}, 554 {'category': 'java', 555 'severity': Severity.LOW, 556 'description': 557 'Java: Unchecked exceptions do not need to be declared in the method signature.', 558 'patterns': [r".*: warning: \[ThrowsUncheckedException\] .+"]}, 559 {'category': 'java', 560 'severity': Severity.LOW, 561 'description': 562 'Java: Using static imports for types is unnecessary', 563 'patterns': [r".*: warning: \[UnnecessaryStaticImport\] .+"]}, 564 {'category': 'java', 565 'severity': Severity.LOW, 566 'description': 567 'Java: Wildcard imports, static or otherwise, should not be used', 568 'patterns': [r".*: warning: \[WildcardImport\] .+"]}, 569 {'category': 'java', 570 'severity': Severity.MEDIUM, 571 'description': 572 'Java: Subclasses of Fragment must be instantiable via Class#newInstance(): the class must be public, static and have a public nullary constructor', 573 'patterns': [r".*: warning: \[FragmentNotInstantiable\] .+"]}, 574 {'category': 'java', 575 'severity': Severity.MEDIUM, 576 'description': 577 'Java: Hardcoded reference to /sdcard', 578 'patterns': [r".*: warning: \[HardCodedSdCardPath\] .+"]}, 579 {'category': 'java', 580 'severity': Severity.MEDIUM, 581 'description': 582 'Java: @AssistedInject and @Inject should not be used on different constructors in the same class.', 583 'patterns': [r".*: warning: \[AssistedInjectAndInjectOnConstructors\] .+"]}, 584 {'category': 'java', 585 'severity': Severity.MEDIUM, 586 'description': 587 'Java: Constructors on abstract classes are never directly @Injected, only the constructors of their subclasses can be @Inject\'ed.', 588 'patterns': [r".*: warning: \[InjectOnConstructorOfAbstractClass\] .+"]}, 589 {'category': 'java', 590 'severity': Severity.MEDIUM, 591 'description': 592 'Java: Injection frameworks currently don\'t understand Qualifiers in TYPE PARAMETER or TYPE USE contexts.', 593 'patterns': [r".*: warning: \[QualifierWithTypeUse\] .+"]}, 594 {'category': 'java', 595 'severity': Severity.MEDIUM, 596 'description': 597 'Java: This code declares a binding for a common value type without a Qualifier annotation.', 598 'patterns': [r".*: warning: \[BindingToUnqualifiedCommonType\] .+"]}, 599 {'category': 'java', 600 'severity': Severity.MEDIUM, 601 'description': 602 '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.', 603 'patterns': [r".*: warning: \[OverridesGuiceInjectableMethod\] .+"]}, 604 {'category': 'java', 605 'severity': Severity.MEDIUM, 606 'description': 607 'Java: Double-checked locking on non-volatile fields is unsafe', 608 'patterns': [r".*: warning: \[DoubleCheckedLocking\] .+"]}, 609 {'category': 'java', 610 'severity': Severity.MEDIUM, 611 'description': 612 'Java: Enums should always be immutable', 613 'patterns': [r".*: warning: \[ImmutableEnumChecker\] .+"]}, 614 {'category': 'java', 615 'severity': Severity.MEDIUM, 616 'description': 617 'Java: Writes to static fields should not be guarded by instance locks', 618 'patterns': [r".*: warning: \[StaticGuardedByInstance\] .+"]}, 619 {'category': 'java', 620 'severity': Severity.MEDIUM, 621 'description': 622 'Java: Synchronizing on non-final fields is not safe: if the field is ever updated, different threads may end up locking on different objects.', 623 'patterns': [r".*: warning: \[SynchronizeOnNonFinalField\] .+"]}, 624 {'category': 'java', 625 'severity': Severity.MEDIUM, 626 'description': 627 'Java: Method reference is ambiguous', 628 'patterns': [r".*: warning: \[AmbiguousMethodReference\] .+"]}, 629 {'category': 'java', 630 'severity': Severity.MEDIUM, 631 'description': 632 'Java: A different potential argument is more similar to the name of the parameter than the existing argument; this may be an error', 633 'patterns': [r".*: warning: \[ArgumentParameterMismatch\] .+"]}, 634 {'category': 'java', 635 'severity': Severity.MEDIUM, 636 'description': 637 'Java: Assertions may be disabled at runtime and do not guarantee that execution will halt here; consider throwing an exception instead', 638 'patterns': [r".*: warning: \[AssertFalse\] .+"]}, 639 {'category': 'java', 640 'severity': Severity.MEDIUM, 641 'description': 642 'Java: Classes that implement Annotation must override equals and hashCode. Consider using AutoAnnotation instead of implementing Annotation by hand.', 643 'patterns': [r".*: warning: \[BadAnnotationImplementation\] .+"]}, 644 {'category': 'java', 645 'severity': Severity.MEDIUM, 646 'description': 647 'Java: Possible sign flip from narrowing conversion', 648 'patterns': [r".*: warning: \[BadComparable\] .+"]}, 649 {'category': 'java', 650 'severity': Severity.MEDIUM, 651 'description': 652 'Java: BigDecimal(double) and BigDecimal.valueOf(double) may lose precision, prefer BigDecimal(String) or BigDecimal(long)', 653 'patterns': [r".*: warning: \[BigDecimalLiteralDouble\] .+"]}, 654 {'category': 'java', 655 'severity': Severity.MEDIUM, 656 'description': 657 'Java: valueOf or autoboxing provides better time and space performance', 658 'patterns': [r".*: warning: \[BoxedPrimitiveConstructor\] .+"]}, 659 {'category': 'java', 660 'severity': Severity.MEDIUM, 661 'description': 662 'Java: Mockito cannot mock final classes', 663 'patterns': [r".*: warning: \[CannotMockFinalClass\] .+"]}, 664 {'category': 'java', 665 'severity': Severity.MEDIUM, 666 'description': 667 'Java: Inner class is non-static but does not reference enclosing class', 668 'patterns': [r".*: warning: \[ClassCanBeStatic\] .+"]}, 669 {'category': 'java', 670 'severity': Severity.MEDIUM, 671 'description': 672 'Java: Class.newInstance() bypasses exception checking; prefer getConstructor().newInstance()', 673 'patterns': [r".*: warning: \[ClassNewInstance\] .+"]}, 674 {'category': 'java', 675 'severity': Severity.MEDIUM, 676 'description': 677 'Java: Implicit use of the platform default charset, which can result in e.g. non-ASCII characters being silently replaced with \'?\' in many environments', 678 'patterns': [r".*: warning: \[DefaultCharset\] .+"]}, 679 {'category': 'java', 680 'severity': Severity.MEDIUM, 681 'description': 682 'Java: This code, which counts elements using a loop, can be replaced by a simpler library method', 683 'patterns': [r".*: warning: \[ElementsCountedInLoop\] .+"]}, 684 {'category': 'java', 685 'severity': Severity.MEDIUM, 686 'description': 687 'Java: Empty top-level type declaration', 688 'patterns': [r".*: warning: \[EmptyTopLevelDeclaration\] .+"]}, 689 {'category': 'java', 690 'severity': Severity.MEDIUM, 691 'description': 692 'Java: Classes that override equals should also override hashCode.', 693 'patterns': [r".*: warning: \[EqualsHashCode\] .+"]}, 694 {'category': 'java', 695 'severity': Severity.MEDIUM, 696 'description': 697 'Java: An equality test between objects with incompatible types always returns false', 698 'patterns': [r".*: warning: \[EqualsIncompatibleType\] .+"]}, 699 {'category': 'java', 700 'severity': Severity.MEDIUM, 701 'description': 702 '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.', 703 'patterns': [r".*: warning: \[Finally\] .+"]}, 704 {'category': 'java', 705 'severity': Severity.MEDIUM, 706 'description': 707 'Java: Overloads will be ambiguous when passing lambda arguments', 708 'patterns': [r".*: warning: \[FunctionalInterfaceClash\] .+"]}, 709 {'category': 'java', 710 'severity': Severity.MEDIUM, 711 'description': 712 'Java: Calling getClass() on an enum may return a subclass of the enum type', 713 'patterns': [r".*: warning: \[GetClassOnEnum\] .+"]}, 714 {'category': 'java', 715 'severity': Severity.MEDIUM, 716 'description': 717 'Java: This annotation has incompatible modifiers as specified by its @IncompatibleModifiers annotation', 718 'patterns': [r".*: warning: \[IncompatibleModifiers\] .+"]}, 719 {'category': 'java', 720 'severity': Severity.MEDIUM, 721 'description': 722 'Java: Please also override int read(byte[], int, int), otherwise multi-byte reads from this input stream are likely to be slow.', 723 'patterns': [r".*: warning: \[InputStreamSlowMultibyteRead\] .+"]}, 724 {'category': 'java', 725 'severity': Severity.MEDIUM, 726 'description': 727 'Java: Class should not implement both `Iterable` and `Iterator`', 728 'patterns': [r".*: warning: \[IterableAndIterator\] .+"]}, 729 {'category': 'java', 730 'severity': Severity.MEDIUM, 731 'description': 732 'Java: Floating-point comparison without error tolerance', 733 'patterns': [r".*: warning: \[JUnit3FloatingPointComparisonWithoutDelta\] .+"]}, 734 {'category': 'java', 735 'severity': Severity.MEDIUM, 736 'description': 737 'Java: Test class inherits from JUnit 3\'s TestCase but has JUnit 4 @Test annotations.', 738 'patterns': [r".*: warning: \[JUnitAmbiguousTestClass\] .+"]}, 739 {'category': 'java', 740 'severity': Severity.MEDIUM, 741 'description': 742 'Java: The Google Java Style Guide requires switch statements to have an explicit default', 743 'patterns': [r".*: warning: \[MissingCasesInEnumSwitch\] .+"]}, 744 {'category': 'java', 745 'severity': Severity.MEDIUM, 746 'description': 747 'Java: Not calling fail() when expecting an exception masks bugs', 748 'patterns': [r".*: warning: \[MissingFail\] .+"]}, 749 {'category': 'java', 750 'severity': Severity.MEDIUM, 751 'description': 752 'Java: method overrides method in supertype; expected @Override', 753 'patterns': [r".*: warning: \[MissingOverride\] .+"]}, 754 {'category': 'java', 755 'severity': Severity.MEDIUM, 756 'description': 757 'Java: Compound assignments to bytes, shorts, chars, and floats hide dangerous casts', 758 'patterns': [r".*: warning: \[NarrowingCompoundAssignment\] .+"]}, 759 {'category': 'java', 760 'severity': Severity.MEDIUM, 761 'description': 762 'Java: This update of a volatile variable is non-atomic', 763 'patterns': [r".*: warning: \[NonAtomicVolatileUpdate\] .+"]}, 764 {'category': 'java', 765 'severity': Severity.MEDIUM, 766 'description': 767 'Java: Static import of member uses non-canonical name', 768 'patterns': [r".*: warning: \[NonCanonicalStaticMemberImport\] .+"]}, 769 {'category': 'java', 770 'severity': Severity.MEDIUM, 771 'description': 772 'Java: equals method doesn\'t override Object.equals', 773 'patterns': [r".*: warning: \[NonOverridingEquals\] .+"]}, 774 {'category': 'java', 775 'severity': Severity.MEDIUM, 776 'description': 777 'Java: Constructors should not be annotated with @Nullable since they cannot return null', 778 'patterns': [r".*: warning: \[NullableConstructor\] .+"]}, 779 {'category': 'java', 780 'severity': Severity.MEDIUM, 781 'description': 782 'Java: @Nullable should not be used for primitive types since they cannot be null', 783 'patterns': [r".*: warning: \[NullablePrimitive\] .+"]}, 784 {'category': 'java', 785 'severity': Severity.MEDIUM, 786 'description': 787 'Java: void-returning methods should not be annotated with @Nullable, since they cannot return null', 788 'patterns': [r".*: warning: \[NullableVoid\] .+"]}, 789 {'category': 'java', 790 'severity': Severity.MEDIUM, 791 'description': 792 'Java: Use grouping parenthesis to make the operator precedence explicit', 793 'patterns': [r".*: warning: \[OperatorPrecedence\] .+"]}, 794 {'category': 'java', 795 'severity': Severity.MEDIUM, 796 'description': 797 'Java: Preconditions only accepts the %s placeholder in error message strings', 798 'patterns': [r".*: warning: \[PreconditionsInvalidPlaceholder\] .+"]}, 799 {'category': 'java', 800 'severity': Severity.MEDIUM, 801 'description': 802 'Java: Passing a primitive array to a varargs method is usually wrong', 803 'patterns': [r".*: warning: \[PrimitiveArrayPassedToVarargsMethod\] .+"]}, 804 {'category': 'java', 805 'severity': Severity.MEDIUM, 806 'description': 807 'Java: Protobuf fields cannot be null, so this check is redundant', 808 'patterns': [r".*: warning: \[ProtoFieldPreconditionsCheckNotNull\] .+"]}, 809 {'category': 'java', 810 'severity': Severity.MEDIUM, 811 'description': 812 'Java: Thrown exception is a subtype of another', 813 'patterns': [r".*: warning: \[RedundantThrows\] .+"]}, 814 {'category': 'java', 815 'severity': Severity.MEDIUM, 816 'description': 817 'Java: Comparison using reference equality instead of value equality', 818 'patterns': [r".*: warning: \[ReferenceEquality\] .+"]}, 819 {'category': 'java', 820 'severity': Severity.MEDIUM, 821 'description': 822 'Java: This annotation is missing required modifiers as specified by its @RequiredModifiers annotation', 823 'patterns': [r".*: warning: \[RequiredModifiers\] .+"]}, 824 {'category': 'java', 825 'severity': Severity.MEDIUM, 826 'description': 827 'Java: A static variable or method should not be accessed from an object instance', 828 'patterns': [r".*: warning: \[StaticAccessedFromInstance\] .+"]}, 829 {'category': 'java', 830 'severity': Severity.MEDIUM, 831 'description': 832 'Java: String comparison using reference equality instead of value equality', 833 'patterns': [r".*: warning: \[StringEquality\] .+"]}, 834 {'category': 'java', 835 'severity': Severity.MEDIUM, 836 'description': 837 'Java: Truth Library assert is called on a constant.', 838 'patterns': [r".*: warning: \[TruthConstantAsserts\] .+"]}, 839 {'category': 'java', 840 'severity': Severity.MEDIUM, 841 'description': 842 'Java: An object is tested for equality to itself using Truth Libraries.', 843 'patterns': [r".*: warning: \[TruthSelfEquals\] .+"]}, 844 {'category': 'java', 845 'severity': Severity.MEDIUM, 846 'description': 847 '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.', 848 'patterns': [r".*: warning: \[TypeParameterUnusedInFormals\] .+"]}, 849 {'category': 'java', 850 'severity': Severity.MEDIUM, 851 'description': 852 'Java: Unsynchronized method overrides a synchronized method.', 853 'patterns': [r".*: warning: \[UnsynchronizedOverridesSynchronized\] .+"]}, 854 {'category': 'java', 855 'severity': Severity.MEDIUM, 856 'description': 857 'Java: Non-constant variable missing @Var annotation', 858 'patterns': [r".*: warning: \[Var\] .+"]}, 859 {'category': 'java', 860 'severity': Severity.MEDIUM, 861 'description': 862 'Java: Because of spurious wakeups, Object.wait() and Condition.await() must always be called in a loop', 863 'patterns': [r".*: warning: \[WaitNotInLoop\] .+"]}, 864 {'category': 'java', 865 'severity': Severity.HIGH, 866 'description': 867 'Java: Log tag too long, cannot exceed 23 characters.', 868 'patterns': [r".*: warning: \[IsLoggableTagLength\] .+"]}, 869 {'category': 'java', 870 'severity': Severity.HIGH, 871 'description': 872 'Java: Certain resources in `android.R.string` have names that do not match their content', 873 'patterns': [r".*: warning: \[MislabeledAndroidString\] .+"]}, 874 {'category': 'java', 875 'severity': Severity.HIGH, 876 'description': 877 'Java: Return value of android.graphics.Rect.intersect() must be checked', 878 'patterns': [r".*: warning: \[RectIntersectReturnValueIgnored\] .+"]}, 879 {'category': 'java', 880 'severity': Severity.HIGH, 881 'description': 882 'Java: Static and default methods in interfaces are not allowed in android builds.', 883 'patterns': [r".*: warning: \[StaticOrDefaultInterfaceMethod\] .+"]}, 884 {'category': 'java', 885 'severity': Severity.HIGH, 886 'description': 887 'Java: Incompatible type as argument to Object-accepting Java collections method', 888 'patterns': [r".*: warning: \[CollectionIncompatibleType\] .+"]}, 889 {'category': 'java', 890 'severity': Severity.HIGH, 891 'description': 892 'Java: @CompatibleWith\'s value is not a type argument.', 893 'patterns': [r".*: warning: \[CompatibleWithAnnotationMisuse\] .+"]}, 894 {'category': 'java', 895 'severity': Severity.HIGH, 896 'description': 897 'Java: Passing argument to a generic method with an incompatible type.', 898 'patterns': [r".*: warning: \[IncompatibleArgumentType\] .+"]}, 899 {'category': 'java', 900 'severity': Severity.HIGH, 901 'description': 902 'Java: Invalid printf-style format string', 903 'patterns': [r".*: warning: \[FormatString\] .+"]}, 904 {'category': 'java', 905 'severity': Severity.HIGH, 906 'description': 907 'Java: Invalid format string passed to formatting method.', 908 'patterns': [r".*: warning: \[FormatStringAnnotation\] .+"]}, 909 {'category': 'java', 910 'severity': Severity.HIGH, 911 'description': 912 'Java: @AssistedInject and @Inject cannot be used on the same constructor.', 913 'patterns': [r".*: warning: \[AssistedInjectAndInjectOnSameConstructor\] .+"]}, 914 {'category': 'java', 915 'severity': Severity.HIGH, 916 'description': 917 'Java: @AutoFactory and @Inject should not be used in the same type.', 918 'patterns': [r".*: warning: \[AutoFactoryAtInject\] .+"]}, 919 {'category': 'java', 920 'severity': Severity.HIGH, 921 'description': 922 'Java: Injected constructors cannot be optional nor have binding annotations', 923 'patterns': [r".*: warning: \[InjectedConstructorAnnotations\] .+"]}, 924 {'category': 'java', 925 'severity': Severity.HIGH, 926 'description': 927 'Java: A scoping annotation\'s Target should include TYPE and METHOD.', 928 'patterns': [r".*: warning: \[InjectInvalidTargetingOnScopingAnnotation\] .+"]}, 929 {'category': 'java', 930 'severity': Severity.HIGH, 931 'description': 932 'Java: Abstract and default methods are not injectable with javax.inject.Inject', 933 'patterns': [r".*: warning: \[JavaxInjectOnAbstractMethod\] .+"]}, 934 {'category': 'java', 935 'severity': Severity.HIGH, 936 'description': 937 'Java: @javax.inject.Inject cannot be put on a final field.', 938 'patterns': [r".*: warning: \[JavaxInjectOnFinalField\] .+"]}, 939 {'category': 'java', 940 'severity': Severity.HIGH, 941 'description': 942 'Java: This class has more than one @Inject-annotated constructor. Please remove the @Inject annotation from all but one of them.', 943 'patterns': [r".*: warning: \[MoreThanOneInjectableConstructor\] .+"]}, 944 {'category': 'java', 945 'severity': Severity.HIGH, 946 'description': 947 'Java: Using more than one qualifier annotation on the same element is not allowed.', 948 'patterns': [r".*: warning: \[InjectMoreThanOneQualifier\] .+"]}, 949 {'category': 'java', 950 'severity': Severity.HIGH, 951 'description': 952 'Java: A class can be annotated with at most one scope annotation.', 953 'patterns': [r".*: warning: \[InjectMoreThanOneScopeAnnotationOnClass\] .+"]}, 954 {'category': 'java', 955 'severity': Severity.HIGH, 956 'description': 957 'Java: Annotations cannot be both Scope annotations and Qualifier annotations: this causes confusion when trying to use them.', 958 'patterns': [r".*: warning: \[OverlappingQualifierAndScopeAnnotation\] .+"]}, 959 {'category': 'java', 960 'severity': Severity.HIGH, 961 'description': 962 'Java: Qualifier applied to a method that isn\'t a @Provides method. This method won\'t be used for dependency injection', 963 'patterns': [r".*: warning: \[QualifierOnMethodWithoutProvides\] .+"]}, 964 {'category': 'java', 965 'severity': Severity.HIGH, 966 'description': 967 'Java: Scope annotation on an interface or abstact class is not allowed', 968 'patterns': [r".*: warning: \[InjectScopeAnnotationOnInterfaceOrAbstractClass\] .+"]}, 969 {'category': 'java', 970 'severity': Severity.HIGH, 971 'description': 972 'Java: Scoping and qualifier annotations must have runtime retention.', 973 'patterns': [r".*: warning: \[InjectScopeOrQualifierAnnotationRetention\] .+"]}, 974 {'category': 'java', 975 'severity': Severity.HIGH, 976 'description': 977 'Java: `@Multibinds` is the new way to declare multibindings.', 978 'patterns': [r".*: warning: \[MultibindsInsteadOfMultibindings\] .+"]}, 979 {'category': 'java', 980 'severity': Severity.HIGH, 981 'description': 982 'Java: Dagger @Provides methods may not return null unless annotated with @Nullable', 983 'patterns': [r".*: warning: \[DaggerProvidesNull\] .+"]}, 984 {'category': 'java', 985 'severity': Severity.HIGH, 986 'description': 987 'Java: Scope annotation on implementation class of AssistedInject factory is not allowed', 988 'patterns': [r".*: warning: \[GuiceAssistedInjectScoping\] .+"]}, 989 {'category': 'java', 990 'severity': Severity.HIGH, 991 'description': 992 'Java: A constructor cannot have two @Assisted parameters of the same type unless they are disambiguated with named @Assisted annotations.', 993 'patterns': [r".*: warning: \[GuiceAssistedParameters\] .+"]}, 994 {'category': 'java', 995 'severity': Severity.HIGH, 996 'description': 997 'Java: Although Guice allows injecting final fields, doing so is disallowed because the injected value may not be visible to other threads.', 998 'patterns': [r".*: warning: \[GuiceInjectOnFinalField\] .+"]}, 999 {'category': 'java', 1000 'severity': Severity.HIGH, 1001 'description': 1002 'Java: This method is not annotated with @Inject, but it overrides a method that is annotated with @javax.inject.Inject. The method will not be Injected.', 1003 'patterns': [r".*: warning: \[OverridesJavaxInjectableMethod\] .+"]}, 1004 {'category': 'java', 1005 'severity': Severity.HIGH, 1006 'description': 1007 'Java: @Provides methods need to be declared in a Module to have any effect.', 1008 'patterns': [r".*: warning: \[ProvidesMethodOutsideOfModule\] .+"]}, 1009 {'category': 'java', 1010 'severity': Severity.HIGH, 1011 'description': 1012 'Java: Checks for unguarded accesses to fields and methods with @GuardedBy annotations', 1013 'patterns': [r".*: warning: \[GuardedByChecker\] .+"]}, 1014 {'category': 'java', 1015 'severity': Severity.HIGH, 1016 'description': 1017 'Java: Invalid @GuardedBy expression', 1018 'patterns': [r".*: warning: \[GuardedByValidator\] .+"]}, 1019 {'category': 'java', 1020 'severity': Severity.HIGH, 1021 'description': 1022 'Java: Type declaration annotated with @Immutable is not immutable', 1023 'patterns': [r".*: warning: \[Immutable\] .+"]}, 1024 {'category': 'java', 1025 'severity': Severity.HIGH, 1026 'description': 1027 'Java: This method does not acquire the locks specified by its @LockMethod annotation', 1028 'patterns': [r".*: warning: \[LockMethodChecker\] .+"]}, 1029 {'category': 'java', 1030 'severity': Severity.HIGH, 1031 'description': 1032 'Java: This method does not acquire the locks specified by its @UnlockMethod annotation', 1033 'patterns': [r".*: warning: \[UnlockMethod\] .+"]}, 1034 {'category': 'java', 1035 'severity': Severity.HIGH, 1036 'description': 1037 'Java: An argument is more similar to a different parameter; the arguments may have been swapped.', 1038 'patterns': [r".*: warning: \[ArgumentParameterSwap\] .+"]}, 1039 {'category': 'java', 1040 'severity': Severity.HIGH, 1041 'description': 1042 'Java: Reference equality used to compare arrays', 1043 'patterns': [r".*: warning: \[ArrayEquals\] .+"]}, 1044 {'category': 'java', 1045 'severity': Severity.HIGH, 1046 'description': 1047 'Java: hashcode method on array does not hash array contents', 1048 'patterns': [r".*: warning: \[ArrayHashCode\] .+"]}, 1049 {'category': 'java', 1050 'severity': Severity.HIGH, 1051 'description': 1052 'Java: Calling toString on an array does not provide useful information', 1053 'patterns': [r".*: warning: \[ArrayToString\] .+"]}, 1054 {'category': 'java', 1055 'severity': Severity.HIGH, 1056 'description': 1057 'Java: Arrays.asList does not autobox primitive arrays, as one might expect.', 1058 'patterns': [r".*: warning: \[ArraysAsListPrimitiveArray\] .+"]}, 1059 {'category': 'java', 1060 'severity': Severity.HIGH, 1061 'description': 1062 'Java: AsyncCallable should not return a null Future, only a Future whose result is null.', 1063 'patterns': [r".*: warning: \[AsyncCallableReturnsNull\] .+"]}, 1064 {'category': 'java', 1065 'severity': Severity.HIGH, 1066 'description': 1067 'Java: AsyncFunction should not return a null Future, only a Future whose result is null.', 1068 'patterns': [r".*: warning: \[AsyncFunctionReturnsNull\] .+"]}, 1069 {'category': 'java', 1070 'severity': Severity.HIGH, 1071 'description': 1072 'Java: Shift by an amount that is out of range', 1073 'patterns': [r".*: warning: \[BadShiftAmount\] .+"]}, 1074 {'category': 'java', 1075 'severity': Severity.HIGH, 1076 'description': 1077 '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.', 1078 'patterns': [r".*: warning: \[ChainingConstructorIgnoresParameter\] .+"]}, 1079 {'category': 'java', 1080 'severity': Severity.HIGH, 1081 'description': 1082 'Java: Ignored return value of method that is annotated with @CheckReturnValue', 1083 'patterns': [r".*: warning: \[CheckReturnValue\] .+"]}, 1084 {'category': 'java', 1085 'severity': Severity.HIGH, 1086 'description': 1087 'Java: The source file name should match the name of the top-level class it contains', 1088 'patterns': [r".*: warning: \[ClassName\] .+"]}, 1089 {'category': 'java', 1090 'severity': Severity.HIGH, 1091 'description': 1092 'Java: This comparison method violates the contract', 1093 'patterns': [r".*: warning: \[ComparisonContractViolated\] .+"]}, 1094 {'category': 'java', 1095 'severity': Severity.HIGH, 1096 'description': 1097 'Java: Comparison to value that is out of range for the compared type', 1098 'patterns': [r".*: warning: \[ComparisonOutOfRange\] .+"]}, 1099 {'category': 'java', 1100 'severity': Severity.HIGH, 1101 'description': 1102 'Java: Non-compile-time constant expression passed to parameter with @CompileTimeConstant type annotation.', 1103 'patterns': [r".*: warning: \[CompileTimeConstant\] .+"]}, 1104 {'category': 'java', 1105 'severity': Severity.HIGH, 1106 'description': 1107 'Java: Compile-time constant expression overflows', 1108 'patterns': [r".*: warning: \[ConstantOverflow\] .+"]}, 1109 {'category': 'java', 1110 'severity': Severity.HIGH, 1111 'description': 1112 'Java: Exception created but not thrown', 1113 'patterns': [r".*: warning: \[DeadException\] .+"]}, 1114 {'category': 'java', 1115 'severity': Severity.HIGH, 1116 'description': 1117 'Java: Division by integer literal zero', 1118 'patterns': [r".*: warning: \[DivZero\] .+"]}, 1119 {'category': 'java', 1120 'severity': Severity.HIGH, 1121 'description': 1122 'Java: Empty statement after if', 1123 'patterns': [r".*: warning: \[EmptyIf\] .+"]}, 1124 {'category': 'java', 1125 'severity': Severity.HIGH, 1126 'description': 1127 'Java: == NaN always returns false; use the isNaN methods instead', 1128 'patterns': [r".*: warning: \[EqualsNaN\] .+"]}, 1129 {'category': 'java', 1130 'severity': Severity.HIGH, 1131 'description': 1132 'Java: Method annotated @ForOverride must be protected or package-private and only invoked from declaring class', 1133 'patterns': [r".*: warning: \[ForOverride\] .+"]}, 1134 {'category': 'java', 1135 'severity': Severity.HIGH, 1136 'description': 1137 'Java: Casting a lambda to this @FunctionalInterface can cause a behavior change from casting to a functional superinterface, which is surprising to users. Prefer decorator methods to this surprising behavior.', 1138 'patterns': [r".*: warning: \[FunctionalInterfaceMethodChanged\] .+"]}, 1139 {'category': 'java', 1140 'severity': Severity.HIGH, 1141 'description': 1142 'Java: Futures.getChecked requires a checked exception type with a standard constructor.', 1143 'patterns': [r".*: warning: \[FuturesGetCheckedIllegalExceptionType\] .+"]}, 1144 {'category': 'java', 1145 'severity': Severity.HIGH, 1146 'description': 1147 'Java: Calling getClass() on an annotation may return a proxy class', 1148 'patterns': [r".*: warning: \[GetClassOnAnnotation\] .+"]}, 1149 {'category': 'java', 1150 'severity': Severity.HIGH, 1151 'description': 1152 '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', 1153 'patterns': [r".*: warning: \[GetClassOnClass\] .+"]}, 1154 {'category': 'java', 1155 'severity': Severity.HIGH, 1156 'description': 1157 'Java: An object is tested for equality to itself using Guava Libraries', 1158 'patterns': [r".*: warning: \[GuavaSelfEquals\] .+"]}, 1159 {'category': 'java', 1160 'severity': Severity.HIGH, 1161 'description': 1162 'Java: contains() is a legacy method that is equivalent to containsValue()', 1163 'patterns': [r".*: warning: \[HashtableContains\] .+"]}, 1164 {'category': 'java', 1165 'severity': Severity.HIGH, 1166 'description': 1167 'Java: Writing "a && a", "a || a", "a & a", or "a | a" is equivalent to "a".', 1168 'patterns': [r".*: warning: \[IdentityBinaryExpression\] .+"]}, 1169 {'category': 'java', 1170 'severity': Severity.HIGH, 1171 'description': 1172 'Java: Modifying an immutable collection is guaranteed to throw an exception and leave the collection unmodified', 1173 'patterns': [r".*: warning: \[ImmutableModification\] .+"]}, 1174 {'category': 'java', 1175 'severity': Severity.HIGH, 1176 'description': 1177 'Java: This method always recurses, and will cause a StackOverflowError', 1178 'patterns': [r".*: warning: \[InfiniteRecursion\] .+"]}, 1179 {'category': 'java', 1180 'severity': Severity.HIGH, 1181 'description': 1182 'Java: A standard cryptographic operation is used in a mode that is prone to vulnerabilities', 1183 'patterns': [r".*: warning: \[InsecureCryptoUsage\] .+"]}, 1184 {'category': 'java', 1185 'severity': Severity.HIGH, 1186 'description': 1187 'Java: Invalid syntax used for a regular expression', 1188 'patterns': [r".*: warning: \[InvalidPatternSyntax\] .+"]}, 1189 {'category': 'java', 1190 'severity': Severity.HIGH, 1191 'description': 1192 'Java: The argument to Class#isInstance(Object) should not be a Class', 1193 'patterns': [r".*: warning: \[IsInstanceOfClass\] .+"]}, 1194 {'category': 'java', 1195 'severity': Severity.HIGH, 1196 'description': 1197 'Java: jMock tests must have a @RunWith(JMock.class) annotation, or the Mockery field must have a @Rule JUnit annotation', 1198 'patterns': [r".*: warning: \[JMockTestWithoutRunWithOrRuleAnnotation\] .+"]}, 1199 {'category': 'java', 1200 'severity': Severity.HIGH, 1201 'description': 1202 'Java: Test method will not be run; please prefix name with "test"', 1203 'patterns': [r".*: warning: \[JUnit3TestNotRun\] .+"]}, 1204 {'category': 'java', 1205 'severity': Severity.HIGH, 1206 'description': 1207 'Java: setUp() method will not be run; Please add a @Before annotation', 1208 'patterns': [r".*: warning: \[JUnit4SetUpNotRun\] .+"]}, 1209 {'category': 'java', 1210 'severity': Severity.HIGH, 1211 'description': 1212 'Java: tearDown() method will not be run; Please add an @After annotation', 1213 'patterns': [r".*: warning: \[JUnit4TearDownNotRun\] .+"]}, 1214 {'category': 'java', 1215 'severity': Severity.HIGH, 1216 'description': 1217 'Java: Test method will not be run; please add @Test annotation', 1218 'patterns': [r".*: warning: \[JUnit4TestNotRun\] .+"]}, 1219 {'category': 'java', 1220 'severity': Severity.HIGH, 1221 'description': 1222 'Java: Use of "YYYY" (week year) in a date pattern without "ww" (week in year). You probably meant to use "yyyy" (year) instead.', 1223 'patterns': [r".*: warning: \[MisusedWeekYear\] .+"]}, 1224 {'category': 'java', 1225 'severity': Severity.HIGH, 1226 'description': 1227 'Java: A bug in Mockito will cause this test to fail at runtime with a ClassCastException', 1228 'patterns': [r".*: warning: \[MockitoCast\] .+"]}, 1229 {'category': 'java', 1230 'severity': Severity.HIGH, 1231 'description': 1232 'Java: Missing method call for verify(mock) here', 1233 'patterns': [r".*: warning: \[MockitoUsage\] .+"]}, 1234 {'category': 'java', 1235 'severity': Severity.HIGH, 1236 'description': 1237 'Java: Using a collection function with itself as the argument.', 1238 'patterns': [r".*: warning: \[ModifyingCollectionWithItself\] .+"]}, 1239 {'category': 'java', 1240 'severity': Severity.HIGH, 1241 'description': 1242 'Java: @NoAllocation was specified on this method, but something was found that would trigger an allocation', 1243 'patterns': [r".*: warning: \[NoAllocation\] .+"]}, 1244 {'category': 'java', 1245 'severity': Severity.HIGH, 1246 'description': 1247 'Java: Static import of type uses non-canonical name', 1248 'patterns': [r".*: warning: \[NonCanonicalStaticImport\] .+"]}, 1249 {'category': 'java', 1250 'severity': Severity.HIGH, 1251 'description': 1252 'Java: @CompileTimeConstant parameters should be final or effectively final', 1253 'patterns': [r".*: warning: \[NonFinalCompileTimeConstant\] .+"]}, 1254 {'category': 'java', 1255 'severity': Severity.HIGH, 1256 'description': 1257 'Java: Calling getAnnotation on an annotation that is not retained at runtime.', 1258 'patterns': [r".*: warning: \[NonRuntimeAnnotation\] .+"]}, 1259 {'category': 'java', 1260 'severity': Severity.HIGH, 1261 'description': 1262 'Java: Numeric comparison using reference equality instead of value equality', 1263 'patterns': [r".*: warning: \[NumericEquality\] .+"]}, 1264 {'category': 'java', 1265 'severity': Severity.HIGH, 1266 'description': 1267 'Java: Comparison using reference equality instead of value equality', 1268 'patterns': [r".*: warning: \[OptionalEquality\] .+"]}, 1269 {'category': 'java', 1270 'severity': Severity.HIGH, 1271 'description': 1272 'Java: Varargs doesn\'t agree for overridden method', 1273 'patterns': [r".*: warning: \[Overrides\] .+"]}, 1274 {'category': 'java', 1275 'severity': Severity.HIGH, 1276 'description': 1277 'Java: Declaring types inside package-info.java files is very bad form', 1278 'patterns': [r".*: warning: \[PackageInfo\] .+"]}, 1279 {'category': 'java', 1280 'severity': Severity.HIGH, 1281 'description': 1282 'Java: Literal passed as first argument to Preconditions.checkNotNull() can never be null', 1283 'patterns': [r".*: warning: \[PreconditionsCheckNotNull\] .+"]}, 1284 {'category': 'java', 1285 'severity': Severity.HIGH, 1286 'description': 1287 'Java: First argument to `Preconditions.checkNotNull()` is a primitive rather than an object reference', 1288 'patterns': [r".*: warning: \[PreconditionsCheckNotNullPrimitive\] .+"]}, 1289 {'category': 'java', 1290 'severity': Severity.HIGH, 1291 'description': 1292 'Java: Protobuf fields cannot be null', 1293 'patterns': [r".*: warning: \[ProtoFieldNullComparison\] .+"]}, 1294 {'category': 'java', 1295 'severity': Severity.HIGH, 1296 'description': 1297 'Java: Comparing protobuf fields of type String using reference equality', 1298 'patterns': [r".*: warning: \[ProtoStringFieldReferenceEquality\] .+"]}, 1299 {'category': 'java', 1300 'severity': Severity.HIGH, 1301 'description': 1302 'Java: Use Random.nextInt(int). Random.nextInt() % n can have negative results', 1303 'patterns': [r".*: warning: \[RandomModInteger\] .+"]}, 1304 {'category': 'java', 1305 'severity': Severity.HIGH, 1306 'description': 1307 'Java: Check for non-whitelisted callers to RestrictedApiChecker.', 1308 'patterns': [r".*: warning: \[RestrictedApiChecker\] .+"]}, 1309 {'category': 'java', 1310 'severity': Severity.HIGH, 1311 'description': 1312 'Java: Return value of this method must be used', 1313 'patterns': [r".*: warning: \[ReturnValueIgnored\] .+"]}, 1314 {'category': 'java', 1315 'severity': Severity.HIGH, 1316 'description': 1317 'Java: Variable assigned to itself', 1318 'patterns': [r".*: warning: \[SelfAssignment\] .+"]}, 1319 {'category': 'java', 1320 'severity': Severity.HIGH, 1321 'description': 1322 'Java: An object is compared to itself', 1323 'patterns': [r".*: warning: \[SelfComparison\] .+"]}, 1324 {'category': 'java', 1325 'severity': Severity.HIGH, 1326 'description': 1327 'Java: Variable compared to itself', 1328 'patterns': [r".*: warning: \[SelfEquality\] .+"]}, 1329 {'category': 'java', 1330 'severity': Severity.HIGH, 1331 'description': 1332 'Java: An object is tested for equality to itself', 1333 'patterns': [r".*: warning: \[SelfEquals\] .+"]}, 1334 {'category': 'java', 1335 'severity': Severity.HIGH, 1336 'description': 1337 'Java: Comparison of a size >= 0 is always true, did you intend to check for non-emptiness?', 1338 'patterns': [r".*: warning: \[SizeGreaterThanOrEqualsZero\] .+"]}, 1339 {'category': 'java', 1340 'severity': Severity.HIGH, 1341 'description': 1342 'Java: Calling toString on a Stream does not provide useful information', 1343 'patterns': [r".*: warning: \[StreamToString\] .+"]}, 1344 {'category': 'java', 1345 'severity': Severity.HIGH, 1346 'description': 1347 'Java: StringBuilder does not have a char constructor; this invokes the int constructor.', 1348 'patterns': [r".*: warning: \[StringBuilderInitWithChar\] .+"]}, 1349 {'category': 'java', 1350 'severity': Severity.HIGH, 1351 'description': 1352 'Java: Suppressing "deprecated" is probably a typo for "deprecation"', 1353 'patterns': [r".*: warning: \[SuppressWarningsDeprecated\] .+"]}, 1354 {'category': 'java', 1355 'severity': Severity.HIGH, 1356 'description': 1357 'Java: throwIfUnchecked(knownCheckedException) is a no-op.', 1358 'patterns': [r".*: warning: \[ThrowIfUncheckedKnownChecked\] .+"]}, 1359 {'category': 'java', 1360 'severity': Severity.HIGH, 1361 'description': 1362 'Java: Catching Throwable/Error masks failures from fail() or assert*() in the try block', 1363 'patterns': [r".*: warning: \[TryFailThrowable\] .+"]}, 1364 {'category': 'java', 1365 'severity': Severity.HIGH, 1366 'description': 1367 'Java: Type parameter used as type qualifier', 1368 'patterns': [r".*: warning: \[TypeParameterQualifier\] .+"]}, 1369 {'category': 'java', 1370 'severity': Severity.HIGH, 1371 'description': 1372 'Java: Non-generic methods should not be invoked with type arguments', 1373 'patterns': [r".*: warning: \[UnnecessaryTypeArgument\] .+"]}, 1374 {'category': 'java', 1375 'severity': Severity.HIGH, 1376 'description': 1377 'Java: Instance created but never used', 1378 'patterns': [r".*: warning: \[UnusedAnonymousClass\] .+"]}, 1379 {'category': 'java', 1380 'severity': Severity.HIGH, 1381 'description': 1382 'Java: Collection is modified in place, but the result is not used', 1383 'patterns': [r".*: warning: \[UnusedCollectionModifiedInPlace\] .+"]}, 1384 {'category': 'java', 1385 'severity': Severity.HIGH, 1386 'description': 1387 'Java: Method parameter has wrong package', 1388 'patterns': [r".*: warning: \[ParameterPackage\] .+"]}, 1389 1390 # End warnings generated by Error Prone 1391 1392 {'category': 'java', 1393 'severity': Severity.UNKNOWN, 1394 'description': 'Java: Unclassified/unrecognized warnings', 1395 'patterns': [r".*: warning: \[.+\] .+"]}, 1396 1397 {'category': 'aapt', 'severity': Severity.MEDIUM, 1398 'description': 'aapt: No default translation', 1399 'patterns': [r".*: warning: string '.+' has no default translation in .*"]}, 1400 {'category': 'aapt', 'severity': Severity.MEDIUM, 1401 'description': 'aapt: Missing default or required localization', 1402 'patterns': [r".*: warning: \*\*\*\* string '.+' has no default or required localization for '.+' in .+"]}, 1403 {'category': 'aapt', 'severity': Severity.MEDIUM, 1404 'description': 'aapt: String marked untranslatable, but translation exists', 1405 'patterns': [r".*: warning: string '.+' in .* marked untranslatable but exists in locale '??_??'"]}, 1406 {'category': 'aapt', 'severity': Severity.MEDIUM, 1407 'description': 'aapt: empty span in string', 1408 'patterns': [r".*: warning: empty '.+' span found in text '.+"]}, 1409 {'category': 'C/C++', 'severity': Severity.MEDIUM, 1410 'description': 'Taking address of temporary', 1411 'patterns': [r".*: warning: taking address of temporary"]}, 1412 {'category': 'C/C++', 'severity': Severity.MEDIUM, 1413 'description': 'Taking address of packed member', 1414 'patterns': [r".*: warning: taking address of packed member"]}, 1415 {'category': 'C/C++', 'severity': Severity.MEDIUM, 1416 'description': 'Possible broken line continuation', 1417 'patterns': [r".*: warning: backslash and newline separated by space"]}, 1418 {'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': '-Wundefined-var-template', 1419 'description': 'Undefined variable template', 1420 'patterns': [r".*: warning: instantiation of variable .* no definition is available"]}, 1421 {'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': '-Wundefined-inline', 1422 'description': 'Inline function is not defined', 1423 'patterns': [r".*: warning: inline function '.*' is not defined"]}, 1424 {'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': '-Warray-bounds', 1425 'description': 'Array subscript out of bounds', 1426 'patterns': [r".*: warning: array subscript is above array bounds", 1427 r".*: warning: Array subscript is undefined", 1428 r".*: warning: array subscript is below array bounds"]}, 1429 {'category': 'C/C++', 'severity': Severity.MEDIUM, 1430 'description': 'Excess elements in initializer', 1431 'patterns': [r".*: warning: excess elements in .+ initializer"]}, 1432 {'category': 'C/C++', 'severity': Severity.MEDIUM, 1433 'description': 'Decimal constant is unsigned only in ISO C90', 1434 'patterns': [r".*: warning: this decimal constant is unsigned only in ISO C90"]}, 1435 {'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': '-Wmain', 1436 'description': 'main is usually a function', 1437 'patterns': [r".*: warning: 'main' is usually a function"]}, 1438 {'category': 'C/C++', 'severity': Severity.MEDIUM, 1439 'description': 'Typedef ignored', 1440 'patterns': [r".*: warning: 'typedef' was ignored in this declaration"]}, 1441 {'category': 'C/C++', 'severity': Severity.HIGH, 'option': '-Waddress', 1442 'description': 'Address always evaluates to true', 1443 'patterns': [r".*: warning: the address of '.+' will always evaluate as 'true'"]}, 1444 {'category': 'C/C++', 'severity': Severity.FIXMENOW, 1445 'description': 'Freeing a non-heap object', 1446 'patterns': [r".*: warning: attempt to free a non-heap object '.+'"]}, 1447 {'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': '-Wchar-subscripts', 1448 'description': 'Array subscript has type char', 1449 'patterns': [r".*: warning: array subscript .+ type 'char'.+Wchar-subscripts"]}, 1450 {'category': 'C/C++', 'severity': Severity.MEDIUM, 1451 'description': 'Constant too large for type', 1452 'patterns': [r".*: warning: integer constant is too large for '.+' type"]}, 1453 {'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': '-Woverflow', 1454 'description': 'Constant too large for type, truncated', 1455 'patterns': [r".*: warning: large integer implicitly truncated to unsigned type"]}, 1456 {'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': '-Winteger-overflow', 1457 'description': 'Overflow in expression', 1458 'patterns': [r".*: warning: overflow in expression; .*Winteger-overflow"]}, 1459 {'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': '-Woverflow', 1460 'description': 'Overflow in implicit constant conversion', 1461 'patterns': [r".*: warning: overflow in implicit constant conversion"]}, 1462 {'category': 'C/C++', 'severity': Severity.MEDIUM, 1463 'description': 'Declaration does not declare anything', 1464 'patterns': [r".*: warning: declaration 'class .+' does not declare anything"]}, 1465 {'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': '-Wreorder', 1466 'description': 'Initialization order will be different', 1467 'patterns': [r".*: warning: '.+' will be initialized after", 1468 r".*: warning: field .+ will be initialized after .+Wreorder"]}, 1469 {'category': 'cont.', 'severity': Severity.SKIP, 1470 'description': 'skip, ....', 1471 'patterns': [r".*: warning: '.+'"]}, 1472 {'category': 'cont.', 'severity': Severity.SKIP, 1473 'description': 'skip, base ...', 1474 'patterns': [r".*: warning: base '.+'"]}, 1475 {'category': 'cont.', 'severity': Severity.SKIP, 1476 'description': 'skip, when initialized here', 1477 'patterns': [r".*: warning: when initialized here"]}, 1478 {'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': '-Wmissing-parameter-type', 1479 'description': 'Parameter type not specified', 1480 'patterns': [r".*: warning: type of '.+' defaults to 'int'"]}, 1481 {'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': '-Wmissing-declarations', 1482 'description': 'Missing declarations', 1483 'patterns': [r".*: warning: declaration does not declare anything"]}, 1484 {'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': '-Wmissing-noreturn', 1485 'description': 'Missing noreturn', 1486 'patterns': [r".*: warning: function '.*' could be declared with attribute 'noreturn'"]}, 1487 # pylint:disable=anomalous-backslash-in-string 1488 # TODO(chh): fix the backslash pylint warning. 1489 {'category': 'gcc', 'severity': Severity.MEDIUM, 1490 'description': 'Invalid option for C file', 1491 'patterns': [r".*: warning: command line option "".+"" is valid for C\+\+\/ObjC\+\+ but not for C"]}, 1492 {'category': 'C/C++', 'severity': Severity.MEDIUM, 1493 'description': 'User warning', 1494 'patterns': [r".*: warning: #warning "".+"""]}, 1495 {'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': '-Wvexing-parse', 1496 'description': 'Vexing parsing problem', 1497 'patterns': [r".*: warning: empty parentheses interpreted as a function declaration"]}, 1498 {'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': '-Wextra', 1499 'description': 'Dereferencing void*', 1500 'patterns': [r".*: warning: dereferencing 'void \*' pointer"]}, 1501 {'category': 'C/C++', 'severity': Severity.MEDIUM, 1502 'description': 'Comparison of pointer and integer', 1503 'patterns': [r".*: warning: ordered comparison of pointer with integer zero", 1504 r".*: warning: .*comparison between pointer and integer"]}, 1505 {'category': 'C/C++', 'severity': Severity.MEDIUM, 1506 'description': 'Use of error-prone unary operator', 1507 'patterns': [r".*: warning: use of unary operator that may be intended as compound assignment"]}, 1508 {'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': '-Wwrite-strings', 1509 'description': 'Conversion of string constant to non-const char*', 1510 'patterns': [r".*: warning: deprecated conversion from string constant to '.+'"]}, 1511 {'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': '-Wstrict-prototypes', 1512 'description': 'Function declaration isn''t a prototype', 1513 'patterns': [r".*: warning: function declaration isn't a prototype"]}, 1514 {'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': '-Wignored-qualifiers', 1515 'description': 'Type qualifiers ignored on function return value', 1516 'patterns': [r".*: warning: type qualifiers ignored on function return type", 1517 r".*: warning: .+ type qualifier .+ has no effect .+Wignored-qualifiers"]}, 1518 {'category': 'C/C++', 'severity': Severity.MEDIUM, 1519 'description': '<foo> declared inside parameter list, scope limited to this definition', 1520 'patterns': [r".*: warning: '.+' declared inside parameter list"]}, 1521 {'category': 'cont.', 'severity': Severity.SKIP, 1522 'description': 'skip, its scope is only this ...', 1523 'patterns': [r".*: warning: its scope is only this definition or declaration, which is probably not what you want"]}, 1524 {'category': 'C/C++', 'severity': Severity.LOW, 'option': '-Wcomment', 1525 'description': 'Line continuation inside comment', 1526 'patterns': [r".*: warning: multi-line comment"]}, 1527 {'category': 'C/C++', 'severity': Severity.LOW, 'option': '-Wcomment', 1528 'description': 'Comment inside comment', 1529 'patterns': [r".*: warning: "".+"" within comment"]}, 1530 # Warning "value stored is never read" could be from clang-tidy or clang static analyzer. 1531 {'category': 'C/C++', 'severity': Severity.ANALYZER, 1532 'description': 'clang-analyzer Value stored is never read', 1533 'patterns': [r".*: warning: Value stored to .+ is never read.*clang-analyzer-deadcode.DeadStores"]}, 1534 {'category': 'C/C++', 'severity': Severity.LOW, 1535 'description': 'Value stored is never read', 1536 'patterns': [r".*: warning: Value stored to .+ is never read"]}, 1537 {'category': 'C/C++', 'severity': Severity.LOW, 'option': '-Wdeprecated-declarations', 1538 'description': 'Deprecated declarations', 1539 'patterns': [r".*: warning: .+ is deprecated.+deprecated-declarations"]}, 1540 {'category': 'C/C++', 'severity': Severity.LOW, 'option': '-Wdeprecated-register', 1541 'description': 'Deprecated register', 1542 'patterns': [r".*: warning: 'register' storage class specifier is deprecated"]}, 1543 {'category': 'C/C++', 'severity': Severity.LOW, 'option': '-Wpointer-sign', 1544 'description': 'Converts between pointers to integer types with different sign', 1545 'patterns': [r".*: warning: .+ converts between pointers to integer types with different sign"]}, 1546 {'category': 'C/C++', 'severity': Severity.HARMLESS, 1547 'description': 'Extra tokens after #endif', 1548 'patterns': [r".*: warning: extra tokens at end of #endif directive"]}, 1549 {'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': '-Wenum-compare', 1550 'description': 'Comparison between different enums', 1551 'patterns': [r".*: warning: comparison between '.+' and '.+'.+Wenum-compare"]}, 1552 {'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': '-Wconversion', 1553 'description': 'Conversion may change value', 1554 'patterns': [r".*: warning: converting negative value '.+' to '.+'", 1555 r".*: warning: conversion to '.+' .+ may (alter|change)"]}, 1556 {'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': '-Wconversion-null', 1557 'description': 'Converting to non-pointer type from NULL', 1558 'patterns': [r".*: warning: converting to non-pointer type '.+' from NULL"]}, 1559 {'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': '-Wsign-conversion', 1560 'description': 'Implicit sign conversion', 1561 'patterns': [r".*: warning: implicit conversion changes signedness"]}, 1562 {'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': '-Wnull-conversion', 1563 'description': 'Converting NULL to non-pointer type', 1564 'patterns': [r".*: warning: implicit conversion of NULL constant to '.+'"]}, 1565 {'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': '-Wnon-literal-null-conversion', 1566 'description': 'Zero used as null pointer', 1567 'patterns': [r".*: warning: expression .* zero treated as a null pointer constant"]}, 1568 {'category': 'C/C++', 'severity': Severity.MEDIUM, 1569 'description': 'Implicit conversion changes value', 1570 'patterns': [r".*: warning: implicit conversion .* changes value from .* to .*-conversion"]}, 1571 {'category': 'C/C++', 'severity': Severity.MEDIUM, 1572 'description': 'Passing NULL as non-pointer argument', 1573 'patterns': [r".*: warning: passing NULL to non-pointer argument [0-9]+ of '.+'"]}, 1574 {'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': '-Wctor-dtor-privacy', 1575 'description': 'Class seems unusable because of private ctor/dtor', 1576 'patterns': [r".*: warning: all member functions in class '.+' are private"]}, 1577 # skip this next one, because it only points out some RefBase-based classes where having a private destructor is perfectly fine 1578 {'category': 'C/C++', 'severity': Severity.SKIP, 'option': '-Wctor-dtor-privacy', 1579 'description': 'Class seems unusable because of private ctor/dtor', 1580 'patterns': [r".*: warning: 'class .+' only defines a private destructor and has no friends"]}, 1581 {'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': '-Wctor-dtor-privacy', 1582 'description': 'Class seems unusable because of private ctor/dtor', 1583 'patterns': [r".*: warning: 'class .+' only defines private constructors and has no friends"]}, 1584 {'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': '-Wgnu-static-float-init', 1585 'description': 'In-class initializer for static const float/double', 1586 'patterns': [r".*: warning: in-class initializer for static data member of .+const (float|double)"]}, 1587 {'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': '-Wpointer-arith', 1588 'description': 'void* used in arithmetic', 1589 'patterns': [r".*: warning: pointer of type 'void \*' used in (arithmetic|subtraction)", 1590 r".*: warning: arithmetic on .+ to void is a GNU extension.*Wpointer-arith", 1591 r".*: warning: wrong type argument to increment"]}, 1592 {'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': '-Wsign-promo', 1593 'description': 'Overload resolution chose to promote from unsigned or enum to signed type', 1594 'patterns': [r".*: warning: passing '.+' chooses '.+' over '.+'.*Wsign-promo"]}, 1595 {'category': 'cont.', 'severity': Severity.SKIP, 1596 'description': 'skip, in call to ...', 1597 'patterns': [r".*: warning: in call to '.+'"]}, 1598 {'category': 'C/C++', 'severity': Severity.HIGH, 'option': '-Wextra', 1599 'description': 'Base should be explicitly initialized in copy constructor', 1600 'patterns': [r".*: warning: base class '.+' should be explicitly initialized in the copy constructor"]}, 1601 {'category': 'C/C++', 'severity': Severity.MEDIUM, 1602 'description': 'VLA has zero or negative size', 1603 'patterns': [r".*: warning: Declared variable-length array \(VLA\) has .+ size"]}, 1604 {'category': 'C/C++', 'severity': Severity.MEDIUM, 1605 'description': 'Return value from void function', 1606 'patterns': [r".*: warning: 'return' with a value, in function returning void"]}, 1607 {'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': 'multichar', 1608 'description': 'Multi-character character constant', 1609 'patterns': [r".*: warning: multi-character character constant"]}, 1610 {'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': 'writable-strings', 1611 'description': 'Conversion from string literal to char*', 1612 'patterns': [r".*: warning: .+ does not allow conversion from string literal to 'char \*'"]}, 1613 {'category': 'C/C++', 'severity': Severity.LOW, 'option': '-Wextra-semi', 1614 'description': 'Extra \';\'', 1615 'patterns': [r".*: warning: extra ';' .+extra-semi"]}, 1616 {'category': 'C/C++', 'severity': Severity.LOW, 1617 'description': 'Useless specifier', 1618 'patterns': [r".*: warning: useless storage class specifier in empty declaration"]}, 1619 {'category': 'C/C++', 'severity': Severity.LOW, 'option': '-Wduplicate-decl-specifier', 1620 'description': 'Duplicate declaration specifier', 1621 'patterns': [r".*: warning: duplicate '.+' declaration specifier"]}, 1622 {'category': 'logtags', 'severity': Severity.LOW, 1623 'description': 'Duplicate logtag', 1624 'patterns': [r".*: warning: tag \".+\" \(.+\) duplicated in .+"]}, 1625 {'category': 'logtags', 'severity': Severity.LOW, 'option': 'typedef-redefinition', 1626 'description': 'Typedef redefinition', 1627 'patterns': [r".*: warning: redefinition of typedef '.+' is a C11 feature"]}, 1628 {'category': 'logtags', 'severity': Severity.LOW, 'option': 'gnu-designator', 1629 'description': 'GNU old-style field designator', 1630 'patterns': [r".*: warning: use of GNU old-style field designator extension"]}, 1631 {'category': 'logtags', 'severity': Severity.LOW, 'option': 'missing-field-initializers', 1632 'description': 'Missing field initializers', 1633 'patterns': [r".*: warning: missing field '.+' initializer"]}, 1634 {'category': 'logtags', 'severity': Severity.LOW, 'option': 'missing-braces', 1635 'description': 'Missing braces', 1636 'patterns': [r".*: warning: suggest braces around initialization of", 1637 r".*: warning: too many braces around scalar initializer .+Wmany-braces-around-scalar-init", 1638 r".*: warning: braces around scalar initializer"]}, 1639 {'category': 'logtags', 'severity': Severity.LOW, 'option': 'sign-compare', 1640 'description': 'Comparison of integers of different signs', 1641 'patterns': [r".*: warning: comparison of integers of different signs.+sign-compare"]}, 1642 {'category': 'logtags', 'severity': Severity.LOW, 'option': 'dangling-else', 1643 'description': 'Add braces to avoid dangling else', 1644 'patterns': [r".*: warning: add explicit braces to avoid dangling else"]}, 1645 {'category': 'logtags', 'severity': Severity.LOW, 'option': 'initializer-overrides', 1646 'description': 'Initializer overrides prior initialization', 1647 'patterns': [r".*: warning: initializer overrides prior initialization of this subobject"]}, 1648 {'category': 'logtags', 'severity': Severity.LOW, 'option': 'self-assign', 1649 'description': 'Assigning value to self', 1650 'patterns': [r".*: warning: explicitly assigning value of .+ to itself"]}, 1651 {'category': 'logtags', 'severity': Severity.LOW, 'option': 'gnu-variable-sized-type-not-at-end', 1652 'description': 'GNU extension, variable sized type not at end', 1653 'patterns': [r".*: warning: field '.+' with variable sized type '.+' not at the end of a struct or class"]}, 1654 {'category': 'logtags', 'severity': Severity.LOW, 'option': 'tautological-constant-out-of-range-compare', 1655 'description': 'Comparison of constant is always false/true', 1656 'patterns': [r".*: comparison of .+ is always .+Wtautological-constant-out-of-range-compare"]}, 1657 {'category': 'logtags', 'severity': Severity.LOW, 'option': 'overloaded-virtual', 1658 'description': 'Hides overloaded virtual function', 1659 'patterns': [r".*: '.+' hides overloaded virtual function"]}, 1660 {'category': 'logtags', 'severity': Severity.LOW, 'option': 'incompatible-pointer-types', 1661 'description': 'Incompatible pointer types', 1662 'patterns': [r".*: warning: incompatible pointer types .+Wincompatible-pointer-types"]}, 1663 {'category': 'logtags', 'severity': Severity.LOW, 'option': 'asm-operand-widths', 1664 'description': 'ASM value size does not match register size', 1665 'patterns': [r".*: warning: value size does not match register size specified by the constraint and modifier"]}, 1666 {'category': 'C/C++', 'severity': Severity.LOW, 'option': 'tautological-compare', 1667 'description': 'Comparison of self is always false', 1668 'patterns': [r".*: self-comparison always evaluates to false"]}, 1669 {'category': 'C/C++', 'severity': Severity.LOW, 'option': 'constant-logical-operand', 1670 'description': 'Logical op with constant operand', 1671 'patterns': [r".*: use of logical '.+' with constant operand"]}, 1672 {'category': 'C/C++', 'severity': Severity.LOW, 'option': 'literal-suffix', 1673 'description': 'Needs a space between literal and string macro', 1674 'patterns': [r".*: warning: invalid suffix on literal.+ requires a space .+Wliteral-suffix"]}, 1675 {'category': 'C/C++', 'severity': Severity.LOW, 'option': '#warnings', 1676 'description': 'Warnings from #warning', 1677 'patterns': [r".*: warning: .+-W#warnings"]}, 1678 {'category': 'C/C++', 'severity': Severity.LOW, 'option': 'absolute-value', 1679 'description': 'Using float/int absolute value function with int/float argument', 1680 'patterns': [r".*: warning: using .+ absolute value function .+ when argument is .+ type .+Wabsolute-value", 1681 r".*: warning: absolute value function '.+' given .+ which may cause truncation .+Wabsolute-value"]}, 1682 {'category': 'C/C++', 'severity': Severity.LOW, 'option': '-Wc++11-extensions', 1683 'description': 'Using C++11 extensions', 1684 'patterns': [r".*: warning: 'auto' type specifier is a C\+\+11 extension"]}, 1685 {'category': 'C/C++', 'severity': Severity.LOW, 1686 'description': 'Refers to implicitly defined namespace', 1687 'patterns': [r".*: warning: using directive refers to implicitly-defined namespace .+"]}, 1688 {'category': 'C/C++', 'severity': Severity.LOW, 'option': '-Winvalid-pp-token', 1689 'description': 'Invalid pp token', 1690 'patterns': [r".*: warning: missing .+Winvalid-pp-token"]}, 1691 {'category': 'link', 'severity': Severity.LOW, 1692 'description': 'need glibc to link', 1693 'patterns': [r".*: warning: .* requires at runtime .* glibc .* for linking"]}, 1694 1695 {'category': 'C/C++', 'severity': Severity.MEDIUM, 1696 'description': 'Operator new returns NULL', 1697 'patterns': [r".*: warning: 'operator new' must not return NULL unless it is declared 'throw\(\)' .+"]}, 1698 {'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': '-Wnull-arithmetic', 1699 'description': 'NULL used in arithmetic', 1700 'patterns': [r".*: warning: NULL used in arithmetic", 1701 r".*: warning: comparison between NULL and non-pointer"]}, 1702 {'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': 'header-guard', 1703 'description': 'Misspelled header guard', 1704 'patterns': [r".*: warning: '.+' is used as a header guard .+ followed by .+ different macro"]}, 1705 {'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': 'empty-body', 1706 'description': 'Empty loop body', 1707 'patterns': [r".*: warning: .+ loop has empty body"]}, 1708 {'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': 'enum-conversion', 1709 'description': 'Implicit conversion from enumeration type', 1710 'patterns': [r".*: warning: implicit conversion from enumeration type '.+'"]}, 1711 {'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': 'switch', 1712 'description': 'case value not in enumerated type', 1713 'patterns': [r".*: warning: case value not in enumerated type '.+'"]}, 1714 {'category': 'C/C++', 'severity': Severity.MEDIUM, 1715 'description': 'Undefined result', 1716 'patterns': [r".*: warning: The result of .+ is undefined", 1717 r".*: warning: passing an object that .+ has undefined behavior \[-Wvarargs\]", 1718 r".*: warning: 'this' pointer cannot be null in well-defined C\+\+ code;", 1719 r".*: warning: shifting a negative signed value is undefined"]}, 1720 {'category': 'C/C++', 'severity': Severity.MEDIUM, 1721 'description': 'Division by zero', 1722 'patterns': [r".*: warning: Division by zero"]}, 1723 {'category': 'C/C++', 'severity': Severity.MEDIUM, 1724 'description': 'Use of deprecated method', 1725 'patterns': [r".*: warning: '.+' is deprecated .+"]}, 1726 {'category': 'C/C++', 'severity': Severity.MEDIUM, 1727 'description': 'Use of garbage or uninitialized value', 1728 'patterns': [r".*: warning: .+ is a garbage value", 1729 r".*: warning: Function call argument is an uninitialized value", 1730 r".*: warning: Undefined or garbage value returned to caller", 1731 r".*: warning: Called .+ pointer is.+uninitialized", 1732 r".*: warning: Called .+ pointer is.+uninitalized", # match a typo in compiler message 1733 r".*: warning: Use of zero-allocated memory", 1734 r".*: warning: Dereference of undefined pointer value", 1735 r".*: warning: Passed-by-value .+ contains uninitialized data", 1736 r".*: warning: Branch condition evaluates to a garbage value", 1737 r".*: warning: The .+ of .+ is an uninitialized value.", 1738 r".*: warning: .+ is used uninitialized whenever .+sometimes-uninitialized", 1739 r".*: warning: Assigned value is garbage or undefined"]}, 1740 {'category': 'C/C++', 'severity': Severity.MEDIUM, 1741 'description': 'Result of malloc type incompatible with sizeof operand type', 1742 'patterns': [r".*: warning: Result of '.+' is converted to .+ incompatible with sizeof operand type"]}, 1743 {'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': '-Wsizeof-array-argument', 1744 'description': 'Sizeof on array argument', 1745 'patterns': [r".*: warning: sizeof on array function parameter will return"]}, 1746 {'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': '-Wsizeof-pointer-memacces', 1747 'description': 'Bad argument size of memory access functions', 1748 'patterns': [r".*: warning: .+\[-Wsizeof-pointer-memaccess\]"]}, 1749 {'category': 'C/C++', 'severity': Severity.MEDIUM, 1750 'description': 'Return value not checked', 1751 'patterns': [r".*: warning: The return value from .+ is not checked"]}, 1752 {'category': 'C/C++', 'severity': Severity.MEDIUM, 1753 'description': 'Possible heap pollution', 1754 'patterns': [r".*: warning: .*Possible heap pollution from .+ type .+"]}, 1755 {'category': 'C/C++', 'severity': Severity.MEDIUM, 1756 'description': 'Allocation size of 0 byte', 1757 'patterns': [r".*: warning: Call to .+ has an allocation size of 0 byte"]}, 1758 {'category': 'C/C++', 'severity': Severity.MEDIUM, 1759 'description': 'Result of malloc type incompatible with sizeof operand type', 1760 'patterns': [r".*: warning: Result of '.+' is converted to .+ incompatible with sizeof operand type"]}, 1761 {'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': '-Wfor-loop-analysis', 1762 'description': 'Variable used in loop condition not modified in loop body', 1763 'patterns': [r".*: warning: variable '.+' used in loop condition.*Wfor-loop-analysis"]}, 1764 {'category': 'C/C++', 'severity': Severity.MEDIUM, 1765 'description': 'Closing a previously closed file', 1766 'patterns': [r".*: warning: Closing a previously closed file"]}, 1767 {'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': '-Wunnamed-type-template-args', 1768 'description': 'Unnamed template type argument', 1769 'patterns': [r".*: warning: template argument.+Wunnamed-type-template-args"]}, 1770 1771 {'category': 'C/C++', 'severity': Severity.HARMLESS, 1772 'description': 'Discarded qualifier from pointer target type', 1773 'patterns': [r".*: warning: .+ discards '.+' qualifier from pointer target type"]}, 1774 {'category': 'C/C++', 'severity': Severity.HARMLESS, 1775 'description': 'Use snprintf instead of sprintf', 1776 'patterns': [r".*: warning: .*sprintf is often misused; please use snprintf"]}, 1777 {'category': 'C/C++', 'severity': Severity.HARMLESS, 1778 'description': 'Unsupported optimizaton flag', 1779 'patterns': [r".*: warning: optimization flag '.+' is not supported"]}, 1780 {'category': 'C/C++', 'severity': Severity.HARMLESS, 1781 'description': 'Extra or missing parentheses', 1782 'patterns': [r".*: warning: equality comparison with extraneous parentheses", 1783 r".*: warning: .+ within .+Wlogical-op-parentheses"]}, 1784 {'category': 'C/C++', 'severity': Severity.HARMLESS, 'option': 'mismatched-tags', 1785 'description': 'Mismatched class vs struct tags', 1786 'patterns': [r".*: warning: '.+' defined as a .+ here but previously declared as a .+mismatched-tags", 1787 r".*: warning: .+ was previously declared as a .+mismatched-tags"]}, 1788 {'category': 'FindEmulator', 'severity': Severity.HARMLESS, 1789 'description': 'FindEmulator: No such file or directory', 1790 'patterns': [r".*: warning: FindEmulator: .* No such file or directory"]}, 1791 {'category': 'google_tests', 'severity': Severity.HARMLESS, 1792 'description': 'google_tests: unknown installed file', 1793 'patterns': [r".*: warning: .*_tests: Unknown installed file for module"]}, 1794 {'category': 'make', 'severity': Severity.HARMLESS, 1795 'description': 'unusual tags debug eng', 1796 'patterns': [r".*: warning: .*: unusual tags debug eng"]}, 1797 1798 # these next ones are to deal with formatting problems resulting from the log being mixed up by 'make -j' 1799 {'category': 'C/C++', 'severity': Severity.SKIP, 1800 'description': 'skip, ,', 1801 'patterns': [r".*: warning: ,$"]}, 1802 {'category': 'C/C++', 'severity': Severity.SKIP, 1803 'description': 'skip,', 1804 'patterns': [r".*: warning: $"]}, 1805 {'category': 'C/C++', 'severity': Severity.SKIP, 1806 'description': 'skip, In file included from ...', 1807 'patterns': [r".*: warning: In file included from .+,"]}, 1808 1809 # warnings from clang-tidy 1810 group_tidy_warn_pattern('cert'), 1811 group_tidy_warn_pattern('clang-diagnostic'), 1812 group_tidy_warn_pattern('cppcoreguidelines'), 1813 group_tidy_warn_pattern('llvm'), 1814 simple_tidy_warn_pattern('google-default-arguments'), 1815 simple_tidy_warn_pattern('google-runtime-int'), 1816 simple_tidy_warn_pattern('google-runtime-operator'), 1817 simple_tidy_warn_pattern('google-runtime-references'), 1818 group_tidy_warn_pattern('google-build'), 1819 group_tidy_warn_pattern('google-explicit'), 1820 group_tidy_warn_pattern('google-redability'), 1821 group_tidy_warn_pattern('google-global'), 1822 group_tidy_warn_pattern('google-redability'), 1823 group_tidy_warn_pattern('google-redability'), 1824 group_tidy_warn_pattern('google'), 1825 simple_tidy_warn_pattern('hicpp-explicit-conversions'), 1826 simple_tidy_warn_pattern('hicpp-function-size'), 1827 simple_tidy_warn_pattern('hicpp-invalid-access-moved'), 1828 simple_tidy_warn_pattern('hicpp-member-init'), 1829 simple_tidy_warn_pattern('hicpp-delete-operators'), 1830 simple_tidy_warn_pattern('hicpp-special-member-functions'), 1831 simple_tidy_warn_pattern('hicpp-use-equals-default'), 1832 simple_tidy_warn_pattern('hicpp-use-equals-delete'), 1833 simple_tidy_warn_pattern('hicpp-no-assembler'), 1834 simple_tidy_warn_pattern('hicpp-noexcept-move'), 1835 simple_tidy_warn_pattern('hicpp-use-override'), 1836 group_tidy_warn_pattern('hicpp'), 1837 group_tidy_warn_pattern('modernize'), 1838 group_tidy_warn_pattern('misc'), 1839 simple_tidy_warn_pattern('performance-faster-string-find'), 1840 simple_tidy_warn_pattern('performance-for-range-copy'), 1841 simple_tidy_warn_pattern('performance-implicit-cast-in-loop'), 1842 simple_tidy_warn_pattern('performance-inefficient-string-concatenation'), 1843 simple_tidy_warn_pattern('performance-type-promotion-in-math-fn'), 1844 simple_tidy_warn_pattern('performance-unnecessary-copy-initialization'), 1845 simple_tidy_warn_pattern('performance-unnecessary-value-param'), 1846 group_tidy_warn_pattern('performance'), 1847 group_tidy_warn_pattern('readability'), 1848 1849 # warnings from clang-tidy's clang-analyzer checks 1850 {'category': 'C/C++', 'severity': Severity.ANALYZER, 1851 'description': 'clang-analyzer Unreachable code', 1852 'patterns': [r".*: warning: This statement is never executed.*UnreachableCode"]}, 1853 {'category': 'C/C++', 'severity': Severity.ANALYZER, 1854 'description': 'clang-analyzer Size of malloc may overflow', 1855 'patterns': [r".*: warning: .* size of .* may overflow .*MallocOverflow"]}, 1856 {'category': 'C/C++', 'severity': Severity.ANALYZER, 1857 'description': 'clang-analyzer Stream pointer might be NULL', 1858 'patterns': [r".*: warning: Stream pointer might be NULL .*unix.Stream"]}, 1859 {'category': 'C/C++', 'severity': Severity.ANALYZER, 1860 'description': 'clang-analyzer Opened file never closed', 1861 'patterns': [r".*: warning: Opened File never closed.*unix.Stream"]}, 1862 {'category': 'C/C++', 'severity': Severity.ANALYZER, 1863 'description': 'clang-analyzer sozeof() on a pointer type', 1864 'patterns': [r".*: warning: .*calls sizeof.* on a pointer type.*SizeofPtr"]}, 1865 {'category': 'C/C++', 'severity': Severity.ANALYZER, 1866 'description': 'clang-analyzer Pointer arithmetic on non-array variables', 1867 'patterns': [r".*: warning: Pointer arithmetic on non-array variables .*PointerArithm"]}, 1868 {'category': 'C/C++', 'severity': Severity.ANALYZER, 1869 'description': 'clang-analyzer Subtraction of pointers of different memory chunks', 1870 'patterns': [r".*: warning: Subtraction of two pointers .*PointerSub"]}, 1871 {'category': 'C/C++', 'severity': Severity.ANALYZER, 1872 'description': 'clang-analyzer Access out-of-bound array element', 1873 'patterns': [r".*: warning: Access out-of-bound array element .*ArrayBound"]}, 1874 {'category': 'C/C++', 'severity': Severity.ANALYZER, 1875 'description': 'clang-analyzer Out of bound memory access', 1876 'patterns': [r".*: warning: Out of bound memory access .*ArrayBoundV2"]}, 1877 {'category': 'C/C++', 'severity': Severity.ANALYZER, 1878 'description': 'clang-analyzer Possible lock order reversal', 1879 'patterns': [r".*: warning: .* Possible lock order reversal.*PthreadLock"]}, 1880 {'category': 'C/C++', 'severity': Severity.ANALYZER, 1881 'description': 'clang-analyzer Argument is a pointer to uninitialized value', 1882 'patterns': [r".*: warning: .* argument is a pointer to uninitialized value .*CallAndMessage"]}, 1883 {'category': 'C/C++', 'severity': Severity.ANALYZER, 1884 'description': 'clang-analyzer cast to struct', 1885 'patterns': [r".*: warning: Casting a non-structure type to a structure type .*CastToStruct"]}, 1886 {'category': 'C/C++', 'severity': Severity.ANALYZER, 1887 'description': 'clang-analyzer call path problems', 1888 'patterns': [r".*: warning: Call Path : .+"]}, 1889 {'category': 'C/C++', 'severity': Severity.ANALYZER, 1890 'description': 'clang-analyzer excessive padding', 1891 'patterns': [r".*: warning: Excessive padding in '.*'"]}, 1892 {'category': 'C/C++', 'severity': Severity.ANALYZER, 1893 'description': 'clang-analyzer other', 1894 'patterns': [r".*: .+\[clang-analyzer-.+\]$", 1895 r".*: Call Path : .+$"]}, 1896 1897 # catch-all for warnings this script doesn't know about yet 1898 {'category': 'C/C++', 'severity': Severity.UNKNOWN, 1899 'description': 'Unclassified/unrecognized warnings', 1900 'patterns': [r".*: warning: .+"]}, 1901 ] 1902 1903 1904 def project_name_and_pattern(name, pattern): 1905 return [name, '(^|.*/)' + pattern + '/.*: warning:'] 1906 1907 1908 def simple_project_pattern(pattern): 1909 return project_name_and_pattern(pattern, pattern) 1910 1911 1912 # A list of [project_name, file_path_pattern]. 1913 # project_name should not contain comma, to be used in CSV output. 1914 project_list = [ 1915 simple_project_pattern('art'), 1916 simple_project_pattern('bionic'), 1917 simple_project_pattern('bootable'), 1918 simple_project_pattern('build'), 1919 simple_project_pattern('cts'), 1920 simple_project_pattern('dalvik'), 1921 simple_project_pattern('developers'), 1922 simple_project_pattern('development'), 1923 simple_project_pattern('device'), 1924 simple_project_pattern('doc'), 1925 # match external/google* before external/ 1926 project_name_and_pattern('external/google', 'external/google.*'), 1927 project_name_and_pattern('external/non-google', 'external'), 1928 simple_project_pattern('frameworks/av/camera'), 1929 simple_project_pattern('frameworks/av/cmds'), 1930 simple_project_pattern('frameworks/av/drm'), 1931 simple_project_pattern('frameworks/av/include'), 1932 simple_project_pattern('frameworks/av/media/common_time'), 1933 simple_project_pattern('frameworks/av/media/img_utils'), 1934 simple_project_pattern('frameworks/av/media/libcpustats'), 1935 simple_project_pattern('frameworks/av/media/libeffects'), 1936 simple_project_pattern('frameworks/av/media/libmediaplayerservice'), 1937 simple_project_pattern('frameworks/av/media/libmedia'), 1938 simple_project_pattern('frameworks/av/media/libstagefright'), 1939 simple_project_pattern('frameworks/av/media/mtp'), 1940 simple_project_pattern('frameworks/av/media/ndk'), 1941 simple_project_pattern('frameworks/av/media/utils'), 1942 project_name_and_pattern('frameworks/av/media/Other', 1943 'frameworks/av/media'), 1944 simple_project_pattern('frameworks/av/radio'), 1945 simple_project_pattern('frameworks/av/services'), 1946 simple_project_pattern('frameworks/av/soundtrigger'), 1947 project_name_and_pattern('frameworks/av/Other', 'frameworks/av'), 1948 simple_project_pattern('frameworks/base/cmds'), 1949 simple_project_pattern('frameworks/base/core'), 1950 simple_project_pattern('frameworks/base/drm'), 1951 simple_project_pattern('frameworks/base/media'), 1952 simple_project_pattern('frameworks/base/libs'), 1953 simple_project_pattern('frameworks/base/native'), 1954 simple_project_pattern('frameworks/base/packages'), 1955 simple_project_pattern('frameworks/base/rs'), 1956 simple_project_pattern('frameworks/base/services'), 1957 simple_project_pattern('frameworks/base/tests'), 1958 simple_project_pattern('frameworks/base/tools'), 1959 project_name_and_pattern('frameworks/base/Other', 'frameworks/base'), 1960 simple_project_pattern('frameworks/compile/libbcc'), 1961 simple_project_pattern('frameworks/compile/mclinker'), 1962 simple_project_pattern('frameworks/compile/slang'), 1963 project_name_and_pattern('frameworks/compile/Other', 'frameworks/compile'), 1964 simple_project_pattern('frameworks/minikin'), 1965 simple_project_pattern('frameworks/ml'), 1966 simple_project_pattern('frameworks/native/cmds'), 1967 simple_project_pattern('frameworks/native/include'), 1968 simple_project_pattern('frameworks/native/libs'), 1969 simple_project_pattern('frameworks/native/opengl'), 1970 simple_project_pattern('frameworks/native/services'), 1971 simple_project_pattern('frameworks/native/vulkan'), 1972 project_name_and_pattern('frameworks/native/Other', 'frameworks/native'), 1973 simple_project_pattern('frameworks/opt'), 1974 simple_project_pattern('frameworks/rs'), 1975 simple_project_pattern('frameworks/webview'), 1976 simple_project_pattern('frameworks/wilhelm'), 1977 project_name_and_pattern('frameworks/Other', 'frameworks'), 1978 simple_project_pattern('hardware/akm'), 1979 simple_project_pattern('hardware/broadcom'), 1980 simple_project_pattern('hardware/google'), 1981 simple_project_pattern('hardware/intel'), 1982 simple_project_pattern('hardware/interfaces'), 1983 simple_project_pattern('hardware/libhardware'), 1984 simple_project_pattern('hardware/libhardware_legacy'), 1985 simple_project_pattern('hardware/qcom'), 1986 simple_project_pattern('hardware/ril'), 1987 project_name_and_pattern('hardware/Other', 'hardware'), 1988 simple_project_pattern('kernel'), 1989 simple_project_pattern('libcore'), 1990 simple_project_pattern('libnativehelper'), 1991 simple_project_pattern('ndk'), 1992 # match vendor/unbungled_google/packages before other packages 1993 simple_project_pattern('unbundled_google'), 1994 simple_project_pattern('packages'), 1995 simple_project_pattern('pdk'), 1996 simple_project_pattern('prebuilts'), 1997 simple_project_pattern('system/bt'), 1998 simple_project_pattern('system/connectivity'), 1999 simple_project_pattern('system/core/adb'), 2000 simple_project_pattern('system/core/base'), 2001 simple_project_pattern('system/core/debuggerd'), 2002 simple_project_pattern('system/core/fastboot'), 2003 simple_project_pattern('system/core/fingerprintd'), 2004 simple_project_pattern('system/core/fs_mgr'), 2005 simple_project_pattern('system/core/gatekeeperd'), 2006 simple_project_pattern('system/core/healthd'), 2007 simple_project_pattern('system/core/include'), 2008 simple_project_pattern('system/core/init'), 2009 simple_project_pattern('system/core/libbacktrace'), 2010 simple_project_pattern('system/core/liblog'), 2011 simple_project_pattern('system/core/libpixelflinger'), 2012 simple_project_pattern('system/core/libprocessgroup'), 2013 simple_project_pattern('system/core/libsysutils'), 2014 simple_project_pattern('system/core/logcat'), 2015 simple_project_pattern('system/core/logd'), 2016 simple_project_pattern('system/core/run-as'), 2017 simple_project_pattern('system/core/sdcard'), 2018 simple_project_pattern('system/core/toolbox'), 2019 project_name_and_pattern('system/core/Other', 'system/core'), 2020 simple_project_pattern('system/extras/ANRdaemon'), 2021 simple_project_pattern('system/extras/cpustats'), 2022 simple_project_pattern('system/extras/crypto-perf'), 2023 simple_project_pattern('system/extras/ext4_utils'), 2024 simple_project_pattern('system/extras/f2fs_utils'), 2025 simple_project_pattern('system/extras/iotop'), 2026 simple_project_pattern('system/extras/libfec'), 2027 simple_project_pattern('system/extras/memory_replay'), 2028 simple_project_pattern('system/extras/micro_bench'), 2029 simple_project_pattern('system/extras/mmap-perf'), 2030 simple_project_pattern('system/extras/multinetwork'), 2031 simple_project_pattern('system/extras/perfprofd'), 2032 simple_project_pattern('system/extras/procrank'), 2033 simple_project_pattern('system/extras/runconuid'), 2034 simple_project_pattern('system/extras/showmap'), 2035 simple_project_pattern('system/extras/simpleperf'), 2036 simple_project_pattern('system/extras/su'), 2037 simple_project_pattern('system/extras/tests'), 2038 simple_project_pattern('system/extras/verity'), 2039 project_name_and_pattern('system/extras/Other', 'system/extras'), 2040 simple_project_pattern('system/gatekeeper'), 2041 simple_project_pattern('system/keymaster'), 2042 simple_project_pattern('system/libhidl'), 2043 simple_project_pattern('system/libhwbinder'), 2044 simple_project_pattern('system/media'), 2045 simple_project_pattern('system/netd'), 2046 simple_project_pattern('system/nvram'), 2047 simple_project_pattern('system/security'), 2048 simple_project_pattern('system/sepolicy'), 2049 simple_project_pattern('system/tools'), 2050 simple_project_pattern('system/update_engine'), 2051 simple_project_pattern('system/vold'), 2052 project_name_and_pattern('system/Other', 'system'), 2053 simple_project_pattern('toolchain'), 2054 simple_project_pattern('test'), 2055 simple_project_pattern('tools'), 2056 # match vendor/google* before vendor/ 2057 project_name_and_pattern('vendor/google', 'vendor/google.*'), 2058 project_name_and_pattern('vendor/non-google', 'vendor'), 2059 # keep out/obj and other patterns at the end. 2060 ['out/obj', 2061 '.*/(gen|obj[^/]*)/(include|EXECUTABLES|SHARED_LIBRARIES|' 2062 'STATIC_LIBRARIES|NATIVE_TESTS)/.*: warning:'], 2063 ['other', '.*'] # all other unrecognized patterns 2064 ] 2065 2066 project_patterns = [] 2067 project_names = [] 2068 warning_messages = [] 2069 warning_records = [] 2070 2071 2072 def initialize_arrays(): 2073 """Complete global arrays before they are used.""" 2074 global project_names, project_patterns 2075 project_names = [p[0] for p in project_list] 2076 project_patterns = [re.compile(p[1]) for p in project_list] 2077 for w in warn_patterns: 2078 w['members'] = [] 2079 if 'option' not in w: 2080 w['option'] = '' 2081 # Each warning pattern has a 'projects' dictionary, that 2082 # maps a project name to number of warnings in that project. 2083 w['projects'] = {} 2084 2085 2086 initialize_arrays() 2087 2088 2089 android_root = '' 2090 platform_version = 'unknown' 2091 target_product = 'unknown' 2092 target_variant = 'unknown' 2093 2094 2095 ##### Data and functions to dump html file. ################################## 2096 2097 html_head_scripts = """\ 2098 <script type="text/javascript"> 2099 function expand(id) { 2100 var e = document.getElementById(id); 2101 var f = document.getElementById(id + "_mark"); 2102 if (e.style.display == 'block') { 2103 e.style.display = 'none'; 2104 f.innerHTML = '⊕'; 2105 } 2106 else { 2107 e.style.display = 'block'; 2108 f.innerHTML = '⊖'; 2109 } 2110 }; 2111 function expandCollapse(show) { 2112 for (var id = 1; ; id++) { 2113 var e = document.getElementById(id + ""); 2114 var f = document.getElementById(id + "_mark"); 2115 if (!e || !f) break; 2116 e.style.display = (show ? 'block' : 'none'); 2117 f.innerHTML = (show ? '⊖' : '⊕'); 2118 } 2119 }; 2120 </script> 2121 <style type="text/css"> 2122 th,td{border-collapse:collapse; border:1px solid black;} 2123 .button{color:blue;font-size:110%;font-weight:bolder;} 2124 .bt{color:black;background-color:transparent;border:none;outline:none; 2125 font-size:140%;font-weight:bolder;} 2126 .c0{background-color:#e0e0e0;} 2127 .c1{background-color:#d0d0d0;} 2128 .t1{border-collapse:collapse; width:100%; border:1px solid black;} 2129 </style> 2130 <script src="https://www.gstatic.com/charts/loader.js"></script> 2131 """ 2132 2133 2134 def html_big(param): 2135 return '<font size="+2">' + param + '</font>' 2136 2137 2138 def dump_html_prologue(title): 2139 print '<html>\n<head>' 2140 print '<title>' + title + '</title>' 2141 print html_head_scripts 2142 emit_stats_by_project() 2143 print '</head>\n<body>' 2144 print html_big(title) 2145 print '<p>' 2146 2147 2148 def dump_html_epilogue(): 2149 print '</body>\n</head>\n</html>' 2150 2151 2152 def sort_warnings(): 2153 for i in warn_patterns: 2154 i['members'] = sorted(set(i['members'])) 2155 2156 2157 def emit_stats_by_project(): 2158 """Dump a google chart table of warnings per project and severity.""" 2159 # warnings[p][s] is number of warnings in project p of severity s. 2160 warnings = {p: {s: 0 for s in Severity.range} for p in project_names} 2161 for i in warn_patterns: 2162 s = i['severity'] 2163 for p in i['projects']: 2164 warnings[p][s] += i['projects'][p] 2165 2166 # total_by_project[p] is number of warnings in project p. 2167 total_by_project = {p: sum(warnings[p][s] for s in Severity.range) 2168 for p in project_names} 2169 2170 # total_by_severity[s] is number of warnings of severity s. 2171 total_by_severity = {s: sum(warnings[p][s] for p in project_names) 2172 for s in Severity.range} 2173 2174 # emit table header 2175 stats_header = ['Project'] 2176 for s in Severity.range: 2177 if total_by_severity[s]: 2178 stats_header.append("<span style='background-color:{}'>{}</span>". 2179 format(Severity.colors[s], 2180 Severity.column_headers[s])) 2181 stats_header.append('TOTAL') 2182 2183 # emit a row of warning counts per project, skip no-warning projects 2184 total_all_projects = 0 2185 stats_rows = [] 2186 for p in project_names: 2187 if total_by_project[p]: 2188 one_row = [p] 2189 for s in Severity.range: 2190 if total_by_severity[s]: 2191 one_row.append(warnings[p][s]) 2192 one_row.append(total_by_project[p]) 2193 stats_rows.append(one_row) 2194 total_all_projects += total_by_project[p] 2195 2196 # emit a row of warning counts per severity 2197 total_all_severities = 0 2198 one_row = ['<b>TOTAL</b>'] 2199 for s in Severity.range: 2200 if total_by_severity[s]: 2201 one_row.append(total_by_severity[s]) 2202 total_all_severities += total_by_severity[s] 2203 one_row.append(total_all_projects) 2204 stats_rows.append(one_row) 2205 print '<script>' 2206 emit_const_string_array('StatsHeader', stats_header) 2207 emit_const_object_array('StatsRows', stats_rows) 2208 print draw_table_javascript 2209 print '</script>' 2210 2211 2212 def dump_stats(): 2213 """Dump some stats about total number of warnings and such.""" 2214 known = 0 2215 skipped = 0 2216 unknown = 0 2217 sort_warnings() 2218 for i in warn_patterns: 2219 if i['severity'] == Severity.UNKNOWN: 2220 unknown += len(i['members']) 2221 elif i['severity'] == Severity.SKIP: 2222 skipped += len(i['members']) 2223 else: 2224 known += len(i['members']) 2225 print 'Number of classified warnings: <b>' + str(known) + '</b><br>' 2226 print 'Number of skipped warnings: <b>' + str(skipped) + '</b><br>' 2227 print 'Number of unclassified warnings: <b>' + str(unknown) + '</b><br>' 2228 total = unknown + known + skipped 2229 extra_msg = '' 2230 if total < 1000: 2231 extra_msg = ' (low count may indicate incremental build)' 2232 print 'Total number of warnings: <b>' + str(total) + '</b>' + extra_msg 2233 2234 2235 # New base table of warnings, [severity, warn_id, project, warning_message] 2236 # Need buttons to show warnings in different grouping options. 2237 # (1) Current, group by severity, id for each warning pattern 2238 # sort by severity, warn_id, warning_message 2239 # (2) Current --byproject, group by severity, 2240 # id for each warning pattern + project name 2241 # sort by severity, warn_id, project, warning_message 2242 # (3) New, group by project + severity, 2243 # id for each warning pattern 2244 # sort by project, severity, warn_id, warning_message 2245 def emit_buttons(): 2246 print ('<button class="button" onclick="expandCollapse(1);">' 2247 'Expand all warnings</button>\n' 2248 '<button class="button" onclick="expandCollapse(0);">' 2249 'Collapse all warnings</button>\n' 2250 '<button class="button" onclick="groupBySeverity();">' 2251 'Group warnings by severity</button>\n' 2252 '<button class="button" onclick="groupByProject();">' 2253 'Group warnings by project</button><br>') 2254 2255 2256 def all_patterns(category): 2257 patterns = '' 2258 for i in category['patterns']: 2259 patterns += i 2260 patterns += ' / ' 2261 return patterns 2262 2263 2264 def dump_fixed(): 2265 """Show which warnings no longer occur.""" 2266 anchor = 'fixed_warnings' 2267 mark = anchor + '_mark' 2268 print ('\n<br><p style="background-color:lightblue"><b>' 2269 '<button id="' + mark + '" ' 2270 'class="bt" onclick="expand(\'' + anchor + '\');">' 2271 '⊕</button> Fixed warnings. ' 2272 'No more occurrences. Please consider turning these into ' 2273 'errors if possible, before they are reintroduced in to the build' 2274 ':</b></p>') 2275 print '<blockquote>' 2276 fixed_patterns = [] 2277 for i in warn_patterns: 2278 if not i['members']: 2279 fixed_patterns.append(i['description'] + ' (' + 2280 all_patterns(i) + ')') 2281 if i['option']: 2282 fixed_patterns.append(' ' + i['option']) 2283 fixed_patterns.sort() 2284 print '<div id="' + anchor + '" style="display:none;"><table>' 2285 cur_row_class = 0 2286 for text in fixed_patterns: 2287 cur_row_class = 1 - cur_row_class 2288 # remove last '\n' 2289 t = text[:-1] if text[-1] == '\n' else text 2290 print '<tr><td class="c' + str(cur_row_class) + '">' + t + '</td></tr>' 2291 print '</table></div>' 2292 print '</blockquote>' 2293 2294 2295 def find_project_index(line): 2296 for p in range(len(project_patterns)): 2297 if project_patterns[p].match(line): 2298 return p 2299 return -1 2300 2301 2302 def classify_one_warning(line, results): 2303 for i in range(len(warn_patterns)): 2304 w = warn_patterns[i] 2305 for cpat in w['compiled_patterns']: 2306 if cpat.match(line): 2307 p = find_project_index(line) 2308 results.append([line, i, p]) 2309 return 2310 else: 2311 # If we end up here, there was a problem parsing the log 2312 # probably caused by 'make -j' mixing the output from 2313 # 2 or more concurrent compiles 2314 pass 2315 2316 2317 def classify_warnings(lines): 2318 results = [] 2319 for line in lines: 2320 classify_one_warning(line, results) 2321 # After the main work, ignore all other signals to a child process, 2322 # to avoid bad warning/error messages from the exit clean-up process. 2323 if args.processes > 1: 2324 signal.signal(signal.SIGTERM, lambda *args: sys.exit(-signal.SIGTERM)) 2325 return results 2326 2327 2328 def parallel_classify_warnings(warning_lines): 2329 """Classify all warning lines with num_cpu parallel processes.""" 2330 compile_patterns() 2331 num_cpu = args.processes 2332 if num_cpu > 1: 2333 groups = [[] for x in range(num_cpu)] 2334 i = 0 2335 for x in warning_lines: 2336 groups[i].append(x) 2337 i = (i + 1) % num_cpu 2338 pool = multiprocessing.Pool(num_cpu) 2339 group_results = pool.map(classify_warnings, groups) 2340 else: 2341 group_results = [classify_warnings(warning_lines)] 2342 2343 for result in group_results: 2344 for line, pattern_idx, project_idx in result: 2345 pattern = warn_patterns[pattern_idx] 2346 pattern['members'].append(line) 2347 message_idx = len(warning_messages) 2348 warning_messages.append(line) 2349 warning_records.append([pattern_idx, project_idx, message_idx]) 2350 pname = '???' if project_idx < 0 else project_names[project_idx] 2351 # Count warnings by project. 2352 if pname in pattern['projects']: 2353 pattern['projects'][pname] += 1 2354 else: 2355 pattern['projects'][pname] = 1 2356 2357 2358 def compile_patterns(): 2359 """Precompiling every pattern speeds up parsing by about 30x.""" 2360 for i in warn_patterns: 2361 i['compiled_patterns'] = [] 2362 for pat in i['patterns']: 2363 i['compiled_patterns'].append(re.compile(pat)) 2364 2365 2366 def find_android_root(path): 2367 """Set and return android_root path if it is found.""" 2368 global android_root 2369 parts = path.split('/') 2370 for idx in reversed(range(2, len(parts))): 2371 root_path = '/'.join(parts[:idx]) 2372 # Android root directory should contain this script. 2373 if os.path.exists(root_path + '/build/tools/warn.py'): 2374 android_root = root_path 2375 return root_path 2376 return '' 2377 2378 2379 def remove_android_root_prefix(path): 2380 """Remove android_root prefix from path if it is found.""" 2381 if path.startswith(android_root): 2382 return path[1 + len(android_root):] 2383 else: 2384 return path 2385 2386 2387 def normalize_path(path): 2388 """Normalize file path relative to android_root.""" 2389 # If path is not an absolute path, just normalize it. 2390 path = os.path.normpath(path) 2391 if path[0] != '/': 2392 return path 2393 # Remove known prefix of root path and normalize the suffix. 2394 if android_root or find_android_root(path): 2395 return remove_android_root_prefix(path) 2396 else: 2397 return path 2398 2399 2400 def normalize_warning_line(line): 2401 """Normalize file path relative to android_root in a warning line.""" 2402 # replace fancy quotes with plain ol' quotes 2403 line = line.replace('', "'") 2404 line = line.replace('', "'") 2405 line = line.strip() 2406 first_column = line.find(':') 2407 if first_column > 0: 2408 return normalize_path(line[:first_column]) + line[first_column:] 2409 else: 2410 return line 2411 2412 2413 def parse_input_file(infile): 2414 """Parse input file, collect parameters and warning lines.""" 2415 global android_root 2416 global platform_version 2417 global target_product 2418 global target_variant 2419 line_counter = 0 2420 2421 # handle only warning messages with a file path 2422 warning_pattern = re.compile('^[^ ]*/[^ ]*: warning: .*') 2423 2424 # Collect all warnings into the warning_lines set. 2425 warning_lines = set() 2426 for line in infile: 2427 if warning_pattern.match(line): 2428 line = normalize_warning_line(line) 2429 warning_lines.add(line) 2430 elif line_counter < 100: 2431 # save a little bit of time by only doing this for the first few lines 2432 line_counter += 1 2433 m = re.search('(?<=^PLATFORM_VERSION=).*', line) 2434 if m is not None: 2435 platform_version = m.group(0) 2436 m = re.search('(?<=^TARGET_PRODUCT=).*', line) 2437 if m is not None: 2438 target_product = m.group(0) 2439 m = re.search('(?<=^TARGET_BUILD_VARIANT=).*', line) 2440 if m is not None: 2441 target_variant = m.group(0) 2442 m = re.search('.* TOP=([^ ]*) .*', line) 2443 if m is not None: 2444 android_root = m.group(1) 2445 return warning_lines 2446 2447 2448 # Return s with escaped backslash and quotation characters. 2449 def escape_string(s): 2450 return s.replace('\\', '\\\\').replace('"', '\\"') 2451 2452 2453 # Return s without trailing '\n' and escape the quotation characters. 2454 def strip_escape_string(s): 2455 if not s: 2456 return s 2457 s = s[:-1] if s[-1] == '\n' else s 2458 return escape_string(s) 2459 2460 2461 def emit_warning_array(name): 2462 print 'var warning_{} = ['.format(name) 2463 for i in range(len(warn_patterns)): 2464 print '{},'.format(warn_patterns[i][name]) 2465 print '];' 2466 2467 2468 def emit_warning_arrays(): 2469 emit_warning_array('severity') 2470 print 'var warning_description = [' 2471 for i in range(len(warn_patterns)): 2472 if warn_patterns[i]['members']: 2473 print '"{}",'.format(escape_string(warn_patterns[i]['description'])) 2474 else: 2475 print '"",' # no such warning 2476 print '];' 2477 2478 scripts_for_warning_groups = """ 2479 function compareMessages(x1, x2) { // of the same warning type 2480 return (WarningMessages[x1[2]] <= WarningMessages[x2[2]]) ? -1 : 1; 2481 } 2482 function byMessageCount(x1, x2) { 2483 return x2[2] - x1[2]; // reversed order 2484 } 2485 function bySeverityMessageCount(x1, x2) { 2486 // orer by severity first 2487 if (x1[1] != x2[1]) 2488 return x1[1] - x2[1]; 2489 return byMessageCount(x1, x2); 2490 } 2491 const ParseLinePattern = /^([^ :]+):(\\d+):(.+)/; 2492 function addURL(line) { 2493 if (FlagURL == "") return line; 2494 if (FlagSeparator == "") { 2495 return line.replace(ParseLinePattern, 2496 "<a target='_blank' href='" + FlagURL + "/$1'>$1</a>:$2:$3"); 2497 } 2498 return line.replace(ParseLinePattern, 2499 "<a target='_blank' href='" + FlagURL + "/$1" + FlagSeparator + 2500 "$2'>$1:$2</a>:$3"); 2501 } 2502 function createArrayOfDictionaries(n) { 2503 var result = []; 2504 for (var i=0; i<n; i++) result.push({}); 2505 return result; 2506 } 2507 function groupWarningsBySeverity() { 2508 // groups is an array of dictionaries, 2509 // each dictionary maps from warning type to array of warning messages. 2510 var groups = createArrayOfDictionaries(SeverityColors.length); 2511 for (var i=0; i<Warnings.length; i++) { 2512 var w = Warnings[i][0]; 2513 var s = WarnPatternsSeverity[w]; 2514 var k = w.toString(); 2515 if (!(k in groups[s])) 2516 groups[s][k] = []; 2517 groups[s][k].push(Warnings[i]); 2518 } 2519 return groups; 2520 } 2521 function groupWarningsByProject() { 2522 var groups = createArrayOfDictionaries(ProjectNames.length); 2523 for (var i=0; i<Warnings.length; i++) { 2524 var w = Warnings[i][0]; 2525 var p = Warnings[i][1]; 2526 var k = w.toString(); 2527 if (!(k in groups[p])) 2528 groups[p][k] = []; 2529 groups[p][k].push(Warnings[i]); 2530 } 2531 return groups; 2532 } 2533 var GlobalAnchor = 0; 2534 function createWarningSection(header, color, group) { 2535 var result = ""; 2536 var groupKeys = []; 2537 var totalMessages = 0; 2538 for (var k in group) { 2539 totalMessages += group[k].length; 2540 groupKeys.push([k, WarnPatternsSeverity[parseInt(k)], group[k].length]); 2541 } 2542 groupKeys.sort(bySeverityMessageCount); 2543 for (var idx=0; idx<groupKeys.length; idx++) { 2544 var k = groupKeys[idx][0]; 2545 var messages = group[k]; 2546 var w = parseInt(k); 2547 var wcolor = SeverityColors[WarnPatternsSeverity[w]]; 2548 var description = WarnPatternsDescription[w]; 2549 if (description.length == 0) 2550 description = "???"; 2551 GlobalAnchor += 1; 2552 result += "<table class='t1'><tr bgcolor='" + wcolor + "'><td>" + 2553 "<button class='bt' id='" + GlobalAnchor + "_mark" + 2554 "' onclick='expand(\\"" + GlobalAnchor + "\\");'>" + 2555 "⊕</button> " + 2556 description + " (" + messages.length + ")</td></tr></table>"; 2557 result += "<div id='" + GlobalAnchor + 2558 "' style='display:none;'><table class='t1'>"; 2559 var c = 0; 2560 messages.sort(compareMessages); 2561 for (var i=0; i<messages.length; i++) { 2562 result += "<tr><td class='c" + c + "'>" + 2563 addURL(WarningMessages[messages[i][2]]) + "</td></tr>"; 2564 c = 1 - c; 2565 } 2566 result += "</table></div>"; 2567 } 2568 if (result.length > 0) { 2569 return "<br><span style='background-color:" + color + "'><b>" + 2570 header + ": " + totalMessages + 2571 "</b></span><blockquote><table class='t1'>" + 2572 result + "</table></blockquote>"; 2573 2574 } 2575 return ""; // empty section 2576 } 2577 function generateSectionsBySeverity() { 2578 var result = ""; 2579 var groups = groupWarningsBySeverity(); 2580 for (s=0; s<SeverityColors.length; s++) { 2581 result += createWarningSection(SeverityHeaders[s], SeverityColors[s], groups[s]); 2582 } 2583 return result; 2584 } 2585 function generateSectionsByProject() { 2586 var result = ""; 2587 var groups = groupWarningsByProject(); 2588 for (i=0; i<groups.length; i++) { 2589 result += createWarningSection(ProjectNames[i], 'lightgrey', groups[i]); 2590 } 2591 return result; 2592 } 2593 function groupWarnings(generator) { 2594 GlobalAnchor = 0; 2595 var e = document.getElementById("warning_groups"); 2596 e.innerHTML = generator(); 2597 } 2598 function groupBySeverity() { 2599 groupWarnings(generateSectionsBySeverity); 2600 } 2601 function groupByProject() { 2602 groupWarnings(generateSectionsByProject); 2603 } 2604 """ 2605 2606 2607 # Emit a JavaScript const string 2608 def emit_const_string(name, value): 2609 print 'const ' + name + ' = "' + escape_string(value) + '";' 2610 2611 2612 # Emit a JavaScript const integer array. 2613 def emit_const_int_array(name, array): 2614 print 'const ' + name + ' = [' 2615 for n in array: 2616 print str(n) + ',' 2617 print '];' 2618 2619 2620 # Emit a JavaScript const string array. 2621 def emit_const_string_array(name, array): 2622 print 'const ' + name + ' = [' 2623 for s in array: 2624 print '"' + strip_escape_string(s) + '",' 2625 print '];' 2626 2627 2628 # Emit a JavaScript const object array. 2629 def emit_const_object_array(name, array): 2630 print 'const ' + name + ' = [' 2631 for x in array: 2632 print str(x) + ',' 2633 print '];' 2634 2635 2636 def emit_js_data(): 2637 """Dump dynamic HTML page's static JavaScript data.""" 2638 emit_const_string('FlagURL', args.url if args.url else '') 2639 emit_const_string('FlagSeparator', args.separator if args.separator else '') 2640 emit_const_string_array('SeverityColors', Severity.colors) 2641 emit_const_string_array('SeverityHeaders', Severity.headers) 2642 emit_const_string_array('SeverityColumnHeaders', Severity.column_headers) 2643 emit_const_string_array('ProjectNames', project_names) 2644 emit_const_int_array('WarnPatternsSeverity', 2645 [w['severity'] for w in warn_patterns]) 2646 emit_const_string_array('WarnPatternsDescription', 2647 [w['description'] for w in warn_patterns]) 2648 emit_const_string_array('WarnPatternsOption', 2649 [w['option'] for w in warn_patterns]) 2650 emit_const_string_array('WarningMessages', warning_messages) 2651 emit_const_object_array('Warnings', warning_records) 2652 2653 draw_table_javascript = """ 2654 google.charts.load('current', {'packages':['table']}); 2655 google.charts.setOnLoadCallback(drawTable); 2656 function drawTable() { 2657 var data = new google.visualization.DataTable(); 2658 data.addColumn('string', StatsHeader[0]); 2659 for (var i=1; i<StatsHeader.length; i++) { 2660 data.addColumn('number', StatsHeader[i]); 2661 } 2662 data.addRows(StatsRows); 2663 for (var i=0; i<StatsRows.length; i++) { 2664 for (var j=0; j<StatsHeader.length; j++) { 2665 data.setProperty(i, j, 'style', 'border:1px solid black;'); 2666 } 2667 } 2668 var table = new google.visualization.Table(document.getElementById('stats_table')); 2669 table.draw(data, {allowHtml: true, alternatingRowStyle: true}); 2670 } 2671 """ 2672 2673 2674 def dump_html(): 2675 """Dump the html output to stdout.""" 2676 dump_html_prologue('Warnings for ' + platform_version + ' - ' + 2677 target_product + ' - ' + target_variant) 2678 dump_stats() 2679 print '<br><div id="stats_table"></div><br>' 2680 print '\n<script>' 2681 emit_js_data() 2682 print scripts_for_warning_groups 2683 print '</script>' 2684 emit_buttons() 2685 # Warning messages are grouped by severities or project names. 2686 print '<br><div id="warning_groups"></div>' 2687 if args.byproject: 2688 print '<script>groupByProject();</script>' 2689 else: 2690 print '<script>groupBySeverity();</script>' 2691 dump_fixed() 2692 dump_html_epilogue() 2693 2694 2695 ##### Functions to count warnings and dump csv file. ######################### 2696 2697 2698 def description_for_csv(category): 2699 if not category['description']: 2700 return '?' 2701 return category['description'] 2702 2703 2704 def count_severity(writer, sev, kind): 2705 """Count warnings of given severity.""" 2706 total = 0 2707 for i in warn_patterns: 2708 if i['severity'] == sev and i['members']: 2709 n = len(i['members']) 2710 total += n 2711 warning = kind + ': ' + description_for_csv(i) 2712 writer.writerow([n, '', warning]) 2713 # print number of warnings for each project, ordered by project name. 2714 projects = i['projects'].keys() 2715 projects.sort() 2716 for p in projects: 2717 writer.writerow([i['projects'][p], p, warning]) 2718 writer.writerow([total, '', kind + ' warnings']) 2719 2720 return total 2721 2722 2723 # dump number of warnings in csv format to stdout 2724 def dump_csv(writer): 2725 """Dump number of warnings in csv format to stdout.""" 2726 sort_warnings() 2727 total = 0 2728 for s in Severity.range: 2729 total += count_severity(writer, s, Severity.column_headers[s]) 2730 writer.writerow([total, '', 'All warnings']) 2731 2732 2733 def main(): 2734 warning_lines = parse_input_file(open(args.buildlog, 'r')) 2735 parallel_classify_warnings(warning_lines) 2736 # If a user pases a csv path, save the fileoutput to the path 2737 # If the user also passed gencsv write the output to stdout 2738 # If the user did not pass gencsv flag dump the html report to stdout. 2739 if args.csvpath: 2740 with open(args.csvpath, 'w') as f: 2741 dump_csv(csv.writer(f, lineterminator='\n')) 2742 if args.gencsv: 2743 dump_csv(csv.writer(sys.stdout, lineterminator='\n')) 2744 else: 2745 dump_html() 2746 2747 2748 # Run main function if warn.py is the main program. 2749 if __name__ == '__main__': 2750 main() 2751