Home | History | Annotate | Download | only in tools
      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 cgi
     79 import csv
     80 import multiprocessing
     81 import os
     82 import re
     83 import signal
     84 import sys
     85 
     86 parser = argparse.ArgumentParser(description='Convert a build log into HTML')
     87 parser.add_argument('--csvpath',
     88                     help='Save CSV warning file to the passed absolute path',
     89                     default=None)
     90 parser.add_argument('--gencsv',
     91                     help='Generate a CSV file with number of various warnings',
     92                     action='store_true',
     93                     default=False)
     94 parser.add_argument('--byproject',
     95                     help='Separate warnings in HTML output by project names',
     96                     action='store_true',
     97                     default=False)
     98 parser.add_argument('--url',
     99                     help='Root URL of an Android source code tree prefixed '
    100                     'before files in warnings')
    101 parser.add_argument('--separator',
    102                     help='Separator between the end of a URL and the line '
    103                     'number argument. e.g. #')
    104 parser.add_argument('--processes',
    105                     type=int,
    106                     default=multiprocessing.cpu_count(),
    107                     help='Number of parallel processes to process warnings')
    108 parser.add_argument(dest='buildlog', metavar='build.log',
    109                     help='Path to build.log file')
    110 args = parser.parse_args()
    111 
    112 
    113 class Severity(object):
    114   """Severity levels and attributes."""
    115   # numbered by dump order
    116   FIXMENOW = 0
    117   HIGH = 1
    118   MEDIUM = 2
    119   LOW = 3
    120   ANALYZER = 4
    121   TIDY = 5
    122   HARMLESS = 6
    123   UNKNOWN = 7
    124   SKIP = 8
    125   range = range(SKIP + 1)
    126   attributes = [
    127       # pylint:disable=bad-whitespace
    128       ['fuchsia',   'FixNow',    'Critical warnings, fix me now'],
    129       ['red',       'High',      'High severity warnings'],
    130       ['orange',    'Medium',    'Medium severity warnings'],
    131       ['yellow',    'Low',       'Low severity warnings'],
    132       ['hotpink',   'Analyzer',  'Clang-Analyzer warnings'],
    133       ['peachpuff', 'Tidy',      'Clang-Tidy warnings'],
    134       ['limegreen', 'Harmless',  'Harmless warnings'],
    135       ['lightblue', 'Unknown',   'Unknown warnings'],
    136       ['grey',      'Unhandled', 'Unhandled warnings']
    137   ]
    138   colors = [a[0] for a in attributes]
    139   column_headers = [a[1] for a in attributes]
    140   headers = [a[2] for a in attributes]
    141 
    142 
    143 def tidy_warn_pattern(description, pattern):
    144   return {
    145       'category': 'C/C++',
    146       'severity': Severity.TIDY,
    147       'description': 'clang-tidy ' + description,
    148       'patterns': [r'.*: .+\[' + pattern + r'\]$']
    149   }
    150 
    151 
    152 def simple_tidy_warn_pattern(description):
    153   return tidy_warn_pattern(description, description)
    154 
    155 
    156 def group_tidy_warn_pattern(description):
    157   return tidy_warn_pattern(description, description + r'-.+')
    158 
    159 
    160 warn_patterns = [
    161     # pylint:disable=line-too-long,g-inconsistent-quotes
    162     {'category': 'C/C++', 'severity': Severity.ANALYZER,
    163      'description': 'clang-analyzer Security warning',
    164      'patterns': [r".*: warning: .+\[clang-analyzer-security.*\]"]},
    165     {'category': 'make', 'severity': Severity.MEDIUM,
    166      'description': 'make: overriding commands/ignoring old commands',
    167      'patterns': [r".*: warning: overriding commands for target .+",
    168                   r".*: warning: ignoring old commands for target .+"]},
    169     {'category': 'make', 'severity': Severity.HIGH,
    170      'description': 'make: LOCAL_CLANG is false',
    171      'patterns': [r".*: warning: LOCAL_CLANG is set to false"]},
    172     {'category': 'make', 'severity': Severity.HIGH,
    173      'description': 'SDK App using platform shared library',
    174      'patterns': [r".*: warning: .+ \(.*app:sdk.*\) should not link to .+ \(native:platform\)"]},
    175     {'category': 'make', 'severity': Severity.HIGH,
    176      'description': 'System module linking to a vendor module',
    177      'patterns': [r".*: warning: .+ \(.+\) should not link to .+ \(partition:.+\)"]},
    178     {'category': 'make', 'severity': Severity.MEDIUM,
    179      'description': 'Invalid SDK/NDK linking',
    180      'patterns': [r".*: warning: .+ \(.+\) should not link to .+ \(.+\)"]},
    181     {'category': 'make', 'severity': Severity.MEDIUM,
    182      'description': 'Duplicate header copy',
    183      'patterns': [r".*: warning: Duplicate header copy: .+"]},
    184     {'category': 'C/C++', 'severity': Severity.HIGH, 'option': '-Wimplicit-function-declaration',
    185      'description': 'Implicit function declaration',
    186      'patterns': [r".*: warning: implicit declaration of function .+",
    187                   r".*: warning: implicitly declaring library function"]},
    188     {'category': 'C/C++', 'severity': Severity.SKIP,
    189      'description': 'skip, conflicting types for ...',
    190      'patterns': [r".*: warning: conflicting types for '.+'"]},
    191     {'category': 'C/C++', 'severity': Severity.HIGH, 'option': '-Wtype-limits',
    192      'description': 'Expression always evaluates to true or false',
    193      'patterns': [r".*: warning: comparison is always .+ due to limited range of data type",
    194                   r".*: warning: comparison of unsigned .*expression .+ is always true",
    195                   r".*: warning: comparison of unsigned .*expression .+ is always false"]},
    196     {'category': 'C/C++', 'severity': Severity.HIGH,
    197      'description': 'Potential leak of memory, bad free, use after free',
    198      'patterns': [r".*: warning: Potential leak of memory",
    199                   r".*: warning: Potential memory leak",
    200                   r".*: warning: Memory allocated by alloca\(\) should not be deallocated",
    201                   r".*: warning: Memory allocated by .+ should be deallocated by .+ not .+",
    202                   r".*: warning: 'delete' applied to a pointer that was allocated",
    203                   r".*: warning: Use of memory after it is freed",
    204                   r".*: warning: Argument to .+ is the address of .+ variable",
    205                   r".*: warning: Argument to free\(\) is offset by .+ of memory allocated by",
    206                   r".*: warning: Attempt to .+ released memory"]},
    207     {'category': 'C/C++', 'severity': Severity.HIGH,
    208      'description': 'Use transient memory for control value',
    209      'patterns': [r".*: warning: .+Using such transient memory for the control value is .*dangerous."]},
    210     {'category': 'C/C++', 'severity': Severity.HIGH,
    211      'description': 'Return address of stack memory',
    212      'patterns': [r".*: warning: Address of stack memory .+ returned to caller",
    213                   r".*: warning: Address of stack memory .+ will be a dangling reference"]},
    214     {'category': 'C/C++', 'severity': Severity.HIGH,
    215      'description': 'Problem with vfork',
    216      'patterns': [r".*: warning: This .+ is prohibited after a successful vfork",
    217                   r".*: warning: Call to function '.+' is insecure "]},
    218     {'category': 'C/C++', 'severity': Severity.HIGH, 'option': 'infinite-recursion',
    219      'description': 'Infinite recursion',
    220      'patterns': [r".*: warning: all paths through this function will call itself"]},
    221     {'category': 'C/C++', 'severity': Severity.HIGH,
    222      'description': 'Potential buffer overflow',
    223      'patterns': [r".*: warning: Size argument is greater than .+ the destination buffer",
    224                   r".*: warning: Potential buffer overflow.",
    225                   r".*: warning: String copy function overflows destination buffer"]},
    226     {'category': 'C/C++', 'severity': Severity.MEDIUM,
    227      'description': 'Incompatible pointer types',
    228      'patterns': [r".*: warning: assignment from incompatible pointer type",
    229                   r".*: warning: return from incompatible pointer type",
    230                   r".*: warning: passing argument [0-9]+ of '.*' from incompatible pointer type",
    231                   r".*: warning: initialization from incompatible pointer type"]},
    232     {'category': 'C/C++', 'severity': Severity.HIGH, 'option': '-fno-builtin',
    233      'description': 'Incompatible declaration of built in function',
    234      'patterns': [r".*: warning: incompatible implicit declaration of built-in function .+"]},
    235     {'category': 'C/C++', 'severity': Severity.HIGH, 'option': '-Wincompatible-library-redeclaration',
    236      'description': 'Incompatible redeclaration of library function',
    237      'patterns': [r".*: warning: incompatible redeclaration of library function .+"]},
    238     {'category': 'C/C++', 'severity': Severity.HIGH,
    239      'description': 'Null passed as non-null argument',
    240      'patterns': [r".*: warning: Null passed to a callee that requires a non-null"]},
    241     {'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': '-Wunused-parameter',
    242      'description': 'Unused parameter',
    243      'patterns': [r".*: warning: unused parameter '.*'"]},
    244     {'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': '-Wunused',
    245      'description': 'Unused function, variable, label, comparison, etc.',
    246      'patterns': [r".*: warning: '.+' defined but not used",
    247                   r".*: warning: unused function '.+'",
    248                   r".*: warning: unused label '.+'",
    249                   r".*: warning: relational comparison result unused",
    250                   r".*: warning: lambda capture .* is not used",
    251                   r".*: warning: private field '.+' is not used",
    252                   r".*: warning: unused variable '.+'"]},
    253     {'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': '-Wunused-value',
    254      'description': 'Statement with no effect or result unused',
    255      'patterns': [r".*: warning: statement with no effect",
    256                   r".*: warning: expression result unused"]},
    257     {'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': '-Wunused-result',
    258      'description': 'Ignoreing return value of function',
    259      'patterns': [r".*: warning: ignoring return value of function .+Wunused-result"]},
    260     {'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': '-Wmissing-field-initializers',
    261      'description': 'Missing initializer',
    262      'patterns': [r".*: warning: missing initializer"]},
    263     {'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': '-Wdelete-non-virtual-dtor',
    264      'description': 'Need virtual destructor',
    265      'patterns': [r".*: warning: delete called .* has virtual functions but non-virtual destructor"]},
    266     {'category': 'cont.', 'severity': Severity.SKIP,
    267      'description': 'skip, near initialization for ...',
    268      'patterns': [r".*: warning: \(near initialization for '.+'\)"]},
    269     {'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': '-Wdate-time',
    270      'description': 'Expansion of data or time macro',
    271      'patterns': [r".*: warning: expansion of date or time macro is not reproducible"]},
    272     {'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': '-Wformat',
    273      'description': 'Format string does not match arguments',
    274      'patterns': [r".*: warning: format '.+' expects type '.+', but argument [0-9]+ has type '.+'",
    275                   r".*: warning: more '%' conversions than data arguments",
    276                   r".*: warning: data argument not used by format string",
    277                   r".*: warning: incomplete format specifier",
    278                   r".*: warning: unknown conversion type .* in format",
    279                   r".*: warning: format .+ expects .+ but argument .+Wformat=",
    280                   r".*: warning: field precision should have .+ but argument has .+Wformat",
    281                   r".*: warning: format specifies type .+ but the argument has .*type .+Wformat"]},
    282     {'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': '-Wformat-extra-args',
    283      'description': 'Too many arguments for format string',
    284      'patterns': [r".*: warning: too many arguments for format"]},
    285     {'category': 'C/C++', 'severity': Severity.MEDIUM,
    286      'description': 'Too many arguments in call',
    287      'patterns': [r".*: warning: too many arguments in call to "]},
    288     {'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': '-Wformat-invalid-specifier',
    289      'description': 'Invalid format specifier',
    290      'patterns': [r".*: warning: invalid .+ specifier '.+'.+format-invalid-specifier"]},
    291     {'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': '-Wsign-compare',
    292      'description': 'Comparison between signed and unsigned',
    293      'patterns': [r".*: warning: comparison between signed and unsigned",
    294                   r".*: warning: comparison of promoted \~unsigned with unsigned",
    295                   r".*: warning: signed and unsigned type in conditional expression"]},
    296     {'category': 'C/C++', 'severity': Severity.MEDIUM,
    297      'description': 'Comparison between enum and non-enum',
    298      'patterns': [r".*: warning: enumeral and non-enumeral type in conditional expression"]},
    299     {'category': 'libpng', 'severity': Severity.MEDIUM,
    300      'description': 'libpng: zero area',
    301      'patterns': [r".*libpng warning: Ignoring attempt to set cHRM RGB triangle with zero area"]},
    302     {'category': 'aapt', 'severity': Severity.MEDIUM,
    303      'description': 'aapt: no comment for public symbol',
    304      'patterns': [r".*: warning: No comment for public symbol .+"]},
    305     {'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': '-Wmissing-braces',
    306      'description': 'Missing braces around initializer',
    307      'patterns': [r".*: warning: missing braces around initializer.*"]},
    308     {'category': 'C/C++', 'severity': Severity.HARMLESS,
    309      'description': 'No newline at end of file',
    310      'patterns': [r".*: warning: no newline at end of file"]},
    311     {'category': 'C/C++', 'severity': Severity.HARMLESS,
    312      'description': 'Missing space after macro name',
    313      'patterns': [r".*: warning: missing whitespace after the macro name"]},
    314     {'category': 'C/C++', 'severity': Severity.LOW, 'option': '-Wcast-align',
    315      'description': 'Cast increases required alignment',
    316      'patterns': [r".*: warning: cast from .* to .* increases required alignment .*"]},
    317     {'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': '-Wcast-qual',
    318      'description': 'Qualifier discarded',
    319      'patterns': [r".*: warning: passing argument [0-9]+ of '.+' discards qualifiers from pointer target type",
    320                   r".*: warning: assignment discards qualifiers from pointer target type",
    321                   r".*: warning: passing .+ to parameter of type .+ discards qualifiers",
    322                   r".*: warning: assigning to .+ from .+ discards qualifiers",
    323                   r".*: warning: initializing .+ discards qualifiers .+types-discards-qualifiers",
    324                   r".*: warning: return discards qualifiers from pointer target type"]},
    325     {'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': '-Wunknown-attributes',
    326      'description': 'Unknown attribute',
    327      'patterns': [r".*: warning: unknown attribute '.+'"]},
    328     {'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': '-Wignored-attributes',
    329      'description': 'Attribute ignored',
    330      'patterns': [r".*: warning: '_*packed_*' attribute ignored",
    331                   r".*: warning: attribute declaration must precede definition .+ignored-attributes"]},
    332     {'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': '-Wvisibility',
    333      'description': 'Visibility problem',
    334      'patterns': [r".*: warning: declaration of '.+' will not be visible outside of this function"]},
    335     {'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': '-Wattributes',
    336      'description': 'Visibility mismatch',
    337      'patterns': [r".*: warning: '.+' declared with greater visibility than the type of its field '.+'"]},
    338     {'category': 'C/C++', 'severity': Severity.MEDIUM,
    339      'description': 'Shift count greater than width of type',
    340      'patterns': [r".*: warning: (left|right) shift count >= width of type"]},
    341     {'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': '-Wextern-initializer',
    342      'description': 'extern <foo> is initialized',
    343      'patterns': [r".*: warning: '.+' initialized and declared 'extern'",
    344                   r".*: warning: 'extern' variable has an initializer"]},
    345     {'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': '-Wold-style-declaration',
    346      'description': 'Old style declaration',
    347      'patterns': [r".*: warning: 'static' is not at beginning of declaration"]},
    348     {'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': '-Wreturn-type',
    349      'description': 'Missing return value',
    350      'patterns': [r".*: warning: control reaches end of non-void function"]},
    351     {'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': '-Wimplicit-int',
    352      'description': 'Implicit int type',
    353      'patterns': [r".*: warning: type specifier missing, defaults to 'int'",
    354                   r".*: warning: type defaults to 'int' in declaration of '.+'"]},
    355     {'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': '-Wmain-return-type',
    356      'description': 'Main function should return int',
    357      'patterns': [r".*: warning: return type of 'main' is not 'int'"]},
    358     {'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': '-Wuninitialized',
    359      'description': 'Variable may be used uninitialized',
    360      'patterns': [r".*: warning: '.+' may be used uninitialized in this function"]},
    361     {'category': 'C/C++', 'severity': Severity.HIGH, 'option': '-Wuninitialized',
    362      'description': 'Variable is used uninitialized',
    363      'patterns': [r".*: warning: '.+' is used uninitialized in this function",
    364                   r".*: warning: variable '.+' is uninitialized when used here"]},
    365     {'category': 'ld', 'severity': Severity.MEDIUM, 'option': '-fshort-enums',
    366      'description': 'ld: possible enum size mismatch',
    367      'patterns': [r".*: warning: .* uses variable-size enums yet the output is to use 32-bit enums; use of enum values across objects may fail"]},
    368     {'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': '-Wpointer-sign',
    369      'description': 'Pointer targets differ in signedness',
    370      'patterns': [r".*: warning: pointer targets in initialization differ in signedness",
    371                   r".*: warning: pointer targets in assignment differ in signedness",
    372                   r".*: warning: pointer targets in return differ in signedness",
    373                   r".*: warning: pointer targets in passing argument [0-9]+ of '.+' differ in signedness"]},
    374     {'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': '-Wstrict-overflow',
    375      'description': 'Assuming overflow does not occur',
    376      'patterns': [r".*: warning: assuming signed overflow does not occur when assuming that .* is always (true|false)"]},
    377     {'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': '-Wempty-body',
    378      'description': 'Suggest adding braces around empty body',
    379      'patterns': [r".*: warning: suggest braces around empty body in an 'if' statement",
    380                   r".*: warning: empty body in an if-statement",
    381                   r".*: warning: suggest braces around empty body in an 'else' statement",
    382                   r".*: warning: empty body in an else-statement"]},
    383     {'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': '-Wparentheses',
    384      'description': 'Suggest adding parentheses',
    385      'patterns': [r".*: warning: suggest explicit braces to avoid ambiguous 'else'",
    386                   r".*: warning: suggest parentheses around arithmetic in operand of '.+'",
    387                   r".*: warning: suggest parentheses around comparison in operand of '.+'",
    388                   r".*: warning: logical not is only applied to the left hand side of this comparison",
    389                   r".*: warning: using the result of an assignment as a condition without parentheses",
    390                   r".*: warning: .+ has lower precedence than .+ be evaluated first .+Wparentheses",
    391                   r".*: warning: suggest parentheses around '.+?' .+ '.+?'",
    392                   r".*: warning: suggest parentheses around assignment used as truth value"]},
    393     {'category': 'C/C++', 'severity': Severity.MEDIUM,
    394      'description': 'Static variable used in non-static inline function',
    395      'patterns': [r".*: warning: '.+' is static but used in inline function '.+' which is not static"]},
    396     {'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': '-Wimplicit int',
    397      'description': 'No type or storage class (will default to int)',
    398      'patterns': [r".*: warning: data definition has no type or storage class"]},
    399     {'category': 'C/C++', 'severity': Severity.MEDIUM,
    400      'description': 'Null pointer',
    401      'patterns': [r".*: warning: Dereference of null pointer",
    402                   r".*: warning: Called .+ pointer is null",
    403                   r".*: warning: Forming reference to null pointer",
    404                   r".*: warning: Returning null reference",
    405                   r".*: warning: Null pointer passed as an argument to a 'nonnull' parameter",
    406                   r".*: warning: .+ results in a null pointer dereference",
    407                   r".*: warning: Access to .+ results in a dereference of a null pointer",
    408                   r".*: warning: Null pointer argument in"]},
    409     {'category': 'cont.', 'severity': Severity.SKIP,
    410      'description': 'skip, parameter name (without types) in function declaration',
    411      'patterns': [r".*: warning: parameter names \(without types\) in function declaration"]},
    412     {'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': '-Wstrict-aliasing',
    413      'description': 'Dereferencing <foo> breaks strict aliasing rules',
    414      'patterns': [r".*: warning: dereferencing .* break strict-aliasing rules"]},
    415     {'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': '-Wpointer-to-int-cast',
    416      'description': 'Cast from pointer to integer of different size',
    417      'patterns': [r".*: warning: cast from pointer to integer of different size",
    418                   r".*: warning: initialization makes pointer from integer without a cast"]},
    419     {'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': '-Wint-to-pointer-cast',
    420      'description': 'Cast to pointer from integer of different size',
    421      'patterns': [r".*: warning: cast to pointer from integer of different size"]},
    422     {'category': 'C/C++', 'severity': Severity.MEDIUM,
    423      'description': 'Symbol redefined',
    424      'patterns': [r".*: warning: "".+"" redefined"]},
    425     {'category': 'cont.', 'severity': Severity.SKIP,
    426      'description': 'skip, ... location of the previous definition',
    427      'patterns': [r".*: warning: this is the location of the previous definition"]},
    428     {'category': 'ld', 'severity': Severity.MEDIUM,
    429      'description': 'ld: type and size of dynamic symbol are not defined',
    430      'patterns': [r".*: warning: type and size of dynamic symbol `.+' are not defined"]},
    431     {'category': 'C/C++', 'severity': Severity.MEDIUM,
    432      'description': 'Pointer from integer without cast',
    433      'patterns': [r".*: warning: assignment makes pointer from integer without a cast"]},
    434     {'category': 'C/C++', 'severity': Severity.MEDIUM,
    435      'description': 'Pointer from integer without cast',
    436      'patterns': [r".*: warning: passing argument [0-9]+ of '.+' makes pointer from integer without a cast"]},
    437     {'category': 'C/C++', 'severity': Severity.MEDIUM,
    438      'description': 'Integer from pointer without cast',
    439      'patterns': [r".*: warning: assignment makes integer from pointer without a cast"]},
    440     {'category': 'C/C++', 'severity': Severity.MEDIUM,
    441      'description': 'Integer from pointer without cast',
    442      'patterns': [r".*: warning: passing argument [0-9]+ of '.+' makes integer from pointer without a cast"]},
    443     {'category': 'C/C++', 'severity': Severity.MEDIUM,
    444      'description': 'Integer from pointer without cast',
    445      'patterns': [r".*: warning: return makes integer from pointer without a cast"]},
    446     {'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': '-Wunknown-pragmas',
    447      'description': 'Ignoring pragma',
    448      'patterns': [r".*: warning: ignoring #pragma .+"]},
    449     {'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': '-W#pragma-messages',
    450      'description': 'Pragma warning messages',
    451      'patterns': [r".*: warning: .+W#pragma-messages"]},
    452     {'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': '-Wclobbered',
    453      'description': 'Variable might be clobbered by longjmp or vfork',
    454      'patterns': [r".*: warning: variable '.+' might be clobbered by 'longjmp' or 'vfork'"]},
    455     {'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': '-Wclobbered',
    456      'description': 'Argument might be clobbered by longjmp or vfork',
    457      'patterns': [r".*: warning: argument '.+' might be clobbered by 'longjmp' or 'vfork'"]},
    458     {'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': '-Wredundant-decls',
    459      'description': 'Redundant declaration',
    460      'patterns': [r".*: warning: redundant redeclaration of '.+'"]},
    461     {'category': 'cont.', 'severity': Severity.SKIP,
    462      'description': 'skip, previous declaration ... was here',
    463      'patterns': [r".*: warning: previous declaration of '.+' was here"]},
    464     {'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': '-Wswitch-enum',
    465      'description': 'Enum value not handled in switch',
    466      'patterns': [r".*: warning: .*enumeration value.* not handled in switch.+Wswitch"]},
    467     {'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': '-Wuser-defined-warnings',
    468      'description': 'User defined warnings',
    469      'patterns': [r".*: warning: .* \[-Wuser-defined-warnings\]$"]},
    470     {'category': 'java', 'severity': Severity.MEDIUM, 'option': '-encoding',
    471      'description': 'Java: Non-ascii characters used, but ascii encoding specified',
    472      'patterns': [r".*: warning: unmappable character for encoding ascii"]},
    473     {'category': 'java', 'severity': Severity.MEDIUM,
    474      'description': 'Java: Non-varargs call of varargs method with inexact argument type for last parameter',
    475      'patterns': [r".*: warning: non-varargs call of varargs method with inexact argument type for last parameter"]},
    476     {'category': 'java', 'severity': Severity.MEDIUM,
    477      'description': 'Java: Unchecked method invocation',
    478      'patterns': [r".*: warning: \[unchecked\] unchecked method invocation: .+ in class .+"]},
    479     {'category': 'java', 'severity': Severity.MEDIUM,
    480      'description': 'Java: Unchecked conversion',
    481      'patterns': [r".*: warning: \[unchecked\] unchecked conversion"]},
    482     {'category': 'java', 'severity': Severity.MEDIUM,
    483      'description': '_ used as an identifier',
    484      'patterns': [r".*: warning: '_' used as an identifier"]},
    485     {'category': 'java', 'severity': Severity.HIGH,
    486      'description': 'Use of internal proprietary API',
    487      'patterns': [r".*: warning: .* is internal proprietary API and may be removed"]},
    488 
    489     # Warnings from Javac
    490     {'category': 'java',
    491      'severity': Severity.MEDIUM,
    492      'description': 'Java: Use of deprecated member',
    493      'patterns': [r'.*: warning: \[deprecation\] .+']},
    494     {'category': 'java',
    495      'severity': Severity.MEDIUM,
    496      'description': 'Java: Unchecked conversion',
    497      'patterns': [r'.*: warning: \[unchecked\] .+']},
    498 
    499     # Begin warnings generated by Error Prone
    500     {'category': 'java',
    501      'severity': Severity.LOW,
    502      'description':
    503          'Java: Use parameter comments to document ambiguous literals',
    504      'patterns': [r".*: warning: \[BooleanParameter\] .+"]},
    505     {'category': 'java',
    506      'severity': Severity.LOW,
    507      'description':
    508          'Java: This class\'s name looks like a Type Parameter.',
    509      'patterns': [r".*: warning: \[ClassNamedLikeTypeParameter\] .+"]},
    510     {'category': 'java',
    511      'severity': Severity.LOW,
    512      'description':
    513          'Java: Field name is CONSTANT_CASE, but field is not static and final',
    514      'patterns': [r".*: warning: \[ConstantField\] .+"]},
    515     {'category': 'java',
    516      'severity': Severity.LOW,
    517      'description':
    518          'Java: @Multibinds is a more efficient and declarative mechanism for ensuring that a set multibinding is present in the graph.',
    519      'patterns': [r".*: warning: \[EmptySetMultibindingContributions\] .+"]},
    520     {'category': 'java',
    521      'severity': Severity.LOW,
    522      'description':
    523          'Java: Prefer assertThrows to ExpectedException',
    524      'patterns': [r".*: warning: \[ExpectedExceptionRefactoring\] .+"]},
    525     {'category': 'java',
    526      'severity': Severity.LOW,
    527      'description':
    528          'Java: This field is only assigned during initialization; consider making it final',
    529      'patterns': [r".*: warning: \[FieldCanBeFinal\] .+"]},
    530     {'category': 'java',
    531      'severity': Severity.LOW,
    532      'description':
    533          'Java: Fields that can be null should be annotated @Nullable',
    534      'patterns': [r".*: warning: \[FieldMissingNullable\] .+"]},
    535     {'category': 'java',
    536      'severity': Severity.LOW,
    537      'description':
    538          'Java: Refactors uses of the JSR 305 @Immutable to Error Prone\'s annotation',
    539      'patterns': [r".*: warning: \[ImmutableRefactoring\] .+"]},
    540     {'category': 'java',
    541      'severity': Severity.LOW,
    542      'description':
    543          'Java: Use Java\'s utility functional interfaces instead of Function\u003cA, B> for primitive types.',
    544      'patterns': [r".*: warning: \[LambdaFunctionalInterface\] .+"]},
    545     {'category': 'java',
    546      'severity': Severity.LOW,
    547      'description':
    548          'Java: A private method that does not reference the enclosing instance can be static',
    549      'patterns': [r".*: warning: \[MethodCanBeStatic\] .+"]},
    550     {'category': 'java',
    551      'severity': Severity.LOW,
    552      'description':
    553          'Java: C-style array declarations should not be used',
    554      'patterns': [r".*: warning: \[MixedArrayDimensions\] .+"]},
    555     {'category': 'java',
    556      'severity': Severity.LOW,
    557      'description':
    558          'Java: Variable declarations should declare only one variable',
    559      'patterns': [r".*: warning: \[MultiVariableDeclaration\] .+"]},
    560     {'category': 'java',
    561      'severity': Severity.LOW,
    562      'description':
    563          'Java: Source files should not contain multiple top-level class declarations',
    564      'patterns': [r".*: warning: \[MultipleTopLevelClasses\] .+"]},
    565     {'category': 'java',
    566      'severity': Severity.LOW,
    567      'description':
    568          'Java: Avoid having multiple unary operators acting on the same variable in a method call',
    569      'patterns': [r".*: warning: \[MultipleUnaryOperatorsInMethodCall\] .+"]},
    570     {'category': 'java',
    571      'severity': Severity.LOW,
    572      'description':
    573          'Java: Package names should match the directory they are declared in',
    574      'patterns': [r".*: warning: \[PackageLocation\] .+"]},
    575     {'category': 'java',
    576      'severity': Severity.LOW,
    577      'description':
    578          'Java: Non-standard parameter comment; prefer `/* paramName= */ arg`',
    579      'patterns': [r".*: warning: \[ParameterComment\] .+"]},
    580     {'category': 'java',
    581      'severity': Severity.LOW,
    582      'description':
    583          'Java: Method parameters that aren\'t checked for null shouldn\'t be annotated @Nullable',
    584      'patterns': [r".*: warning: \[ParameterNotNullable\] .+"]},
    585     {'category': 'java',
    586      'severity': Severity.LOW,
    587      'description':
    588          'Java: Add a private constructor to modules that will not be instantiated by Dagger.',
    589      'patterns': [r".*: warning: \[PrivateConstructorForNoninstantiableModule\] .+"]},
    590     {'category': 'java',
    591      'severity': Severity.LOW,
    592      'description':
    593          'Java: Utility classes (only static members) are not designed to be instantiated and should be made noninstantiable with a default constructor.',
    594      'patterns': [r".*: warning: \[PrivateConstructorForUtilityClass\] .+"]},
    595     {'category': 'java',
    596      'severity': Severity.LOW,
    597      'description':
    598          'Java: Unused imports',
    599      'patterns': [r".*: warning: \[RemoveUnusedImports\] .+"]},
    600     {'category': 'java',
    601      'severity': Severity.LOW,
    602      'description':
    603          'Java: Methods that can return null should be annotated @Nullable',
    604      'patterns': [r".*: warning: \[ReturnMissingNullable\] .+"]},
    605     {'category': 'java',
    606      'severity': Severity.LOW,
    607      'description':
    608          'Java: Scopes on modules have no function and will soon be an error.',
    609      'patterns': [r".*: warning: \[ScopeOnModule\] .+"]},
    610     {'category': 'java',
    611      'severity': Severity.LOW,
    612      'description':
    613          'Java: The default case of a switch should appear at the end of the last statement group',
    614      'patterns': [r".*: warning: \[SwitchDefault\] .+"]},
    615     {'category': 'java',
    616      'severity': Severity.LOW,
    617      'description':
    618          'Java: Prefer assertThrows to @Test(expected=...)',
    619      'patterns': [r".*: warning: \[TestExceptionRefactoring\] .+"]},
    620     {'category': 'java',
    621      'severity': Severity.LOW,
    622      'description':
    623          'Java: Unchecked exceptions do not need to be declared in the method signature.',
    624      'patterns': [r".*: warning: \[ThrowsUncheckedException\] .+"]},
    625     {'category': 'java',
    626      'severity': Severity.LOW,
    627      'description':
    628          'Java: Prefer assertThrows to try/fail',
    629      'patterns': [r".*: warning: \[TryFailRefactoring\] .+"]},
    630     {'category': 'java',
    631      'severity': Severity.LOW,
    632      'description':
    633          'Java: Type parameters must be a single letter with an optional numeric suffix, or an UpperCamelCase name followed by the letter \'T\'.',
    634      'patterns': [r".*: warning: \[TypeParameterNaming\] .+"]},
    635     {'category': 'java',
    636      'severity': Severity.LOW,
    637      'description':
    638          'Java: Constructors and methods with the same name should appear sequentially with no other code in between. Please re-order or re-name methods.',
    639      'patterns': [r".*: warning: \[UngroupedOverloads\] .+"]},
    640     {'category': 'java',
    641      'severity': Severity.LOW,
    642      'description':
    643          'Java: Unnecessary call to NullPointerTester#setDefault',
    644      'patterns': [r".*: warning: \[UnnecessarySetDefault\] .+"]},
    645     {'category': 'java',
    646      'severity': Severity.LOW,
    647      'description':
    648          'Java: Using static imports for types is unnecessary',
    649      'patterns': [r".*: warning: \[UnnecessaryStaticImport\] .+"]},
    650     {'category': 'java',
    651      'severity': Severity.LOW,
    652      'description':
    653          'Java: @Binds is a more efficient and declarative mechanism for delegating a binding.',
    654      'patterns': [r".*: warning: \[UseBinds\] .+"]},
    655     {'category': 'java',
    656      'severity': Severity.LOW,
    657      'description':
    658          'Java: Wildcard imports, static or otherwise, should not be used',
    659      'patterns': [r".*: warning: \[WildcardImport\] .+"]},
    660     {'category': 'java',
    661      'severity': Severity.MEDIUM,
    662      'description':
    663          'Java: Method reference is ambiguous',
    664      'patterns': [r".*: warning: \[AmbiguousMethodReference\] .+"]},
    665     {'category': 'java',
    666      'severity': Severity.MEDIUM,
    667      'description':
    668          'Java: This method passes a pair of parameters through to String.format, but the enclosing method wasn\'t annotated @FormatMethod. Doing so gives compile-time rather than run-time protection against malformed format strings.',
    669      'patterns': [r".*: warning: \[AnnotateFormatMethod\] .+"]},
    670     {'category': 'java',
    671      'severity': Severity.MEDIUM,
    672      'description':
    673          'Java: Annotations should be positioned after Javadocs, but before modifiers..',
    674      'patterns': [r".*: warning: \[AnnotationPosition\] .+"]},
    675     {'category': 'java',
    676      'severity': Severity.MEDIUM,
    677      'description':
    678          'Java: Arguments are in the wrong order or could be commented for clarity.',
    679      'patterns': [r".*: warning: \[ArgumentSelectionDefectChecker\] .+"]},
    680     {'category': 'java',
    681      'severity': Severity.MEDIUM,
    682      'description':
    683          'Java: Arrays do not override equals() or hashCode, so comparisons will be done on reference equality only. If neither deduplication nor lookup are needed, consider using a List instead. Otherwise, use IdentityHashMap/Set, a Map from a library that handles object arrays, or an Iterable/List of pairs.',
    684      'patterns': [r".*: warning: \[ArrayAsKeyOfSetOrMap\] .+"]},
    685     {'category': 'java',
    686      'severity': Severity.MEDIUM,
    687      'description':
    688          'Java: Arguments are swapped in assertEquals-like call',
    689      'patterns': [r".*: warning: \[AssertEqualsArgumentOrderChecker\] .+"]},
    690     {'category': 'java',
    691      'severity': Severity.MEDIUM,
    692      'description':
    693          'Java: Assertions may be disabled at runtime and do not guarantee that execution will halt here; consider throwing an exception instead',
    694      'patterns': [r".*: warning: \[AssertFalse\] .+"]},
    695     {'category': 'java',
    696      'severity': Severity.MEDIUM,
    697      'description':
    698          'Java: The lambda passed to assertThrows should contain exactly one statement',
    699      'patterns': [r".*: warning: \[AssertThrowsMultipleStatements\] .+"]},
    700     {'category': 'java',
    701      'severity': Severity.MEDIUM,
    702      'description':
    703          'Java: This assertion throws an AssertionError if it fails, which will be caught by an enclosing try block.',
    704      'patterns': [r".*: warning: \[AssertionFailureIgnored\] .+"]},
    705     {'category': 'java',
    706      'severity': Severity.MEDIUM,
    707      'description':
    708          'Java: @AssistedInject and @Inject should not be used on different constructors in the same class.',
    709      'patterns': [r".*: warning: \[AssistedInjectAndInjectOnConstructors\] .+"]},
    710     {'category': 'java',
    711      'severity': Severity.MEDIUM,
    712      'description':
    713          'Java: Make toString(), hashCode() and equals() final in AutoValue classes, so it is clear to readers that AutoValue is not overriding them',
    714      'patterns': [r".*: warning: \[AutoValueFinalMethods\] .+"]},
    715     {'category': 'java',
    716      'severity': Severity.MEDIUM,
    717      'description':
    718          'Java: Classes that implement Annotation must override equals and hashCode. Consider using AutoAnnotation instead of implementing Annotation by hand.',
    719      'patterns': [r".*: warning: \[BadAnnotationImplementation\] .+"]},
    720     {'category': 'java',
    721      'severity': Severity.MEDIUM,
    722      'description':
    723          'Java: Possible sign flip from narrowing conversion',
    724      'patterns': [r".*: warning: \[BadComparable\] .+"]},
    725     {'category': 'java',
    726      'severity': Severity.MEDIUM,
    727      'description':
    728          'Java: Importing nested classes/static methods/static fields with commonly-used names can make code harder to read, because it may not be clear from the context exactly which type is being referred to. Qualifying the name with that of the containing class can make the code clearer.',
    729      'patterns': [r".*: warning: \[BadImport\] .+"]},
    730     {'category': 'java',
    731      'severity': Severity.MEDIUM,
    732      'description':
    733          'Java: instanceof used in a way that is equivalent to a null check.',
    734      'patterns': [r".*: warning: \[BadInstanceof\] .+"]},
    735     {'category': 'java',
    736      'severity': Severity.MEDIUM,
    737      'description':
    738          'Java: BigDecimal#equals has surprising behavior: it also compares scale.',
    739      'patterns': [r".*: warning: \[BigDecimalEquals\] .+"]},
    740     {'category': 'java',
    741      'severity': Severity.MEDIUM,
    742      'description':
    743          'Java: new BigDecimal(double) loses precision in this case.',
    744      'patterns': [r".*: warning: \[BigDecimalLiteralDouble\] .+"]},
    745     {'category': 'java',
    746      'severity': Severity.MEDIUM,
    747      'description':
    748          'Java: A call to Binder.clearCallingIdentity() should be followed by Binder.restoreCallingIdentity() in a finally block. Otherwise the wrong Binder identity may be used by subsequent code.',
    749      'patterns': [r".*: warning: \[BinderIdentityRestoredDangerously\] .+"]},
    750     {'category': 'java',
    751      'severity': Severity.MEDIUM,
    752      'description':
    753          'Java: This code declares a binding for a common value type without a Qualifier annotation.',
    754      'patterns': [r".*: warning: \[BindingToUnqualifiedCommonType\] .+"]},
    755     {'category': 'java',
    756      'severity': Severity.MEDIUM,
    757      'description':
    758          'Java: valueOf or autoboxing provides better time and space performance',
    759      'patterns': [r".*: warning: \[BoxedPrimitiveConstructor\] .+"]},
    760     {'category': 'java',
    761      'severity': Severity.MEDIUM,
    762      'description':
    763          'Java: ByteBuffer.array() shouldn\'t be called unless ByteBuffer.arrayOffset() is used or if the ByteBuffer was initialized using ByteBuffer.wrap() or ByteBuffer.allocate().',
    764      'patterns': [r".*: warning: \[ByteBufferBackingArray\] .+"]},
    765     {'category': 'java',
    766      'severity': Severity.MEDIUM,
    767      'description':
    768          'Java: Mockito cannot mock final classes',
    769      'patterns': [r".*: warning: \[CannotMockFinalClass\] .+"]},
    770     {'category': 'java',
    771      'severity': Severity.MEDIUM,
    772      'description':
    773          'Java: Duration can be expressed more clearly with different units',
    774      'patterns': [r".*: warning: \[CanonicalDuration\] .+"]},
    775     {'category': 'java',
    776      'severity': Severity.MEDIUM,
    777      'description':
    778          'Java: Logging or rethrowing exceptions should usually be preferred to catching and calling printStackTrace',
    779      'patterns': [r".*: warning: \[CatchAndPrintStackTrace\] .+"]},
    780     {'category': 'java',
    781      'severity': Severity.MEDIUM,
    782      'description':
    783          'Java: Ignoring exceptions and calling fail() is unnecessary, and makes test output less useful',
    784      'patterns': [r".*: warning: \[CatchFail\] .+"]},
    785     {'category': 'java',
    786      'severity': Severity.MEDIUM,
    787      'description':
    788          'Java: Inner class is non-static but does not reference enclosing class',
    789      'patterns': [r".*: warning: \[ClassCanBeStatic\] .+"]},
    790     {'category': 'java',
    791      'severity': Severity.MEDIUM,
    792      'description':
    793          'Java: Class.newInstance() bypasses exception checking; prefer getDeclaredConstructor().newInstance()',
    794      'patterns': [r".*: warning: \[ClassNewInstance\] .+"]},
    795     {'category': 'java',
    796      'severity': Severity.MEDIUM,
    797      'description':
    798          'Java: Providing Closeable resources makes their lifecycle unclear',
    799      'patterns': [r".*: warning: \[CloseableProvides\] .+"]},
    800     {'category': 'java',
    801      'severity': Severity.MEDIUM,
    802      'description':
    803          'Java: The type of the array parameter of Collection.toArray needs to be compatible with the array type',
    804      'patterns': [r".*: warning: \[CollectionToArraySafeParameter\] .+"]},
    805     {'category': 'java',
    806      'severity': Severity.MEDIUM,
    807      'description':
    808          'Java: Collector.of() should not use state',
    809      'patterns': [r".*: warning: \[CollectorShouldNotUseState\] .+"]},
    810     {'category': 'java',
    811      'severity': Severity.MEDIUM,
    812      'description':
    813          'Java: Class should not implement both `Comparable` and `Comparator`',
    814      'patterns': [r".*: warning: \[ComparableAndComparator\] .+"]},
    815     {'category': 'java',
    816      'severity': Severity.MEDIUM,
    817      'description':
    818          'Java: Constructors should not invoke overridable methods.',
    819      'patterns': [r".*: warning: \[ConstructorInvokesOverridable\] .+"]},
    820     {'category': 'java',
    821      'severity': Severity.MEDIUM,
    822      'description':
    823          'Java: Constructors should not pass the \'this\' reference out in method invocations, since the object may not be fully constructed.',
    824      'patterns': [r".*: warning: \[ConstructorLeaksThis\] .+"]},
    825     {'category': 'java',
    826      'severity': Severity.MEDIUM,
    827      'description':
    828          'Java: DateFormat is not thread-safe, and should not be used as a constant field.',
    829      'patterns': [r".*: warning: \[DateFormatConstant\] .+"]},
    830     {'category': 'java',
    831      'severity': Severity.MEDIUM,
    832      'description':
    833          'Java: Implicit use of the platform default charset, which can result in differing behaviour between JVM executions or incorrect behavior if the encoding of the data source doesn\'t match expectations.',
    834      'patterns': [r".*: warning: \[DefaultCharset\] .+"]},
    835     {'category': 'java',
    836      'severity': Severity.MEDIUM,
    837      'description':
    838          'Java: Avoid deprecated Thread methods; read the method\'s javadoc for details.',
    839      'patterns': [r".*: warning: \[DeprecatedThreadMethods\] .+"]},
    840     {'category': 'java',
    841      'severity': Severity.MEDIUM,
    842      'description':
    843          'Java: Prefer collection factory methods or builders to the double-brace initialization pattern.',
    844      'patterns': [r".*: warning: \[DoubleBraceInitialization\] .+"]},
    845     {'category': 'java',
    846      'severity': Severity.MEDIUM,
    847      'description':
    848          'Java: Double-checked locking on non-volatile fields is unsafe',
    849      'patterns': [r".*: warning: \[DoubleCheckedLocking\] .+"]},
    850     {'category': 'java',
    851      'severity': Severity.MEDIUM,
    852      'description':
    853          'Java: Empty top-level type declaration',
    854      'patterns': [r".*: warning: \[EmptyTopLevelDeclaration\] .+"]},
    855     {'category': 'java',
    856      'severity': Severity.MEDIUM,
    857      'description':
    858          'Java: equals() implementation may throw NullPointerException when given null',
    859      'patterns': [r".*: warning: \[EqualsBrokenForNull\] .+"]},
    860     {'category': 'java',
    861      'severity': Severity.MEDIUM,
    862      'description':
    863          'Java: Overriding Object#equals in a non-final class by using getClass rather than instanceof breaks substitutability of subclasses.',
    864      'patterns': [r".*: warning: \[EqualsGetClass\] .+"]},
    865     {'category': 'java',
    866      'severity': Severity.MEDIUM,
    867      'description':
    868          'Java: Classes that override equals should also override hashCode.',
    869      'patterns': [r".*: warning: \[EqualsHashCode\] .+"]},
    870     {'category': 'java',
    871      'severity': Severity.MEDIUM,
    872      'description':
    873          'Java: An equality test between objects with incompatible types always returns false',
    874      'patterns': [r".*: warning: \[EqualsIncompatibleType\] .+"]},
    875     {'category': 'java',
    876      'severity': Severity.MEDIUM,
    877      'description':
    878          'Java: The contract of #equals states that it should return false for incompatible types, while this implementation may throw ClassCastException.',
    879      'patterns': [r".*: warning: \[EqualsUnsafeCast\] .+"]},
    880     {'category': 'java',
    881      'severity': Severity.MEDIUM,
    882      'description':
    883          'Java: Implementing #equals by just comparing hashCodes is fragile. Hashes collide frequently, and this will lead to false positives in #equals.',
    884      'patterns': [r".*: warning: \[EqualsUsingHashCode\] .+"]},
    885     {'category': 'java',
    886      'severity': Severity.MEDIUM,
    887      'description':
    888          'Java: Calls to ExpectedException#expect should always be followed by exactly one statement.',
    889      'patterns': [r".*: warning: \[ExpectedExceptionChecker\] .+"]},
    890     {'category': 'java',
    891      'severity': Severity.MEDIUM,
    892      'description':
    893          'Java: When only using JUnit Assert\'s static methods, you should import statically instead of extending.',
    894      'patterns': [r".*: warning: \[ExtendingJUnitAssert\] .+"]},
    895     {'category': 'java',
    896      'severity': Severity.MEDIUM,
    897      'description':
    898          'Java: Switch case may fall through',
    899      'patterns': [r".*: warning: \[FallThrough\] .+"]},
    900     {'category': 'java',
    901      'severity': Severity.MEDIUM,
    902      'description':
    903          '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.',
    904      'patterns': [r".*: warning: \[Finally\] .+"]},
    905     {'category': 'java',
    906      'severity': Severity.MEDIUM,
    907      'description':
    908          'Java: Use parentheses to make the precedence explicit',
    909      'patterns': [r".*: warning: \[FloatCast\] .+"]},
    910     {'category': 'java',
    911      'severity': Severity.MEDIUM,
    912      'description':
    913          'Java: This fuzzy equality check is using a tolerance less than the gap to the next number. You may want a less restrictive tolerance, or to assert equality.',
    914      'patterns': [r".*: warning: \[FloatingPointAssertionWithinEpsilon\] .+"]},
    915     {'category': 'java',
    916      'severity': Severity.MEDIUM,
    917      'description':
    918          'Java: Floating point literal loses precision',
    919      'patterns': [r".*: warning: \[FloatingPointLiteralPrecision\] .+"]},
    920     {'category': 'java',
    921      'severity': Severity.MEDIUM,
    922      'description':
    923          'Java: Classes extending PreferenceActivity must implement isValidFragment such that it does not unconditionally return true to prevent vulnerability to fragment injection attacks.',
    924      'patterns': [r".*: warning: \[FragmentInjection\] .+"]},
    925     {'category': 'java',
    926      'severity': Severity.MEDIUM,
    927      'description':
    928          'Java: Subclasses of Fragment must be instantiable via Class#newInstance(): the class must be public, static and have a public nullary constructor',
    929      'patterns': [r".*: warning: \[FragmentNotInstantiable\] .+"]},
    930     {'category': 'java',
    931      'severity': Severity.MEDIUM,
    932      'description':
    933          'Java: Overloads will be ambiguous when passing lambda arguments',
    934      'patterns': [r".*: warning: \[FunctionalInterfaceClash\] .+"]},
    935     {'category': 'java',
    936      'severity': Severity.MEDIUM,
    937      'description':
    938          'Java: Return value of methods returning Future must be checked. Ignoring returned Futures suppresses exceptions thrown from the code that completes the Future.',
    939      'patterns': [r".*: warning: \[FutureReturnValueIgnored\] .+"]},
    940     {'category': 'java',
    941      'severity': Severity.MEDIUM,
    942      'description':
    943          'Java: Calling getClass() on an enum may return a subclass of the enum type',
    944      'patterns': [r".*: warning: \[GetClassOnEnum\] .+"]},
    945     {'category': 'java',
    946      'severity': Severity.MEDIUM,
    947      'description':
    948          'Java: Hardcoded reference to /sdcard',
    949      'patterns': [r".*: warning: \[HardCodedSdCardPath\] .+"]},
    950     {'category': 'java',
    951      'severity': Severity.MEDIUM,
    952      'description':
    953          'Java: Hiding fields of superclasses may cause confusion and errors',
    954      'patterns': [r".*: warning: \[HidingField\] .+"]},
    955     {'category': 'java',
    956      'severity': Severity.MEDIUM,
    957      'description':
    958          'Java: Annotations should always be immutable',
    959      'patterns': [r".*: warning: \[ImmutableAnnotationChecker\] .+"]},
    960     {'category': 'java',
    961      'severity': Severity.MEDIUM,
    962      'description':
    963          'Java: Enums should always be immutable',
    964      'patterns': [r".*: warning: \[ImmutableEnumChecker\] .+"]},
    965     {'category': 'java',
    966      'severity': Severity.MEDIUM,
    967      'description':
    968          'Java: This annotation has incompatible modifiers as specified by its @IncompatibleModifiers annotation',
    969      'patterns': [r".*: warning: \[IncompatibleModifiers\] .+"]},
    970     {'category': 'java',
    971      'severity': Severity.MEDIUM,
    972      'description':
    973          'Java: It is confusing to have a field and a parameter under the same scope that differ only in capitalization.',
    974      'patterns': [r".*: warning: \[InconsistentCapitalization\] .+"]},
    975     {'category': 'java',
    976      'severity': Severity.MEDIUM,
    977      'description':
    978          'Java: Including fields in hashCode which are not compared in equals violates the contract of hashCode.',
    979      'patterns': [r".*: warning: \[InconsistentHashCode\] .+"]},
    980     {'category': 'java',
    981      'severity': Severity.MEDIUM,
    982      'description':
    983          'Java: The ordering of parameters in overloaded methods should be as consistent as possible (when viewed from left to right)',
    984      'patterns': [r".*: warning: \[InconsistentOverloads\] .+"]},
    985     {'category': 'java',
    986      'severity': Severity.MEDIUM,
    987      'description':
    988          'Java: This for loop increments the same variable in the header and in the body',
    989      'patterns': [r".*: warning: \[IncrementInForLoopAndHeader\] .+"]},
    990     {'category': 'java',
    991      'severity': Severity.MEDIUM,
    992      'description':
    993          'Java: Constructors on abstract classes are never directly @Injected, only the constructors of their subclasses can be @Inject\'ed.',
    994      'patterns': [r".*: warning: \[InjectOnConstructorOfAbstractClass\] .+"]},
    995     {'category': 'java',
    996      'severity': Severity.MEDIUM,
    997      'description':
    998          'Java: Please also override int read(byte[], int, int), otherwise multi-byte reads from this input stream are likely to be slow.',
    999      'patterns': [r".*: warning: \[InputStreamSlowMultibyteRead\] .+"]},
   1000     {'category': 'java',
   1001      'severity': Severity.MEDIUM,
   1002      'description':
   1003          'Java: Casting inside an if block should be plausibly consistent with the instanceof type',
   1004      'patterns': [r".*: warning: \[InstanceOfAndCastMatchWrongType\] .+"]},
   1005     {'category': 'java',
   1006      'severity': Severity.MEDIUM,
   1007      'description':
   1008          'Java: Expression of type int may overflow before being assigned to a long',
   1009      'patterns': [r".*: warning: \[IntLongMath\] .+"]},
   1010     {'category': 'java',
   1011      'severity': Severity.MEDIUM,
   1012      'description':
   1013          'Java: This @param tag doesn\'t refer to a parameter of the method.',
   1014      'patterns': [r".*: warning: \[InvalidParam\] .+"]},
   1015     {'category': 'java',
   1016      'severity': Severity.MEDIUM,
   1017      'description':
   1018          'Java: This tag is invalid.',
   1019      'patterns': [r".*: warning: \[InvalidTag\] .+"]},
   1020     {'category': 'java',
   1021      'severity': Severity.MEDIUM,
   1022      'description':
   1023          'Java: The documented method doesn\'t actually throw this checked exception.',
   1024      'patterns': [r".*: warning: \[InvalidThrows\] .+"]},
   1025     {'category': 'java',
   1026      'severity': Severity.MEDIUM,
   1027      'description':
   1028          'Java: Class should not implement both `Iterable` and `Iterator`',
   1029      'patterns': [r".*: warning: \[IterableAndIterator\] .+"]},
   1030     {'category': 'java',
   1031      'severity': Severity.MEDIUM,
   1032      'description':
   1033          'Java: Floating-point comparison without error tolerance',
   1034      'patterns': [r".*: warning: \[JUnit3FloatingPointComparisonWithoutDelta\] .+"]},
   1035     {'category': 'java',
   1036      'severity': Severity.MEDIUM,
   1037      'description':
   1038          'Java: Some JUnit4 construct cannot be used in a JUnit3 context. Convert your class to JUnit4 style to use them.',
   1039      'patterns': [r".*: warning: \[JUnit4ClassUsedInJUnit3\] .+"]},
   1040     {'category': 'java',
   1041      'severity': Severity.MEDIUM,
   1042      'description':
   1043          'Java: Test class inherits from JUnit 3\'s TestCase but has JUnit 4 @Test annotations.',
   1044      'patterns': [r".*: warning: \[JUnitAmbiguousTestClass\] .+"]},
   1045     {'category': 'java',
   1046      'severity': Severity.MEDIUM,
   1047      'description':
   1048          'Java: Never reuse class names from java.lang',
   1049      'patterns': [r".*: warning: \[JavaLangClash\] .+"]},
   1050     {'category': 'java',
   1051      'severity': Severity.MEDIUM,
   1052      'description':
   1053          'Java: Suggests alternatives to obsolete JDK classes.',
   1054      'patterns': [r".*: warning: \[JdkObsolete\] .+"]},
   1055     {'category': 'java',
   1056      'severity': Severity.MEDIUM,
   1057      'description':
   1058          'Java: Calls to Lock#lock should be immediately followed by a try block which releases the lock.',
   1059      'patterns': [r".*: warning: \[LockNotBeforeTry\] .+"]},
   1060     {'category': 'java',
   1061      'severity': Severity.MEDIUM,
   1062      'description':
   1063          'Java: Assignment where a boolean expression was expected; use == if this assignment wasn\'t expected or add parentheses for clarity.',
   1064      'patterns': [r".*: warning: \[LogicalAssignment\] .+"]},
   1065     {'category': 'java',
   1066      'severity': Severity.MEDIUM,
   1067      'description':
   1068          'Java: Math.abs does not always give a positive result. Please consider other methods for positive random numbers.',
   1069      'patterns': [r".*: warning: \[MathAbsoluteRandom\] .+"]},
   1070     {'category': 'java',
   1071      'severity': Severity.MEDIUM,
   1072      'description':
   1073          'Java: Switches on enum types should either handle all values, or have a default case.',
   1074      'patterns': [r".*: warning: \[MissingCasesInEnumSwitch\] .+"]},
   1075     {'category': 'java',
   1076      'severity': Severity.MEDIUM,
   1077      'description':
   1078          'Java: The Google Java Style Guide requires that each switch statement includes a default statement group, even if it contains no code. (This requirement is lifted for any switch statement that covers all values of an enum.)',
   1079      'patterns': [r".*: warning: \[MissingDefault\] .+"]},
   1080     {'category': 'java',
   1081      'severity': Severity.MEDIUM,
   1082      'description':
   1083          'Java: Not calling fail() when expecting an exception masks bugs',
   1084      'patterns': [r".*: warning: \[MissingFail\] .+"]},
   1085     {'category': 'java',
   1086      'severity': Severity.MEDIUM,
   1087      'description':
   1088          'Java: method overrides method in supertype; expected @Override',
   1089      'patterns': [r".*: warning: \[MissingOverride\] .+"]},
   1090     {'category': 'java',
   1091      'severity': Severity.MEDIUM,
   1092      'description':
   1093          'Java: A collection or proto builder was created, but its values were never accessed.',
   1094      'patterns': [r".*: warning: \[ModifiedButNotUsed\] .+"]},
   1095     {'category': 'java',
   1096      'severity': Severity.MEDIUM,
   1097      'description':
   1098          'Java: Modifying a collection while iterating over it in a loop may cause a ConcurrentModificationException to be thrown.',
   1099      'patterns': [r".*: warning: \[ModifyCollectionInEnhancedForLoop\] .+"]},
   1100     {'category': 'java',
   1101      'severity': Severity.MEDIUM,
   1102      'description':
   1103          'Java: Multiple calls to either parallel or sequential are unnecessary and cause confusion.',
   1104      'patterns': [r".*: warning: \[MultipleParallelOrSequentialCalls\] .+"]},
   1105     {'category': 'java',
   1106      'severity': Severity.MEDIUM,
   1107      'description':
   1108          'Java: Constant field declarations should use the immutable type (such as ImmutableList) instead of the general collection interface type (such as List)',
   1109      'patterns': [r".*: warning: \[MutableConstantField\] .+"]},
   1110     {'category': 'java',
   1111      'severity': Severity.MEDIUM,
   1112      'description':
   1113          'Java: Method return type should use the immutable type (such as ImmutableList) instead of the general collection interface type (such as List)',
   1114      'patterns': [r".*: warning: \[MutableMethodReturnType\] .+"]},
   1115     {'category': 'java',
   1116      'severity': Severity.MEDIUM,
   1117      'description':
   1118          'Java: Compound assignments may hide dangerous casts',
   1119      'patterns': [r".*: warning: \[NarrowingCompoundAssignment\] .+"]},
   1120     {'category': 'java',
   1121      'severity': Severity.MEDIUM,
   1122      'description':
   1123          'Java: Nested instanceOf conditions of disjoint types create blocks of code that never execute',
   1124      'patterns': [r".*: warning: \[NestedInstanceOfConditions\] .+"]},
   1125     {'category': 'java',
   1126      'severity': Severity.MEDIUM,
   1127      'description':
   1128          'Java: Instead of returning a functional type, return the actual type that the returned function would return and use lambdas at use site.',
   1129      'patterns': [r".*: warning: \[NoFunctionalReturnType\] .+"]},
   1130     {'category': 'java',
   1131      'severity': Severity.MEDIUM,
   1132      'description':
   1133          'Java: This update of a volatile variable is non-atomic',
   1134      'patterns': [r".*: warning: \[NonAtomicVolatileUpdate\] .+"]},
   1135     {'category': 'java',
   1136      'severity': Severity.MEDIUM,
   1137      'description':
   1138          'Java: Static import of member uses non-canonical name',
   1139      'patterns': [r".*: warning: \[NonCanonicalStaticMemberImport\] .+"]},
   1140     {'category': 'java',
   1141      'severity': Severity.MEDIUM,
   1142      'description':
   1143          'Java: equals method doesn\'t override Object.equals',
   1144      'patterns': [r".*: warning: \[NonOverridingEquals\] .+"]},
   1145     {'category': 'java',
   1146      'severity': Severity.MEDIUM,
   1147      'description':
   1148          'Java: Constructors should not be annotated with @Nullable since they cannot return null',
   1149      'patterns': [r".*: warning: \[NullableConstructor\] .+"]},
   1150     {'category': 'java',
   1151      'severity': Severity.MEDIUM,
   1152      'description':
   1153          'Java: Dereference of possibly-null value',
   1154      'patterns': [r".*: warning: \[NullableDereference\] .+"]},
   1155     {'category': 'java',
   1156      'severity': Severity.MEDIUM,
   1157      'description':
   1158          'Java: @Nullable should not be used for primitive types since they cannot be null',
   1159      'patterns': [r".*: warning: \[NullablePrimitive\] .+"]},
   1160     {'category': 'java',
   1161      'severity': Severity.MEDIUM,
   1162      'description':
   1163          'Java: void-returning methods should not be annotated with @Nullable, since they cannot return null',
   1164      'patterns': [r".*: warning: \[NullableVoid\] .+"]},
   1165     {'category': 'java',
   1166      'severity': Severity.MEDIUM,
   1167      'description':
   1168          'Java: Calling toString on Objects that don\'t override toString() doesn\'t provide useful information',
   1169      'patterns': [r".*: warning: \[ObjectToString\] .+"]},
   1170     {'category': 'java',
   1171      'severity': Severity.MEDIUM,
   1172      'description':
   1173          'Java: Objects.hashCode(Object o) should not be passed a primitive value',
   1174      'patterns': [r".*: warning: \[ObjectsHashCodePrimitive\] .+"]},
   1175     {'category': 'java',
   1176      'severity': Severity.MEDIUM,
   1177      'description':
   1178          'Java: Use grouping parenthesis to make the operator precedence explicit',
   1179      'patterns': [r".*: warning: \[OperatorPrecedence\] .+"]},
   1180     {'category': 'java',
   1181      'severity': Severity.MEDIUM,
   1182      'description':
   1183          'Java: One should not call optional.get() inside an if statement that checks !optional.isPresent',
   1184      'patterns': [r".*: warning: \[OptionalNotPresent\] .+"]},
   1185     {'category': 'java',
   1186      'severity': Severity.MEDIUM,
   1187      'description':
   1188          'Java: String literal contains format specifiers, but is not passed to a format method',
   1189      'patterns': [r".*: warning: \[OrphanedFormatString\] .+"]},
   1190     {'category': 'java',
   1191      'severity': Severity.MEDIUM,
   1192      'description':
   1193          'Java: To return a custom message with a Throwable class, one should override getMessage() instead of toString() for Throwable.',
   1194      'patterns': [r".*: warning: \[OverrideThrowableToString\] .+"]},
   1195     {'category': 'java',
   1196      'severity': Severity.MEDIUM,
   1197      'description':
   1198          'Java: Varargs doesn\'t agree for overridden method',
   1199      'patterns': [r".*: warning: \[Overrides\] .+"]},
   1200     {'category': 'java',
   1201      'severity': Severity.MEDIUM,
   1202      'description':
   1203          '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.',
   1204      'patterns': [r".*: warning: \[OverridesGuiceInjectableMethod\] .+"]},
   1205     {'category': 'java',
   1206      'severity': Severity.MEDIUM,
   1207      'description':
   1208          'Java: Detects `/* name= */`-style comments on actual parameters where the name doesn\'t match the formal parameter',
   1209      'patterns': [r".*: warning: \[ParameterName\] .+"]},
   1210     {'category': 'java',
   1211      'severity': Severity.MEDIUM,
   1212      'description':
   1213          'Java: Preconditions only accepts the %s placeholder in error message strings',
   1214      'patterns': [r".*: warning: \[PreconditionsInvalidPlaceholder\] .+"]},
   1215     {'category': 'java',
   1216      'severity': Severity.MEDIUM,
   1217      'description':
   1218          'Java: Passing a primitive array to a varargs method is usually wrong',
   1219      'patterns': [r".*: warning: \[PrimitiveArrayPassedToVarargsMethod\] .+"]},
   1220     {'category': 'java',
   1221      'severity': Severity.MEDIUM,
   1222      'description':
   1223          'Java: A field on a protocol buffer was set twice in the same chained expression.',
   1224      'patterns': [r".*: warning: \[ProtoRedundantSet\] .+"]},
   1225     {'category': 'java',
   1226      'severity': Severity.MEDIUM,
   1227      'description':
   1228          'Java: Protos should not be used as a key to a map, in a set, or in a contains method on a descendant of a collection. Protos have non deterministic ordering and proto equality is deep, which is a performance issue.',
   1229      'patterns': [r".*: warning: \[ProtosAsKeyOfSetOrMap\] .+"]},
   1230     {'category': 'java',
   1231      'severity': Severity.MEDIUM,
   1232      'description':
   1233          'Java: BugChecker has incorrect ProvidesFix tag, please update',
   1234      'patterns': [r".*: warning: \[ProvidesFix\] .+"]},
   1235     {'category': 'java',
   1236      'severity': Severity.MEDIUM,
   1237      'description':
   1238          'Java: Qualifiers/Scope annotations on @Inject methods don\'t have any effect. Move the qualifier annotation to the binding location.',
   1239      'patterns': [r".*: warning: \[QualifierOrScopeOnInjectMethod\] .+"]},
   1240     {'category': 'java',
   1241      'severity': Severity.MEDIUM,
   1242      'description':
   1243          'Java: Injection frameworks currently don\'t understand Qualifiers in TYPE_PARAMETER or TYPE_USE contexts.',
   1244      'patterns': [r".*: warning: \[QualifierWithTypeUse\] .+"]},
   1245     {'category': 'java',
   1246      'severity': Severity.MEDIUM,
   1247      'description':
   1248          'Java: reachabilityFence should always be called inside a finally block',
   1249      'patterns': [r".*: warning: \[ReachabilityFenceUsage\] .+"]},
   1250     {'category': 'java',
   1251      'severity': Severity.MEDIUM,
   1252      'description':
   1253          'Java: Thrown exception is a subtype of another',
   1254      'patterns': [r".*: warning: \[RedundantThrows\] .+"]},
   1255     {'category': 'java',
   1256      'severity': Severity.MEDIUM,
   1257      'description':
   1258          'Java: Comparison using reference equality instead of value equality',
   1259      'patterns': [r".*: warning: \[ReferenceEquality\] .+"]},
   1260     {'category': 'java',
   1261      'severity': Severity.MEDIUM,
   1262      'description':
   1263          'Java: This annotation is missing required modifiers as specified by its @RequiredModifiers annotation',
   1264      'patterns': [r".*: warning: \[RequiredModifiers\] .+"]},
   1265     {'category': 'java',
   1266      'severity': Severity.MEDIUM,
   1267      'description':
   1268          'Java: Void methods should not have a @return tag.',
   1269      'patterns': [r".*: warning: \[ReturnFromVoid\] .+"]},
   1270     {'category': 'java',
   1271      'severity': Severity.MEDIUM,
   1272      'description':
   1273          'Java: Prefer the short-circuiting boolean operators \u0026\u0026 and || to \u0026 and |.',
   1274      'patterns': [r".*: warning: \[ShortCircuitBoolean\] .+"]},
   1275     {'category': 'java',
   1276      'severity': Severity.MEDIUM,
   1277      'description':
   1278          'Java: Writes to static fields should not be guarded by instance locks',
   1279      'patterns': [r".*: warning: \[StaticGuardedByInstance\] .+"]},
   1280     {'category': 'java',
   1281      'severity': Severity.MEDIUM,
   1282      'description':
   1283          'Java: A static variable or method should be qualified with a class name, not expression',
   1284      'patterns': [r".*: warning: \[StaticQualifiedUsingExpression\] .+"]},
   1285     {'category': 'java',
   1286      'severity': Severity.MEDIUM,
   1287      'description':
   1288          'Java: Streams that encapsulate a closeable resource should be closed using try-with-resources',
   1289      'patterns': [r".*: warning: \[StreamResourceLeak\] .+"]},
   1290     {'category': 'java',
   1291      'severity': Severity.MEDIUM,
   1292      'description':
   1293          'Java: String comparison using reference equality instead of value equality',
   1294      'patterns': [r".*: warning: \[StringEquality\] .+"]},
   1295     {'category': 'java',
   1296      'severity': Severity.MEDIUM,
   1297      'description':
   1298          'Java: String.split(String) has surprising behavior',
   1299      'patterns': [r".*: warning: \[StringSplitter\] .+"]},
   1300     {'category': 'java',
   1301      'severity': Severity.MEDIUM,
   1302      'description':
   1303          'Java: SWIG generated code that can\'t call a C++ destructor will leak memory',
   1304      'patterns': [r".*: warning: \[SwigMemoryLeak\] .+"]},
   1305     {'category': 'java',
   1306      'severity': Severity.MEDIUM,
   1307      'description':
   1308          'Java: Synchronizing on non-final fields is not safe: if the field is ever updated, different threads may end up locking on different objects.',
   1309      'patterns': [r".*: warning: \[SynchronizeOnNonFinalField\] .+"]},
   1310     {'category': 'java',
   1311      'severity': Severity.MEDIUM,
   1312      'description':
   1313          'Java: Code that contains System.exit() is untestable.',
   1314      'patterns': [r".*: warning: \[SystemExitOutsideMain\] .+"]},
   1315     {'category': 'java',
   1316      'severity': Severity.MEDIUM,
   1317      'description':
   1318          'Java: Using @Test(expected=...) is discouraged, since the test will pass if *any* statement in the test method throws the expected exception',
   1319      'patterns': [r".*: warning: \[TestExceptionChecker\] .+"]},
   1320     {'category': 'java',
   1321      'severity': Severity.MEDIUM,
   1322      'description':
   1323          'Java: Thread.join needs to be surrounded by a loop until it succeeds, as in Uninterruptibles.joinUninterruptibly.',
   1324      'patterns': [r".*: warning: \[ThreadJoinLoop\] .+"]},
   1325     {'category': 'java',
   1326      'severity': Severity.MEDIUM,
   1327      'description':
   1328          'Java: ThreadLocals should be stored in static fields',
   1329      'patterns': [r".*: warning: \[ThreadLocalUsage\] .+"]},
   1330     {'category': 'java',
   1331      'severity': Severity.MEDIUM,
   1332      'description':
   1333          'Java: Relying on the thread scheduler is discouraged; see Effective Java Item 72 (2nd edition) / 84 (3rd edition).',
   1334      'patterns': [r".*: warning: \[ThreadPriorityCheck\] .+"]},
   1335     {'category': 'java',
   1336      'severity': Severity.MEDIUM,
   1337      'description':
   1338          'Java: Three-letter time zone identifiers are deprecated, may be ambiguous, and might not do what you intend; the full IANA time zone ID should be used instead.',
   1339      'patterns': [r".*: warning: \[ThreeLetterTimeZoneID\] .+"]},
   1340     {'category': 'java',
   1341      'severity': Severity.MEDIUM,
   1342      'description':
   1343          'Java: An implementation of Object.toString() should never return null.',
   1344      'patterns': [r".*: warning: \[ToStringReturnsNull\] .+"]},
   1345     {'category': 'java',
   1346      'severity': Severity.MEDIUM,
   1347      'description':
   1348          'Java: The actual and expected values appear to be swapped, which results in poor assertion failure messages. The actual value should come first.',
   1349      'patterns': [r".*: warning: \[TruthAssertExpected\] .+"]},
   1350     {'category': 'java',
   1351      'severity': Severity.MEDIUM,
   1352      'description':
   1353          'Java: Truth Library assert is called on a constant.',
   1354      'patterns': [r".*: warning: \[TruthConstantAsserts\] .+"]},
   1355     {'category': 'java',
   1356      'severity': Severity.MEDIUM,
   1357      'description':
   1358          'Java: Argument is not compatible with the subject\'s type.',
   1359      'patterns': [r".*: warning: \[TruthIncompatibleType\] .+"]},
   1360     {'category': 'java',
   1361      'severity': Severity.MEDIUM,
   1362      'description':
   1363          'Java: Type parameter declaration shadows another named type',
   1364      'patterns': [r".*: warning: \[TypeNameShadowing\] .+"]},
   1365     {'category': 'java',
   1366      'severity': Severity.MEDIUM,
   1367      'description':
   1368          'Java: Type parameter declaration overrides another type parameter already declared',
   1369      'patterns': [r".*: warning: \[TypeParameterShadowing\] .+"]},
   1370     {'category': 'java',
   1371      'severity': Severity.MEDIUM,
   1372      'description':
   1373          '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.',
   1374      'patterns': [r".*: warning: \[TypeParameterUnusedInFormals\] .+"]},
   1375     {'category': 'java',
   1376      'severity': Severity.MEDIUM,
   1377      'description':
   1378          'Java: Avoid hash-based containers of java.net.URL--the containers rely on equals() and hashCode(), which cause java.net.URL to make blocking internet connections.',
   1379      'patterns': [r".*: warning: \[URLEqualsHashCode\] .+"]},
   1380     {'category': 'java',
   1381      'severity': Severity.MEDIUM,
   1382      'description':
   1383          'Java: Collection, Iterable, Multimap, and Queue do not have well-defined equals behavior',
   1384      'patterns': [r".*: warning: \[UndefinedEquals\] .+"]},
   1385     {'category': 'java',
   1386      'severity': Severity.MEDIUM,
   1387      'description':
   1388          'Java: Switch handles all enum values: an explicit default case is unnecessary and defeats error checking for non-exhaustive switches.',
   1389      'patterns': [r".*: warning: \[UnnecessaryDefaultInEnumSwitch\] .+"]},
   1390     {'category': 'java',
   1391      'severity': Severity.MEDIUM,
   1392      'description':
   1393          'Java: Unnecessary use of grouping parentheses',
   1394      'patterns': [r".*: warning: \[UnnecessaryParentheses\] .+"]},
   1395     {'category': 'java',
   1396      'severity': Severity.MEDIUM,
   1397      'description':
   1398          'Java: Finalizer may run before native code finishes execution',
   1399      'patterns': [r".*: warning: \[UnsafeFinalization\] .+"]},
   1400     {'category': 'java',
   1401      'severity': Severity.MEDIUM,
   1402      'description':
   1403          'Java: Prefer `asSubclass` instead of casting the result of `newInstance`, to detect classes of incorrect type before invoking their constructors.This way, if the class is of the incorrect type,it will throw an exception before invoking its constructor.',
   1404      'patterns': [r".*: warning: \[UnsafeReflectiveConstructionCast\] .+"]},
   1405     {'category': 'java',
   1406      'severity': Severity.MEDIUM,
   1407      'description':
   1408          'Java: Unsynchronized method overrides a synchronized method.',
   1409      'patterns': [r".*: warning: \[UnsynchronizedOverridesSynchronized\] .+"]},
   1410     {'category': 'java',
   1411      'severity': Severity.MEDIUM,
   1412      'description':
   1413          'Java: Unused.',
   1414      'patterns': [r".*: warning: \[Unused\] .+"]},
   1415     {'category': 'java',
   1416      'severity': Severity.MEDIUM,
   1417      'description':
   1418          'Java: This catch block catches an exception and re-throws another, but swallows the caught exception rather than setting it as a cause. This can make debugging harder.',
   1419      'patterns': [r".*: warning: \[UnusedException\] .+"]},
   1420     {'category': 'java',
   1421      'severity': Severity.MEDIUM,
   1422      'description':
   1423          'Java: Java assert is used in test. For testing purposes Assert.* matchers should be used.',
   1424      'patterns': [r".*: warning: \[UseCorrectAssertInTests\] .+"]},
   1425     {'category': 'java',
   1426      'severity': Severity.MEDIUM,
   1427      'description':
   1428          'Java: Non-constant variable missing @Var annotation',
   1429      'patterns': [r".*: warning: \[Var\] .+"]},
   1430     {'category': 'java',
   1431      'severity': Severity.MEDIUM,
   1432      'description':
   1433          'Java: variableName and type with the same name would refer to the static field instead of the class',
   1434      'patterns': [r".*: warning: \[VariableNameSameAsType\] .+"]},
   1435     {'category': 'java',
   1436      'severity': Severity.MEDIUM,
   1437      'description':
   1438          'Java: Because of spurious wakeups, Object.wait() and Condition.await() must always be called in a loop',
   1439      'patterns': [r".*: warning: \[WaitNotInLoop\] .+"]},
   1440     {'category': 'java',
   1441      'severity': Severity.MEDIUM,
   1442      'description':
   1443          'Java: A wakelock acquired with a timeout may be released by the system before calling `release`, even after checking `isHeld()`. If so, it will throw a RuntimeException. Please wrap in a try/catch block.',
   1444      'patterns': [r".*: warning: \[WakelockReleasedDangerously\] .+"]},
   1445     {'category': 'java',
   1446      'severity': Severity.HIGH,
   1447      'description':
   1448          'Java: AndroidInjection.inject() should always be invoked before calling super.lifecycleMethod()',
   1449      'patterns': [r".*: warning: \[AndroidInjectionBeforeSuper\] .+"]},
   1450     {'category': 'java',
   1451      'severity': Severity.HIGH,
   1452      'description':
   1453          'Java: Use of class, field, or method that is not compatible with legacy Android devices',
   1454      'patterns': [r".*: warning: \[AndroidJdkLibsChecker\] .+"]},
   1455     {'category': 'java',
   1456      'severity': Severity.HIGH,
   1457      'description':
   1458          'Java: Reference equality used to compare arrays',
   1459      'patterns': [r".*: warning: \[ArrayEquals\] .+"]},
   1460     {'category': 'java',
   1461      'severity': Severity.HIGH,
   1462      'description':
   1463          'Java: Arrays.fill(Object[], Object) called with incompatible types.',
   1464      'patterns': [r".*: warning: \[ArrayFillIncompatibleType\] .+"]},
   1465     {'category': 'java',
   1466      'severity': Severity.HIGH,
   1467      'description':
   1468          'Java: hashcode method on array does not hash array contents',
   1469      'patterns': [r".*: warning: \[ArrayHashCode\] .+"]},
   1470     {'category': 'java',
   1471      'severity': Severity.HIGH,
   1472      'description':
   1473          'Java: Calling toString on an array does not provide useful information',
   1474      'patterns': [r".*: warning: \[ArrayToString\] .+"]},
   1475     {'category': 'java',
   1476      'severity': Severity.HIGH,
   1477      'description':
   1478          'Java: Arrays.asList does not autobox primitive arrays, as one might expect.',
   1479      'patterns': [r".*: warning: \[ArraysAsListPrimitiveArray\] .+"]},
   1480     {'category': 'java',
   1481      'severity': Severity.HIGH,
   1482      'description':
   1483          'Java: @AssistedInject and @Inject cannot be used on the same constructor.',
   1484      'patterns': [r".*: warning: \[AssistedInjectAndInjectOnSameConstructor\] .+"]},
   1485     {'category': 'java',
   1486      'severity': Severity.HIGH,
   1487      'description':
   1488          'Java: AsyncCallable should not return a null Future, only a Future whose result is null.',
   1489      'patterns': [r".*: warning: \[AsyncCallableReturnsNull\] .+"]},
   1490     {'category': 'java',
   1491      'severity': Severity.HIGH,
   1492      'description':
   1493          'Java: AsyncFunction should not return a null Future, only a Future whose result is null.',
   1494      'patterns': [r".*: warning: \[AsyncFunctionReturnsNull\] .+"]},
   1495     {'category': 'java',
   1496      'severity': Severity.HIGH,
   1497      'description':
   1498          'Java: @AutoFactory and @Inject should not be used in the same type.',
   1499      'patterns': [r".*: warning: \[AutoFactoryAtInject\] .+"]},
   1500     {'category': 'java',
   1501      'severity': Severity.HIGH,
   1502      'description':
   1503          'Java: Arguments to AutoValue constructor are in the wrong order',
   1504      'patterns': [r".*: warning: \[AutoValueConstructorOrderChecker\] .+"]},
   1505     {'category': 'java',
   1506      'severity': Severity.HIGH,
   1507      'description':
   1508          'Java: Shift by an amount that is out of range',
   1509      'patterns': [r".*: warning: \[BadShiftAmount\] .+"]},
   1510     {'category': 'java',
   1511      'severity': Severity.HIGH,
   1512      'description':
   1513          'Java: Object serialized in Bundle may have been flattened to base type.',
   1514      'patterns': [r".*: warning: \[BundleDeserializationCast\] .+"]},
   1515     {'category': 'java',
   1516      'severity': Severity.HIGH,
   1517      'description':
   1518          '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.',
   1519      'patterns': [r".*: warning: \[ChainingConstructorIgnoresParameter\] .+"]},
   1520     {'category': 'java',
   1521      'severity': Severity.HIGH,
   1522      'description':
   1523          'Java: Ignored return value of method that is annotated with @CheckReturnValue',
   1524      'patterns': [r".*: warning: \[CheckReturnValue\] .+"]},
   1525     {'category': 'java',
   1526      'severity': Severity.HIGH,
   1527      'description':
   1528          'Java: The source file name should match the name of the top-level class it contains',
   1529      'patterns': [r".*: warning: \[ClassName\] .+"]},
   1530     {'category': 'java',
   1531      'severity': Severity.HIGH,
   1532      'description':
   1533          'Java: Incompatible type as argument to Object-accepting Java collections method',
   1534      'patterns': [r".*: warning: \[CollectionIncompatibleType\] .+"]},
   1535     {'category': 'java',
   1536      'severity': Severity.HIGH,
   1537      'description':
   1538          'Java:  Implementing \'Comparable\u003cT>\' where T is not compatible with the implementing class.',
   1539      'patterns': [r".*: warning: \[ComparableType\] .+"]},
   1540     {'category': 'java',
   1541      'severity': Severity.HIGH,
   1542      'description':
   1543          'Java: this == null is always false, this != null is always true',
   1544      'patterns': [r".*: warning: \[ComparingThisWithNull\] .+"]},
   1545     {'category': 'java',
   1546      'severity': Severity.HIGH,
   1547      'description':
   1548          'Java: This comparison method violates the contract',
   1549      'patterns': [r".*: warning: \[ComparisonContractViolated\] .+"]},
   1550     {'category': 'java',
   1551      'severity': Severity.HIGH,
   1552      'description':
   1553          'Java: Comparison to value that is out of range for the compared type',
   1554      'patterns': [r".*: warning: \[ComparisonOutOfRange\] .+"]},
   1555     {'category': 'java',
   1556      'severity': Severity.HIGH,
   1557      'description':
   1558          'Java: @CompatibleWith\'s value is not a type argument.',
   1559      'patterns': [r".*: warning: \[CompatibleWithAnnotationMisuse\] .+"]},
   1560     {'category': 'java',
   1561      'severity': Severity.HIGH,
   1562      'description':
   1563          'Java: Non-compile-time constant expression passed to parameter with @CompileTimeConstant type annotation.',
   1564      'patterns': [r".*: warning: \[CompileTimeConstant\] .+"]},
   1565     {'category': 'java',
   1566      'severity': Severity.HIGH,
   1567      'description':
   1568          'Java: Non-trivial compile time constant boolean expressions shouldn\'t be used.',
   1569      'patterns': [r".*: warning: \[ComplexBooleanConstant\] .+"]},
   1570     {'category': 'java',
   1571      'severity': Severity.HIGH,
   1572      'description':
   1573          'Java: A conditional expression with numeric operands of differing types will perform binary numeric promotion of the operands; when these operands are of reference types, the expression\'s result may not be of the expected type.',
   1574      'patterns': [r".*: warning: \[ConditionalExpressionNumericPromotion\] .+"]},
   1575     {'category': 'java',
   1576      'severity': Severity.HIGH,
   1577      'description':
   1578          'Java: Compile-time constant expression overflows',
   1579      'patterns': [r".*: warning: \[ConstantOverflow\] .+"]},
   1580     {'category': 'java',
   1581      'severity': Severity.HIGH,
   1582      'description':
   1583          'Java: Dagger @Provides methods may not return null unless annotated with @Nullable',
   1584      'patterns': [r".*: warning: \[DaggerProvidesNull\] .+"]},
   1585     {'category': 'java',
   1586      'severity': Severity.HIGH,
   1587      'description':
   1588          'Java: Exception created but not thrown',
   1589      'patterns': [r".*: warning: \[DeadException\] .+"]},
   1590     {'category': 'java',
   1591      'severity': Severity.HIGH,
   1592      'description':
   1593          'Java: Thread created but not started',
   1594      'patterns': [r".*: warning: \[DeadThread\] .+"]},
   1595     {'category': 'java',
   1596      'severity': Severity.HIGH,
   1597      'description':
   1598          'Java: Deprecated item is not annotated with @Deprecated',
   1599      'patterns': [r".*: warning: \[DepAnn\] .+"]},
   1600     {'category': 'java',
   1601      'severity': Severity.HIGH,
   1602      'description':
   1603          'Java: Division by integer literal zero',
   1604      'patterns': [r".*: warning: \[DivZero\] .+"]},
   1605     {'category': 'java',
   1606      'severity': Severity.HIGH,
   1607      'description':
   1608          'Java: This method should not be called.',
   1609      'patterns': [r".*: warning: \[DoNotCall\] .+"]},
   1610     {'category': 'java',
   1611      'severity': Severity.HIGH,
   1612      'description':
   1613          'Java: Empty statement after if',
   1614      'patterns': [r".*: warning: \[EmptyIf\] .+"]},
   1615     {'category': 'java',
   1616      'severity': Severity.HIGH,
   1617      'description':
   1618          'Java: == NaN always returns false; use the isNaN methods instead',
   1619      'patterns': [r".*: warning: \[EqualsNaN\] .+"]},
   1620     {'category': 'java',
   1621      'severity': Severity.HIGH,
   1622      'description':
   1623          'Java: == must be used in equals method to check equality to itself or an infinite loop will occur.',
   1624      'patterns': [r".*: warning: \[EqualsReference\] .+"]},
   1625     {'category': 'java',
   1626      'severity': Severity.HIGH,
   1627      'description':
   1628          'Java: Comparing different pairs of fields/getters in an equals implementation is probably a mistake.',
   1629      'patterns': [r".*: warning: \[EqualsWrongThing\] .+"]},
   1630     {'category': 'java',
   1631      'severity': Severity.HIGH,
   1632      'description':
   1633          'Java: Method annotated @ForOverride must be protected or package-private and only invoked from declaring class, or from an override of the method',
   1634      'patterns': [r".*: warning: \[ForOverride\] .+"]},
   1635     {'category': 'java',
   1636      'severity': Severity.HIGH,
   1637      'description':
   1638          'Java: Invalid printf-style format string',
   1639      'patterns': [r".*: warning: \[FormatString\] .+"]},
   1640     {'category': 'java',
   1641      'severity': Severity.HIGH,
   1642      'description':
   1643          'Java: Invalid format string passed to formatting method.',
   1644      'patterns': [r".*: warning: \[FormatStringAnnotation\] .+"]},
   1645     {'category': 'java',
   1646      'severity': Severity.HIGH,
   1647      'description':
   1648          '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.',
   1649      'patterns': [r".*: warning: \[FunctionalInterfaceMethodChanged\] .+"]},
   1650     {'category': 'java',
   1651      'severity': Severity.HIGH,
   1652      'description':
   1653          'Java: Futures.getChecked requires a checked exception type with a standard constructor.',
   1654      'patterns': [r".*: warning: \[FuturesGetCheckedIllegalExceptionType\] .+"]},
   1655     {'category': 'java',
   1656      'severity': Severity.HIGH,
   1657      'description':
   1658          'Java: DoubleMath.fuzzyEquals should never be used in an Object.equals() method',
   1659      'patterns': [r".*: warning: \[FuzzyEqualsShouldNotBeUsedInEqualsMethod\] .+"]},
   1660     {'category': 'java',
   1661      'severity': Severity.HIGH,
   1662      'description':
   1663          'Java: Calling getClass() on an annotation may return a proxy class',
   1664      'patterns': [r".*: warning: \[GetClassOnAnnotation\] .+"]},
   1665     {'category': 'java',
   1666      'severity': Severity.HIGH,
   1667      'description':
   1668          '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',
   1669      'patterns': [r".*: warning: \[GetClassOnClass\] .+"]},
   1670     {'category': 'java',
   1671      'severity': Severity.HIGH,
   1672      'description':
   1673          'Java: Checks for unguarded accesses to fields and methods with @GuardedBy annotations',
   1674      'patterns': [r".*: warning: \[GuardedBy\] .+"]},
   1675     {'category': 'java',
   1676      'severity': Severity.HIGH,
   1677      'description':
   1678          'Java: Scope annotation on implementation class of AssistedInject factory is not allowed',
   1679      'patterns': [r".*: warning: \[GuiceAssistedInjectScoping\] .+"]},
   1680     {'category': 'java',
   1681      'severity': Severity.HIGH,
   1682      'description':
   1683          'Java: A constructor cannot have two @Assisted parameters of the same type unless they are disambiguated with named @Assisted annotations.',
   1684      'patterns': [r".*: warning: \[GuiceAssistedParameters\] .+"]},
   1685     {'category': 'java',
   1686      'severity': Severity.HIGH,
   1687      'description':
   1688          'Java: Although Guice allows injecting final fields, doing so is disallowed because the injected value may not be visible to other threads.',
   1689      'patterns': [r".*: warning: \[GuiceInjectOnFinalField\] .+"]},
   1690     {'category': 'java',
   1691      'severity': Severity.HIGH,
   1692      'description':
   1693          'Java: contains() is a legacy method that is equivalent to containsValue()',
   1694      'patterns': [r".*: warning: \[HashtableContains\] .+"]},
   1695     {'category': 'java',
   1696      'severity': Severity.HIGH,
   1697      'description':
   1698          'Java: A binary expression where both operands are the same is usually incorrect.',
   1699      'patterns': [r".*: warning: \[IdentityBinaryExpression\] .+"]},
   1700     {'category': 'java',
   1701      'severity': Severity.HIGH,
   1702      'description':
   1703          'Java: Type declaration annotated with @Immutable is not immutable',
   1704      'patterns': [r".*: warning: \[Immutable\] .+"]},
   1705     {'category': 'java',
   1706      'severity': Severity.HIGH,
   1707      'description':
   1708          'Java: Modifying an immutable collection is guaranteed to throw an exception and leave the collection unmodified',
   1709      'patterns': [r".*: warning: \[ImmutableModification\] .+"]},
   1710     {'category': 'java',
   1711      'severity': Severity.HIGH,
   1712      'description':
   1713          'Java: Passing argument to a generic method with an incompatible type.',
   1714      'patterns': [r".*: warning: \[IncompatibleArgumentType\] .+"]},
   1715     {'category': 'java',
   1716      'severity': Severity.HIGH,
   1717      'description':
   1718          'Java: The first argument to indexOf is a Unicode code point, and the second is the index to start the search from',
   1719      'patterns': [r".*: warning: \[IndexOfChar\] .+"]},
   1720     {'category': 'java',
   1721      'severity': Severity.HIGH,
   1722      'description':
   1723          'Java: Conditional expression in varargs call contains array and non-array arguments',
   1724      'patterns': [r".*: warning: \[InexactVarargsConditional\] .+"]},
   1725     {'category': 'java',
   1726      'severity': Severity.HIGH,
   1727      'description':
   1728          'Java: This method always recurses, and will cause a StackOverflowError',
   1729      'patterns': [r".*: warning: \[InfiniteRecursion\] .+"]},
   1730     {'category': 'java',
   1731      'severity': Severity.HIGH,
   1732      'description':
   1733          'Java: A scoping annotation\'s Target should include TYPE and METHOD.',
   1734      'patterns': [r".*: warning: \[InjectInvalidTargetingOnScopingAnnotation\] .+"]},
   1735     {'category': 'java',
   1736      'severity': Severity.HIGH,
   1737      'description':
   1738          'Java: Using more than one qualifier annotation on the same element is not allowed.',
   1739      'patterns': [r".*: warning: \[InjectMoreThanOneQualifier\] .+"]},
   1740     {'category': 'java',
   1741      'severity': Severity.HIGH,
   1742      'description':
   1743          'Java: A class can be annotated with at most one scope annotation.',
   1744      'patterns': [r".*: warning: \[InjectMoreThanOneScopeAnnotationOnClass\] .+"]},
   1745     {'category': 'java',
   1746      'severity': Severity.HIGH,
   1747      'description':
   1748          'Java: Members shouldn\'t be annotated with @Inject if constructor is already annotated @Inject',
   1749      'patterns': [r".*: warning: \[InjectOnMemberAndConstructor\] .+"]},
   1750     {'category': 'java',
   1751      'severity': Severity.HIGH,
   1752      'description':
   1753          'Java: Scope annotation on an interface or abstact class is not allowed',
   1754      'patterns': [r".*: warning: \[InjectScopeAnnotationOnInterfaceOrAbstractClass\] .+"]},
   1755     {'category': 'java',
   1756      'severity': Severity.HIGH,
   1757      'description':
   1758          'Java: Scoping and qualifier annotations must have runtime retention.',
   1759      'patterns': [r".*: warning: \[InjectScopeOrQualifierAnnotationRetention\] .+"]},
   1760     {'category': 'java',
   1761      'severity': Severity.HIGH,
   1762      'description':
   1763          'Java: Injected constructors cannot be optional nor have binding annotations',
   1764      'patterns': [r".*: warning: \[InjectedConstructorAnnotations\] .+"]},
   1765     {'category': 'java',
   1766      'severity': Severity.HIGH,
   1767      'description':
   1768          'Java: A standard cryptographic operation is used in a mode that is prone to vulnerabilities',
   1769      'patterns': [r".*: warning: \[InsecureCryptoUsage\] .+"]},
   1770     {'category': 'java',
   1771      'severity': Severity.HIGH,
   1772      'description':
   1773          'Java: Invalid syntax used for a regular expression',
   1774      'patterns': [r".*: warning: \[InvalidPatternSyntax\] .+"]},
   1775     {'category': 'java',
   1776      'severity': Severity.HIGH,
   1777      'description':
   1778          'Java: Invalid time zone identifier. TimeZone.getTimeZone(String) will silently return GMT instead of the time zone you intended.',
   1779      'patterns': [r".*: warning: \[InvalidTimeZoneID\] .+"]},
   1780     {'category': 'java',
   1781      'severity': Severity.HIGH,
   1782      'description':
   1783          'Java: The argument to Class#isInstance(Object) should not be a Class',
   1784      'patterns': [r".*: warning: \[IsInstanceOfClass\] .+"]},
   1785     {'category': 'java',
   1786      'severity': Severity.HIGH,
   1787      'description':
   1788          'Java: Log tag too long, cannot exceed 23 characters.',
   1789      'patterns': [r".*: warning: \[IsLoggableTagLength\] .+"]},
   1790     {'category': 'java',
   1791      'severity': Severity.HIGH,
   1792      'description':
   1793          'Java: Path implements Iterable\u003cPath>; prefer Collection\u003cPath> for clarity',
   1794      'patterns': [r".*: warning: \[IterablePathParameter\] .+"]},
   1795     {'category': 'java',
   1796      'severity': Severity.HIGH,
   1797      'description':
   1798          'Java: jMock tests must have a @RunWith(JMock.class) annotation, or the Mockery field must have a @Rule JUnit annotation',
   1799      'patterns': [r".*: warning: \[JMockTestWithoutRunWithOrRuleAnnotation\] .+"]},
   1800     {'category': 'java',
   1801      'severity': Severity.HIGH,
   1802      'description':
   1803          'Java: Test method will not be run; please correct method signature (Should be public, non-static, and method name should begin with "test").',
   1804      'patterns': [r".*: warning: \[JUnit3TestNotRun\] .+"]},
   1805     {'category': 'java',
   1806      'severity': Severity.HIGH,
   1807      'description':
   1808          'Java: This method should be static',
   1809      'patterns': [r".*: warning: \[JUnit4ClassAnnotationNonStatic\] .+"]},
   1810     {'category': 'java',
   1811      'severity': Severity.HIGH,
   1812      'description':
   1813          'Java: setUp() method will not be run; please add JUnit\'s @Before annotation',
   1814      'patterns': [r".*: warning: \[JUnit4SetUpNotRun\] .+"]},
   1815     {'category': 'java',
   1816      'severity': Severity.HIGH,
   1817      'description':
   1818          'Java: tearDown() method will not be run; please add JUnit\'s @After annotation',
   1819      'patterns': [r".*: warning: \[JUnit4TearDownNotRun\] .+"]},
   1820     {'category': 'java',
   1821      'severity': Severity.HIGH,
   1822      'description':
   1823          'Java: This looks like a test method but is not run; please add @Test and @Ignore, or, if this is a helper method, reduce its visibility.',
   1824      'patterns': [r".*: warning: \[JUnit4TestNotRun\] .+"]},
   1825     {'category': 'java',
   1826      'severity': Severity.HIGH,
   1827      'description':
   1828          'Java: An object is tested for reference equality to itself using JUnit library.',
   1829      'patterns': [r".*: warning: \[JUnitAssertSameCheck\] .+"]},
   1830     {'category': 'java',
   1831      'severity': Severity.HIGH,
   1832      'description':
   1833          'Java: Use of class, field, or method that is not compatible with JDK 7',
   1834      'patterns': [r".*: warning: \[Java7ApiChecker\] .+"]},
   1835     {'category': 'java',
   1836      'severity': Severity.HIGH,
   1837      'description':
   1838          'Java: Abstract and default methods are not injectable with javax.inject.Inject',
   1839      'patterns': [r".*: warning: \[JavaxInjectOnAbstractMethod\] .+"]},
   1840     {'category': 'java',
   1841      'severity': Severity.HIGH,
   1842      'description':
   1843          'Java: @javax.inject.Inject cannot be put on a final field.',
   1844      'patterns': [r".*: warning: \[JavaxInjectOnFinalField\] .+"]},
   1845     {'category': 'java',
   1846      'severity': Severity.HIGH,
   1847      'description':
   1848          'Java: This pattern will silently corrupt certain byte sequences from the serialized protocol message. Use ByteString or byte[] directly',
   1849      'patterns': [r".*: warning: \[LiteByteStringUtf8\] .+"]},
   1850     {'category': 'java',
   1851      'severity': Severity.HIGH,
   1852      'description':
   1853          'Java: This method does not acquire the locks specified by its @LockMethod annotation',
   1854      'patterns': [r".*: warning: \[LockMethodChecker\] .+"]},
   1855     {'category': 'java',
   1856      'severity': Severity.HIGH,
   1857      'description':
   1858          'Java: Prefer \'L\' to \'l\' for the suffix to long literals',
   1859      'patterns': [r".*: warning: \[LongLiteralLowerCaseSuffix\] .+"]},
   1860     {'category': 'java',
   1861      'severity': Severity.HIGH,
   1862      'description':
   1863          'Java: Loop condition is never modified in loop body.',
   1864      'patterns': [r".*: warning: \[LoopConditionChecker\] .+"]},
   1865     {'category': 'java',
   1866      'severity': Severity.HIGH,
   1867      'description':
   1868          'Java: Math.round(Integer) results in truncation',
   1869      'patterns': [r".*: warning: \[MathRoundIntLong\] .+"]},
   1870     {'category': 'java',
   1871      'severity': Severity.HIGH,
   1872      'description':
   1873          'Java: Certain resources in `android.R.string` have names that do not match their content',
   1874      'patterns': [r".*: warning: \[MislabeledAndroidString\] .+"]},
   1875     {'category': 'java',
   1876      'severity': Severity.HIGH,
   1877      'description':
   1878          'Java: Overriding method is missing a call to overridden super method',
   1879      'patterns': [r".*: warning: \[MissingSuperCall\] .+"]},
   1880     {'category': 'java',
   1881      'severity': Severity.HIGH,
   1882      'description':
   1883          'Java: A terminating method call is required for a test helper to have any effect.',
   1884      'patterns': [r".*: warning: \[MissingTestCall\] .+"]},
   1885     {'category': 'java',
   1886      'severity': Severity.HIGH,
   1887      'description':
   1888          'Java: Use of "YYYY" (week year) in a date pattern without "ww" (week in year). You probably meant to use "yyyy" (year) instead.',
   1889      'patterns': [r".*: warning: \[MisusedWeekYear\] .+"]},
   1890     {'category': 'java',
   1891      'severity': Severity.HIGH,
   1892      'description':
   1893          'Java: A bug in Mockito will cause this test to fail at runtime with a ClassCastException',
   1894      'patterns': [r".*: warning: \[MockitoCast\] .+"]},
   1895     {'category': 'java',
   1896      'severity': Severity.HIGH,
   1897      'description':
   1898          'Java: Missing method call for verify(mock) here',
   1899      'patterns': [r".*: warning: \[MockitoUsage\] .+"]},
   1900     {'category': 'java',
   1901      'severity': Severity.HIGH,
   1902      'description':
   1903          'Java: Using a collection function with itself as the argument.',
   1904      'patterns': [r".*: warning: \[ModifyingCollectionWithItself\] .+"]},
   1905     {'category': 'java',
   1906      'severity': Severity.HIGH,
   1907      'description':
   1908          'Java: This class has more than one @Inject-annotated constructor. Please remove the @Inject annotation from all but one of them.',
   1909      'patterns': [r".*: warning: \[MoreThanOneInjectableConstructor\] .+"]},
   1910     {'category': 'java',
   1911      'severity': Severity.HIGH,
   1912      'description':
   1913          'Java: The result of this method must be closed.',
   1914      'patterns': [r".*: warning: \[MustBeClosedChecker\] .+"]},
   1915     {'category': 'java',
   1916      'severity': Severity.HIGH,
   1917      'description':
   1918          'Java: The first argument to nCopies is the number of copies, and the second is the item to copy',
   1919      'patterns': [r".*: warning: \[NCopiesOfChar\] .+"]},
   1920     {'category': 'java',
   1921      'severity': Severity.HIGH,
   1922      'description':
   1923          'Java: @NoAllocation was specified on this method, but something was found that would trigger an allocation',
   1924      'patterns': [r".*: warning: \[NoAllocation\] .+"]},
   1925     {'category': 'java',
   1926      'severity': Severity.HIGH,
   1927      'description':
   1928          'Java: Static import of type uses non-canonical name',
   1929      'patterns': [r".*: warning: \[NonCanonicalStaticImport\] .+"]},
   1930     {'category': 'java',
   1931      'severity': Severity.HIGH,
   1932      'description':
   1933          'Java: @CompileTimeConstant parameters should be final or effectively final',
   1934      'patterns': [r".*: warning: \[NonFinalCompileTimeConstant\] .+"]},
   1935     {'category': 'java',
   1936      'severity': Severity.HIGH,
   1937      'description':
   1938          'Java: Calling getAnnotation on an annotation that is not retained at runtime.',
   1939      'patterns': [r".*: warning: \[NonRuntimeAnnotation\] .+"]},
   1940     {'category': 'java',
   1941      'severity': Severity.HIGH,
   1942      'description':
   1943          'Java: This conditional expression may evaluate to null, which will result in an NPE when the result is unboxed.',
   1944      'patterns': [r".*: warning: \[NullTernary\] .+"]},
   1945     {'category': 'java',
   1946      'severity': Severity.HIGH,
   1947      'description':
   1948          'Java: Numeric comparison using reference equality instead of value equality',
   1949      'patterns': [r".*: warning: \[NumericEquality\] .+"]},
   1950     {'category': 'java',
   1951      'severity': Severity.HIGH,
   1952      'description':
   1953          'Java: Comparison using reference equality instead of value equality',
   1954      'patterns': [r".*: warning: \[OptionalEquality\] .+"]},
   1955     {'category': 'java',
   1956      'severity': Severity.HIGH,
   1957      'description':
   1958          'Java: Annotations cannot be both Scope annotations and Qualifier annotations: this causes confusion when trying to use them.',
   1959      'patterns': [r".*: warning: \[OverlappingQualifierAndScopeAnnotation\] .+"]},
   1960     {'category': 'java',
   1961      'severity': Severity.HIGH,
   1962      'description':
   1963          '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.',
   1964      'patterns': [r".*: warning: \[OverridesJavaxInjectableMethod\] .+"]},
   1965     {'category': 'java',
   1966      'severity': Severity.HIGH,
   1967      'description':
   1968          'Java: Declaring types inside package-info.java files is very bad form',
   1969      'patterns': [r".*: warning: \[PackageInfo\] .+"]},
   1970     {'category': 'java',
   1971      'severity': Severity.HIGH,
   1972      'description':
   1973          'Java: Method parameter has wrong package',
   1974      'patterns': [r".*: warning: \[ParameterPackage\] .+"]},
   1975     {'category': 'java',
   1976      'severity': Severity.HIGH,
   1977      'description':
   1978          'Java: Detects classes which implement Parcelable but don\'t have CREATOR',
   1979      'patterns': [r".*: warning: \[ParcelableCreator\] .+"]},
   1980     {'category': 'java',
   1981      'severity': Severity.HIGH,
   1982      'description':
   1983          'Java: Literal passed as first argument to Preconditions.checkNotNull() can never be null',
   1984      'patterns': [r".*: warning: \[PreconditionsCheckNotNull\] .+"]},
   1985     {'category': 'java',
   1986      'severity': Severity.HIGH,
   1987      'description':
   1988          'Java: First argument to `Preconditions.checkNotNull()` is a primitive rather than an object reference',
   1989      'patterns': [r".*: warning: \[PreconditionsCheckNotNullPrimitive\] .+"]},
   1990     {'category': 'java',
   1991      'severity': Severity.HIGH,
   1992      'description':
   1993          'Java: Using ::equals or ::isInstance as an incompatible Predicate; the predicate will always return false',
   1994      'patterns': [r".*: warning: \[PredicateIncompatibleType\] .+"]},
   1995     {'category': 'java',
   1996      'severity': Severity.HIGH,
   1997      'description':
   1998          'Java: Access to a private protocol buffer field is forbidden. This protocol buffer carries a security contract, and can only be created using an approved library. Direct access to the fields is forbidden.',
   1999      'patterns': [r".*: warning: \[PrivateSecurityContractProtoAccess\] .+"]},
   2000     {'category': 'java',
   2001      'severity': Severity.HIGH,
   2002      'description':
   2003          'Java: Protobuf fields cannot be null.',
   2004      'patterns': [r".*: warning: \[ProtoFieldNullComparison\] .+"]},
   2005     {'category': 'java',
   2006      'severity': Severity.HIGH,
   2007      'description':
   2008          'Java: Comparing protobuf fields of type String using reference equality',
   2009      'patterns': [r".*: warning: \[ProtoStringFieldReferenceEquality\] .+"]},
   2010     {'category': 'java',
   2011      'severity': Severity.HIGH,
   2012      'description':
   2013          'Java: To get the tag number of a protocol buffer enum, use getNumber() instead.',
   2014      'patterns': [r".*: warning: \[ProtocolBufferOrdinal\] .+"]},
   2015     {'category': 'java',
   2016      'severity': Severity.HIGH,
   2017      'description':
   2018          'Java: @Provides methods need to be declared in a Module to have any effect.',
   2019      'patterns': [r".*: warning: \[ProvidesMethodOutsideOfModule\] .+"]},
   2020     {'category': 'java',
   2021      'severity': Severity.HIGH,
   2022      'description':
   2023          'Java: Casting a random number in the range [0.0, 1.0) to an integer or long always results in 0.',
   2024      'patterns': [r".*: warning: \[RandomCast\] .+"]},
   2025     {'category': 'java',
   2026      'severity': Severity.HIGH,
   2027      'description':
   2028          'Java: Use Random.nextInt(int).  Random.nextInt() % n can have negative results',
   2029      'patterns': [r".*: warning: \[RandomModInteger\] .+"]},
   2030     {'category': 'java',
   2031      'severity': Severity.HIGH,
   2032      'description':
   2033          'Java: Return value of android.graphics.Rect.intersect() must be checked',
   2034      'patterns': [r".*: warning: \[RectIntersectReturnValueIgnored\] .+"]},
   2035     {'category': 'java',
   2036      'severity': Severity.HIGH,
   2037      'description':
   2038          'Java: Use of method or class annotated with @RestrictTo',
   2039      'patterns': [r".*: warning: \[RestrictTo\] .+"]},
   2040     {'category': 'java',
   2041      'severity': Severity.HIGH,
   2042      'description':
   2043          'Java:  Check for non-whitelisted callers to RestrictedApiChecker.',
   2044      'patterns': [r".*: warning: \[RestrictedApiChecker\] .+"]},
   2045     {'category': 'java',
   2046      'severity': Severity.HIGH,
   2047      'description':
   2048          'Java: Return value of this method must be used',
   2049      'patterns': [r".*: warning: \[ReturnValueIgnored\] .+"]},
   2050     {'category': 'java',
   2051      'severity': Severity.HIGH,
   2052      'description':
   2053          'Java: Variable assigned to itself',
   2054      'patterns': [r".*: warning: \[SelfAssignment\] .+"]},
   2055     {'category': 'java',
   2056      'severity': Severity.HIGH,
   2057      'description':
   2058          'Java: An object is compared to itself',
   2059      'patterns': [r".*: warning: \[SelfComparison\] .+"]},
   2060     {'category': 'java',
   2061      'severity': Severity.HIGH,
   2062      'description':
   2063          'Java: Testing an object for equality with itself will always be true.',
   2064      'patterns': [r".*: warning: \[SelfEquals\] .+"]},
   2065     {'category': 'java',
   2066      'severity': Severity.HIGH,
   2067      'description':
   2068          'Java: This method must be called with an even number of arguments.',
   2069      'patterns': [r".*: warning: \[ShouldHaveEvenArgs\] .+"]},
   2070     {'category': 'java',
   2071      'severity': Severity.HIGH,
   2072      'description':
   2073          'Java: Comparison of a size >= 0 is always true, did you intend to check for non-emptiness?',
   2074      'patterns': [r".*: warning: \[SizeGreaterThanOrEqualsZero\] .+"]},
   2075     {'category': 'java',
   2076      'severity': Severity.HIGH,
   2077      'description':
   2078          'Java: Static and default interface methods are not natively supported on older Android devices. ',
   2079      'patterns': [r".*: warning: \[StaticOrDefaultInterfaceMethod\] .+"]},
   2080     {'category': 'java',
   2081      'severity': Severity.HIGH,
   2082      'description':
   2083          'Java: Calling toString on a Stream does not provide useful information',
   2084      'patterns': [r".*: warning: \[StreamToString\] .+"]},
   2085     {'category': 'java',
   2086      'severity': Severity.HIGH,
   2087      'description':
   2088          'Java: StringBuilder does not have a char constructor; this invokes the int constructor.',
   2089      'patterns': [r".*: warning: \[StringBuilderInitWithChar\] .+"]},
   2090     {'category': 'java',
   2091      'severity': Severity.HIGH,
   2092      'description':
   2093          'Java: String.substring(0) returns the original String',
   2094      'patterns': [r".*: warning: \[SubstringOfZero\] .+"]},
   2095     {'category': 'java',
   2096      'severity': Severity.HIGH,
   2097      'description':
   2098          'Java: Suppressing "deprecated" is probably a typo for "deprecation"',
   2099      'patterns': [r".*: warning: \[SuppressWarningsDeprecated\] .+"]},
   2100     {'category': 'java',
   2101      'severity': Severity.HIGH,
   2102      'description':
   2103          'Java: throwIfUnchecked(knownCheckedException) is a no-op.',
   2104      'patterns': [r".*: warning: \[ThrowIfUncheckedKnownChecked\] .+"]},
   2105     {'category': 'java',
   2106      'severity': Severity.HIGH,
   2107      'description':
   2108          'Java: Throwing \'null\' always results in a NullPointerException being thrown.',
   2109      'patterns': [r".*: warning: \[ThrowNull\] .+"]},
   2110     {'category': 'java',
   2111      'severity': Severity.HIGH,
   2112      'description':
   2113          'Java: isEqualTo should not be used to test an object for equality with itself; the assertion will never fail.',
   2114      'patterns': [r".*: warning: \[TruthSelfEquals\] .+"]},
   2115     {'category': 'java',
   2116      'severity': Severity.HIGH,
   2117      'description':
   2118          'Java: Catching Throwable/Error masks failures from fail() or assert*() in the try block',
   2119      'patterns': [r".*: warning: \[TryFailThrowable\] .+"]},
   2120     {'category': 'java',
   2121      'severity': Severity.HIGH,
   2122      'description':
   2123          'Java: Type parameter used as type qualifier',
   2124      'patterns': [r".*: warning: \[TypeParameterQualifier\] .+"]},
   2125     {'category': 'java',
   2126      'severity': Severity.HIGH,
   2127      'description':
   2128          'Java: This method does not acquire the locks specified by its @UnlockMethod annotation',
   2129      'patterns': [r".*: warning: \[UnlockMethod\] .+"]},
   2130     {'category': 'java',
   2131      'severity': Severity.HIGH,
   2132      'description':
   2133          'Java: Non-generic methods should not be invoked with type arguments',
   2134      'patterns': [r".*: warning: \[UnnecessaryTypeArgument\] .+"]},
   2135     {'category': 'java',
   2136      'severity': Severity.HIGH,
   2137      'description':
   2138          'Java: Instance created but never used',
   2139      'patterns': [r".*: warning: \[UnusedAnonymousClass\] .+"]},
   2140     {'category': 'java',
   2141      'severity': Severity.HIGH,
   2142      'description':
   2143          'Java: Collection is modified in place, but the result is not used',
   2144      'patterns': [r".*: warning: \[UnusedCollectionModifiedInPlace\] .+"]},
   2145     {'category': 'java',
   2146      'severity': Severity.HIGH,
   2147      'description':
   2148          'Java: `var` should not be used as a type name.',
   2149      'patterns': [r".*: warning: \[VarTypeName\] .+"]},
   2150 
   2151     # End warnings generated by Error Prone
   2152 
   2153     {'category': 'java',
   2154      'severity': Severity.UNKNOWN,
   2155      'description': 'Java: Unclassified/unrecognized warnings',
   2156      'patterns': [r".*: warning: \[.+\] .+"]},
   2157 
   2158     {'category': 'aapt', 'severity': Severity.MEDIUM,
   2159      'description': 'aapt: No default translation',
   2160      'patterns': [r".*: warning: string '.+' has no default translation in .*"]},
   2161     {'category': 'aapt', 'severity': Severity.MEDIUM,
   2162      'description': 'aapt: Missing default or required localization',
   2163      'patterns': [r".*: warning: \*\*\*\* string '.+' has no default or required localization for '.+' in .+"]},
   2164     {'category': 'aapt', 'severity': Severity.MEDIUM,
   2165      'description': 'aapt: String marked untranslatable, but translation exists',
   2166      'patterns': [r".*: warning: string '.+' in .* marked untranslatable but exists in locale '??_??'"]},
   2167     {'category': 'aapt', 'severity': Severity.MEDIUM,
   2168      'description': 'aapt: empty span in string',
   2169      'patterns': [r".*: warning: empty '.+' span found in text '.+"]},
   2170     {'category': 'C/C++', 'severity': Severity.MEDIUM,
   2171      'description': 'Taking address of temporary',
   2172      'patterns': [r".*: warning: taking address of temporary"]},
   2173     {'category': 'C/C++', 'severity': Severity.MEDIUM,
   2174      'description': 'Taking address of packed member',
   2175      'patterns': [r".*: warning: taking address of packed member"]},
   2176     {'category': 'C/C++', 'severity': Severity.MEDIUM,
   2177      'description': 'Possible broken line continuation',
   2178      'patterns': [r".*: warning: backslash and newline separated by space"]},
   2179     {'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': '-Wundefined-var-template',
   2180      'description': 'Undefined variable template',
   2181      'patterns': [r".*: warning: instantiation of variable .* no definition is available"]},
   2182     {'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': '-Wundefined-inline',
   2183      'description': 'Inline function is not defined',
   2184      'patterns': [r".*: warning: inline function '.*' is not defined"]},
   2185     {'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': '-Warray-bounds',
   2186      'description': 'Array subscript out of bounds',
   2187      'patterns': [r".*: warning: array subscript is above array bounds",
   2188                   r".*: warning: Array subscript is undefined",
   2189                   r".*: warning: array subscript is below array bounds"]},
   2190     {'category': 'C/C++', 'severity': Severity.MEDIUM,
   2191      'description': 'Excess elements in initializer',
   2192      'patterns': [r".*: warning: excess elements in .+ initializer"]},
   2193     {'category': 'C/C++', 'severity': Severity.MEDIUM,
   2194      'description': 'Decimal constant is unsigned only in ISO C90',
   2195      'patterns': [r".*: warning: this decimal constant is unsigned only in ISO C90"]},
   2196     {'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': '-Wmain',
   2197      'description': 'main is usually a function',
   2198      'patterns': [r".*: warning: 'main' is usually a function"]},
   2199     {'category': 'C/C++', 'severity': Severity.MEDIUM,
   2200      'description': 'Typedef ignored',
   2201      'patterns': [r".*: warning: 'typedef' was ignored in this declaration"]},
   2202     {'category': 'C/C++', 'severity': Severity.HIGH, 'option': '-Waddress',
   2203      'description': 'Address always evaluates to true',
   2204      'patterns': [r".*: warning: the address of '.+' will always evaluate as 'true'"]},
   2205     {'category': 'C/C++', 'severity': Severity.FIXMENOW,
   2206      'description': 'Freeing a non-heap object',
   2207      'patterns': [r".*: warning: attempt to free a non-heap object '.+'"]},
   2208     {'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': '-Wchar-subscripts',
   2209      'description': 'Array subscript has type char',
   2210      'patterns': [r".*: warning: array subscript .+ type 'char'.+Wchar-subscripts"]},
   2211     {'category': 'C/C++', 'severity': Severity.MEDIUM,
   2212      'description': 'Constant too large for type',
   2213      'patterns': [r".*: warning: integer constant is too large for '.+' type"]},
   2214     {'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': '-Woverflow',
   2215      'description': 'Constant too large for type, truncated',
   2216      'patterns': [r".*: warning: large integer implicitly truncated to unsigned type"]},
   2217     {'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': '-Winteger-overflow',
   2218      'description': 'Overflow in expression',
   2219      'patterns': [r".*: warning: overflow in expression; .*Winteger-overflow"]},
   2220     {'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': '-Woverflow',
   2221      'description': 'Overflow in implicit constant conversion',
   2222      'patterns': [r".*: warning: overflow in implicit constant conversion"]},
   2223     {'category': 'C/C++', 'severity': Severity.MEDIUM,
   2224      'description': 'Declaration does not declare anything',
   2225      'patterns': [r".*: warning: declaration 'class .+' does not declare anything"]},
   2226     {'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': '-Wreorder',
   2227      'description': 'Initialization order will be different',
   2228      'patterns': [r".*: warning: '.+' will be initialized after",
   2229                   r".*: warning: field .+ will be initialized after .+Wreorder"]},
   2230     {'category': 'cont.', 'severity': Severity.SKIP,
   2231      'description': 'skip,   ....',
   2232      'patterns': [r".*: warning:   '.+'"]},
   2233     {'category': 'cont.', 'severity': Severity.SKIP,
   2234      'description': 'skip,   base ...',
   2235      'patterns': [r".*: warning:   base '.+'"]},
   2236     {'category': 'cont.', 'severity': Severity.SKIP,
   2237      'description': 'skip,   when initialized here',
   2238      'patterns': [r".*: warning:   when initialized here"]},
   2239     {'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': '-Wmissing-parameter-type',
   2240      'description': 'Parameter type not specified',
   2241      'patterns': [r".*: warning: type of '.+' defaults to 'int'"]},
   2242     {'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': '-Wmissing-declarations',
   2243      'description': 'Missing declarations',
   2244      'patterns': [r".*: warning: declaration does not declare anything"]},
   2245     {'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': '-Wmissing-noreturn',
   2246      'description': 'Missing noreturn',
   2247      'patterns': [r".*: warning: function '.*' could be declared with attribute 'noreturn'"]},
   2248     # pylint:disable=anomalous-backslash-in-string
   2249     # TODO(chh): fix the backslash pylint warning.
   2250     {'category': 'gcc', 'severity': Severity.MEDIUM,
   2251      'description': 'Invalid option for C file',
   2252      'patterns': [r".*: warning: command line option "".+"" is valid for C\+\+\/ObjC\+\+ but not for C"]},
   2253     {'category': 'C/C++', 'severity': Severity.MEDIUM,
   2254      'description': 'User warning',
   2255      'patterns': [r".*: warning: #warning "".+"""]},
   2256     {'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': '-Wvexing-parse',
   2257      'description': 'Vexing parsing problem',
   2258      'patterns': [r".*: warning: empty parentheses interpreted as a function declaration"]},
   2259     {'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': '-Wextra',
   2260      'description': 'Dereferencing void*',
   2261      'patterns': [r".*: warning: dereferencing 'void \*' pointer"]},
   2262     {'category': 'C/C++', 'severity': Severity.MEDIUM,
   2263      'description': 'Comparison of pointer and integer',
   2264      'patterns': [r".*: warning: ordered comparison of pointer with integer zero",
   2265                   r".*: warning: .*comparison between pointer and integer"]},
   2266     {'category': 'C/C++', 'severity': Severity.MEDIUM,
   2267      'description': 'Use of error-prone unary operator',
   2268      'patterns': [r".*: warning: use of unary operator that may be intended as compound assignment"]},
   2269     {'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': '-Wwrite-strings',
   2270      'description': 'Conversion of string constant to non-const char*',
   2271      'patterns': [r".*: warning: deprecated conversion from string constant to '.+'"]},
   2272     {'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': '-Wstrict-prototypes',
   2273      'description': 'Function declaration isn''t a prototype',
   2274      'patterns': [r".*: warning: function declaration isn't a prototype"]},
   2275     {'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': '-Wignored-qualifiers',
   2276      'description': 'Type qualifiers ignored on function return value',
   2277      'patterns': [r".*: warning: type qualifiers ignored on function return type",
   2278                   r".*: warning: .+ type qualifier .+ has no effect .+Wignored-qualifiers"]},
   2279     {'category': 'C/C++', 'severity': Severity.MEDIUM,
   2280      'description': '<foo> declared inside parameter list, scope limited to this definition',
   2281      'patterns': [r".*: warning: '.+' declared inside parameter list"]},
   2282     {'category': 'cont.', 'severity': Severity.SKIP,
   2283      'description': 'skip, its scope is only this ...',
   2284      'patterns': [r".*: warning: its scope is only this definition or declaration, which is probably not what you want"]},
   2285     {'category': 'C/C++', 'severity': Severity.LOW, 'option': '-Wcomment',
   2286      'description': 'Line continuation inside comment',
   2287      'patterns': [r".*: warning: multi-line comment"]},
   2288     {'category': 'C/C++', 'severity': Severity.LOW, 'option': '-Wcomment',
   2289      'description': 'Comment inside comment',
   2290      'patterns': [r".*: warning: "".+"" within comment"]},
   2291     # Warning "value stored is never read" could be from clang-tidy or clang static analyzer.
   2292     {'category': 'C/C++', 'severity': Severity.ANALYZER,
   2293      'description': 'clang-analyzer Value stored is never read',
   2294      'patterns': [r".*: warning: Value stored to .+ is never read.*clang-analyzer-deadcode.DeadStores"]},
   2295     {'category': 'C/C++', 'severity': Severity.LOW,
   2296      'description': 'Value stored is never read',
   2297      'patterns': [r".*: warning: Value stored to .+ is never read"]},
   2298     {'category': 'C/C++', 'severity': Severity.LOW, 'option': '-Wdeprecated-declarations',
   2299      'description': 'Deprecated declarations',
   2300      'patterns': [r".*: warning: .+ is deprecated.+deprecated-declarations"]},
   2301     {'category': 'C/C++', 'severity': Severity.LOW, 'option': '-Wdeprecated-register',
   2302      'description': 'Deprecated register',
   2303      'patterns': [r".*: warning: 'register' storage class specifier is deprecated"]},
   2304     {'category': 'C/C++', 'severity': Severity.LOW, 'option': '-Wpointer-sign',
   2305      'description': 'Converts between pointers to integer types with different sign',
   2306      'patterns': [r".*: warning: .+ converts between pointers to integer types with different sign"]},
   2307     {'category': 'C/C++', 'severity': Severity.HARMLESS,
   2308      'description': 'Extra tokens after #endif',
   2309      'patterns': [r".*: warning: extra tokens at end of #endif directive"]},
   2310     {'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': '-Wenum-compare',
   2311      'description': 'Comparison between different enums',
   2312      'patterns': [r".*: warning: comparison between '.+' and '.+'.+Wenum-compare"]},
   2313     {'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': '-Wconversion',
   2314      'description': 'Conversion may change value',
   2315      'patterns': [r".*: warning: converting negative value '.+' to '.+'",
   2316                   r".*: warning: conversion to '.+' .+ may (alter|change)"]},
   2317     {'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': '-Wconversion-null',
   2318      'description': 'Converting to non-pointer type from NULL',
   2319      'patterns': [r".*: warning: converting to non-pointer type '.+' from NULL"]},
   2320     {'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': '-Wsign-conversion',
   2321      'description': 'Implicit sign conversion',
   2322      'patterns': [r".*: warning: implicit conversion changes signedness"]},
   2323     {'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': '-Wnull-conversion',
   2324      'description': 'Converting NULL to non-pointer type',
   2325      'patterns': [r".*: warning: implicit conversion of NULL constant to '.+'"]},
   2326     {'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': '-Wnon-literal-null-conversion',
   2327      'description': 'Zero used as null pointer',
   2328      'patterns': [r".*: warning: expression .* zero treated as a null pointer constant"]},
   2329     {'category': 'C/C++', 'severity': Severity.MEDIUM,
   2330      'description': 'Implicit conversion changes value',
   2331      'patterns': [r".*: warning: implicit conversion .* changes value from .* to .*-conversion"]},
   2332     {'category': 'C/C++', 'severity': Severity.MEDIUM,
   2333      'description': 'Passing NULL as non-pointer argument',
   2334      'patterns': [r".*: warning: passing NULL to non-pointer argument [0-9]+ of '.+'"]},
   2335     {'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': '-Wctor-dtor-privacy',
   2336      'description': 'Class seems unusable because of private ctor/dtor',
   2337      'patterns': [r".*: warning: all member functions in class '.+' are private"]},
   2338     # skip this next one, because it only points out some RefBase-based classes where having a private destructor is perfectly fine
   2339     {'category': 'C/C++', 'severity': Severity.SKIP, 'option': '-Wctor-dtor-privacy',
   2340      'description': 'Class seems unusable because of private ctor/dtor',
   2341      'patterns': [r".*: warning: 'class .+' only defines a private destructor and has no friends"]},
   2342     {'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': '-Wctor-dtor-privacy',
   2343      'description': 'Class seems unusable because of private ctor/dtor',
   2344      'patterns': [r".*: warning: 'class .+' only defines private constructors and has no friends"]},
   2345     {'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': '-Wgnu-static-float-init',
   2346      'description': 'In-class initializer for static const float/double',
   2347      'patterns': [r".*: warning: in-class initializer for static data member of .+const (float|double)"]},
   2348     {'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': '-Wpointer-arith',
   2349      'description': 'void* used in arithmetic',
   2350      'patterns': [r".*: warning: pointer of type 'void \*' used in (arithmetic|subtraction)",
   2351                   r".*: warning: arithmetic on .+ to void is a GNU extension.*Wpointer-arith",
   2352                   r".*: warning: wrong type argument to increment"]},
   2353     {'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': '-Wsign-promo',
   2354      'description': 'Overload resolution chose to promote from unsigned or enum to signed type',
   2355      'patterns': [r".*: warning: passing '.+' chooses '.+' over '.+'.*Wsign-promo"]},
   2356     {'category': 'cont.', 'severity': Severity.SKIP,
   2357      'description': 'skip,   in call to ...',
   2358      'patterns': [r".*: warning:   in call to '.+'"]},
   2359     {'category': 'C/C++', 'severity': Severity.HIGH, 'option': '-Wextra',
   2360      'description': 'Base should be explicitly initialized in copy constructor',
   2361      'patterns': [r".*: warning: base class '.+' should be explicitly initialized in the copy constructor"]},
   2362     {'category': 'C/C++', 'severity': Severity.MEDIUM,
   2363      'description': 'VLA has zero or negative size',
   2364      'patterns': [r".*: warning: Declared variable-length array \(VLA\) has .+ size"]},
   2365     {'category': 'C/C++', 'severity': Severity.MEDIUM,
   2366      'description': 'Return value from void function',
   2367      'patterns': [r".*: warning: 'return' with a value, in function returning void"]},
   2368     {'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': 'multichar',
   2369      'description': 'Multi-character character constant',
   2370      'patterns': [r".*: warning: multi-character character constant"]},
   2371     {'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': 'writable-strings',
   2372      'description': 'Conversion from string literal to char*',
   2373      'patterns': [r".*: warning: .+ does not allow conversion from string literal to 'char \*'"]},
   2374     {'category': 'C/C++', 'severity': Severity.LOW, 'option': '-Wextra-semi',
   2375      'description': 'Extra \';\'',
   2376      'patterns': [r".*: warning: extra ';' .+extra-semi"]},
   2377     {'category': 'C/C++', 'severity': Severity.LOW,
   2378      'description': 'Useless specifier',
   2379      'patterns': [r".*: warning: useless storage class specifier in empty declaration"]},
   2380     {'category': 'C/C++', 'severity': Severity.LOW, 'option': '-Wduplicate-decl-specifier',
   2381      'description': 'Duplicate declaration specifier',
   2382      'patterns': [r".*: warning: duplicate '.+' declaration specifier"]},
   2383     {'category': 'logtags', 'severity': Severity.LOW,
   2384      'description': 'Duplicate logtag',
   2385      'patterns': [r".*: warning: tag \".+\" \(.+\) duplicated in .+"]},
   2386     {'category': 'logtags', 'severity': Severity.LOW, 'option': 'typedef-redefinition',
   2387      'description': 'Typedef redefinition',
   2388      'patterns': [r".*: warning: redefinition of typedef '.+' is a C11 feature"]},
   2389     {'category': 'logtags', 'severity': Severity.LOW, 'option': 'gnu-designator',
   2390      'description': 'GNU old-style field designator',
   2391      'patterns': [r".*: warning: use of GNU old-style field designator extension"]},
   2392     {'category': 'logtags', 'severity': Severity.LOW, 'option': 'missing-field-initializers',
   2393      'description': 'Missing field initializers',
   2394      'patterns': [r".*: warning: missing field '.+' initializer"]},
   2395     {'category': 'logtags', 'severity': Severity.LOW, 'option': 'missing-braces',
   2396      'description': 'Missing braces',
   2397      'patterns': [r".*: warning: suggest braces around initialization of",
   2398                   r".*: warning: too many braces around scalar initializer .+Wmany-braces-around-scalar-init",
   2399                   r".*: warning: braces around scalar initializer"]},
   2400     {'category': 'logtags', 'severity': Severity.LOW, 'option': 'sign-compare',
   2401      'description': 'Comparison of integers of different signs',
   2402      'patterns': [r".*: warning: comparison of integers of different signs.+sign-compare"]},
   2403     {'category': 'logtags', 'severity': Severity.LOW, 'option': 'dangling-else',
   2404      'description': 'Add braces to avoid dangling else',
   2405      'patterns': [r".*: warning: add explicit braces to avoid dangling else"]},
   2406     {'category': 'logtags', 'severity': Severity.LOW, 'option': 'initializer-overrides',
   2407      'description': 'Initializer overrides prior initialization',
   2408      'patterns': [r".*: warning: initializer overrides prior initialization of this subobject"]},
   2409     {'category': 'logtags', 'severity': Severity.LOW, 'option': 'self-assign',
   2410      'description': 'Assigning value to self',
   2411      'patterns': [r".*: warning: explicitly assigning value of .+ to itself"]},
   2412     {'category': 'logtags', 'severity': Severity.LOW, 'option': 'gnu-variable-sized-type-not-at-end',
   2413      'description': 'GNU extension, variable sized type not at end',
   2414      'patterns': [r".*: warning: field '.+' with variable sized type '.+' not at the end of a struct or class"]},
   2415     {'category': 'logtags', 'severity': Severity.LOW, 'option': 'tautological-constant-out-of-range-compare',
   2416      'description': 'Comparison of constant is always false/true',
   2417      'patterns': [r".*: comparison of .+ is always .+Wtautological-constant-out-of-range-compare"]},
   2418     {'category': 'logtags', 'severity': Severity.LOW, 'option': 'overloaded-virtual',
   2419      'description': 'Hides overloaded virtual function',
   2420      'patterns': [r".*: '.+' hides overloaded virtual function"]},
   2421     {'category': 'logtags', 'severity': Severity.LOW, 'option': 'incompatible-pointer-types',
   2422      'description': 'Incompatible pointer types',
   2423      'patterns': [r".*: warning: incompatible pointer types .+Wincompatible-pointer-types"]},
   2424     {'category': 'logtags', 'severity': Severity.LOW, 'option': 'asm-operand-widths',
   2425      'description': 'ASM value size does not match register size',
   2426      'patterns': [r".*: warning: value size does not match register size specified by the constraint and modifier"]},
   2427     {'category': 'C/C++', 'severity': Severity.LOW, 'option': 'tautological-compare',
   2428      'description': 'Comparison of self is always false',
   2429      'patterns': [r".*: self-comparison always evaluates to false"]},
   2430     {'category': 'C/C++', 'severity': Severity.LOW, 'option': 'constant-logical-operand',
   2431      'description': 'Logical op with constant operand',
   2432      'patterns': [r".*: use of logical '.+' with constant operand"]},
   2433     {'category': 'C/C++', 'severity': Severity.LOW, 'option': 'literal-suffix',
   2434      'description': 'Needs a space between literal and string macro',
   2435      'patterns': [r".*: warning: invalid suffix on literal.+ requires a space .+Wliteral-suffix"]},
   2436     {'category': 'C/C++', 'severity': Severity.LOW, 'option': '#warnings',
   2437      'description': 'Warnings from #warning',
   2438      'patterns': [r".*: warning: .+-W#warnings"]},
   2439     {'category': 'C/C++', 'severity': Severity.LOW, 'option': 'absolute-value',
   2440      'description': 'Using float/int absolute value function with int/float argument',
   2441      'patterns': [r".*: warning: using .+ absolute value function .+ when argument is .+ type .+Wabsolute-value",
   2442                   r".*: warning: absolute value function '.+' given .+ which may cause truncation .+Wabsolute-value"]},
   2443     {'category': 'C/C++', 'severity': Severity.LOW, 'option': '-Wc++11-extensions',
   2444      'description': 'Using C++11 extensions',
   2445      'patterns': [r".*: warning: 'auto' type specifier is a C\+\+11 extension"]},
   2446     {'category': 'C/C++', 'severity': Severity.LOW,
   2447      'description': 'Refers to implicitly defined namespace',
   2448      'patterns': [r".*: warning: using directive refers to implicitly-defined namespace .+"]},
   2449     {'category': 'C/C++', 'severity': Severity.LOW, 'option': '-Winvalid-pp-token',
   2450      'description': 'Invalid pp token',
   2451      'patterns': [r".*: warning: missing .+Winvalid-pp-token"]},
   2452     {'category': 'link', 'severity': Severity.LOW,
   2453      'description': 'need glibc to link',
   2454      'patterns': [r".*: warning: .* requires at runtime .* glibc .* for linking"]},
   2455 
   2456     {'category': 'C/C++', 'severity': Severity.MEDIUM,
   2457      'description': 'Operator new returns NULL',
   2458      'patterns': [r".*: warning: 'operator new' must not return NULL unless it is declared 'throw\(\)' .+"]},
   2459     {'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': '-Wnull-arithmetic',
   2460      'description': 'NULL used in arithmetic',
   2461      'patterns': [r".*: warning: NULL used in arithmetic",
   2462                   r".*: warning: comparison between NULL and non-pointer"]},
   2463     {'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': 'header-guard',
   2464      'description': 'Misspelled header guard',
   2465      'patterns': [r".*: warning: '.+' is used as a header guard .+ followed by .+ different macro"]},
   2466     {'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': 'empty-body',
   2467      'description': 'Empty loop body',
   2468      'patterns': [r".*: warning: .+ loop has empty body"]},
   2469     {'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': 'enum-conversion',
   2470      'description': 'Implicit conversion from enumeration type',
   2471      'patterns': [r".*: warning: implicit conversion from enumeration type '.+'"]},
   2472     {'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': 'switch',
   2473      'description': 'case value not in enumerated type',
   2474      'patterns': [r".*: warning: case value not in enumerated type '.+'"]},
   2475     {'category': 'C/C++', 'severity': Severity.MEDIUM,
   2476      'description': 'Undefined result',
   2477      'patterns': [r".*: warning: The result of .+ is undefined",
   2478                   r".*: warning: passing an object that .+ has undefined behavior \[-Wvarargs\]",
   2479                   r".*: warning: 'this' pointer cannot be null in well-defined C\+\+ code;",
   2480                   r".*: warning: shifting a negative signed value is undefined"]},
   2481     {'category': 'C/C++', 'severity': Severity.MEDIUM,
   2482      'description': 'Division by zero',
   2483      'patterns': [r".*: warning: Division by zero"]},
   2484     {'category': 'C/C++', 'severity': Severity.MEDIUM,
   2485      'description': 'Use of deprecated method',
   2486      'patterns': [r".*: warning: '.+' is deprecated .+"]},
   2487     {'category': 'C/C++', 'severity': Severity.MEDIUM,
   2488      'description': 'Use of garbage or uninitialized value',
   2489      'patterns': [r".*: warning: .+ is a garbage value",
   2490                   r".*: warning: Function call argument is an uninitialized value",
   2491                   r".*: warning: Undefined or garbage value returned to caller",
   2492                   r".*: warning: Called .+ pointer is.+uninitialized",
   2493                   r".*: warning: Called .+ pointer is.+uninitalized",  # match a typo in compiler message
   2494                   r".*: warning: Use of zero-allocated memory",
   2495                   r".*: warning: Dereference of undefined pointer value",
   2496                   r".*: warning: Passed-by-value .+ contains uninitialized data",
   2497                   r".*: warning: Branch condition evaluates to a garbage value",
   2498                   r".*: warning: The .+ of .+ is an uninitialized value.",
   2499                   r".*: warning: .+ is used uninitialized whenever .+sometimes-uninitialized",
   2500                   r".*: warning: Assigned value is garbage or undefined"]},
   2501     {'category': 'C/C++', 'severity': Severity.MEDIUM,
   2502      'description': 'Result of malloc type incompatible with sizeof operand type',
   2503      'patterns': [r".*: warning: Result of '.+' is converted to .+ incompatible with sizeof operand type"]},
   2504     {'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': '-Wsizeof-array-argument',
   2505      'description': 'Sizeof on array argument',
   2506      'patterns': [r".*: warning: sizeof on array function parameter will return"]},
   2507     {'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': '-Wsizeof-pointer-memacces',
   2508      'description': 'Bad argument size of memory access functions',
   2509      'patterns': [r".*: warning: .+\[-Wsizeof-pointer-memaccess\]"]},
   2510     {'category': 'C/C++', 'severity': Severity.MEDIUM,
   2511      'description': 'Return value not checked',
   2512      'patterns': [r".*: warning: The return value from .+ is not checked"]},
   2513     {'category': 'C/C++', 'severity': Severity.MEDIUM,
   2514      'description': 'Possible heap pollution',
   2515      'patterns': [r".*: warning: .*Possible heap pollution from .+ type .+"]},
   2516     {'category': 'C/C++', 'severity': Severity.MEDIUM,
   2517      'description': 'Allocation size of 0 byte',
   2518      'patterns': [r".*: warning: Call to .+ has an allocation size of 0 byte"]},
   2519     {'category': 'C/C++', 'severity': Severity.MEDIUM,
   2520      'description': 'Result of malloc type incompatible with sizeof operand type',
   2521      'patterns': [r".*: warning: Result of '.+' is converted to .+ incompatible with sizeof operand type"]},
   2522     {'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': '-Wfor-loop-analysis',
   2523      'description': 'Variable used in loop condition not modified in loop body',
   2524      'patterns': [r".*: warning: variable '.+' used in loop condition.*Wfor-loop-analysis"]},
   2525     {'category': 'C/C++', 'severity': Severity.MEDIUM,
   2526      'description': 'Closing a previously closed file',
   2527      'patterns': [r".*: warning: Closing a previously closed file"]},
   2528     {'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': '-Wunnamed-type-template-args',
   2529      'description': 'Unnamed template type argument',
   2530      'patterns': [r".*: warning: template argument.+Wunnamed-type-template-args"]},
   2531     {'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': '-Wimplicit-fallthrough',
   2532      'description': 'Unannotated fall-through between switch labels',
   2533      'patterns': [r".*: warning: unannotated fall-through between switch labels.+Wimplicit-fallthrough"]},
   2534 
   2535     {'category': 'C/C++', 'severity': Severity.HARMLESS,
   2536      'description': 'Discarded qualifier from pointer target type',
   2537      'patterns': [r".*: warning: .+ discards '.+' qualifier from pointer target type"]},
   2538     {'category': 'C/C++', 'severity': Severity.HARMLESS,
   2539      'description': 'Use snprintf instead of sprintf',
   2540      'patterns': [r".*: warning: .*sprintf is often misused; please use snprintf"]},
   2541     {'category': 'C/C++', 'severity': Severity.HARMLESS,
   2542      'description': 'Unsupported optimizaton flag',
   2543      'patterns': [r".*: warning: optimization flag '.+' is not supported"]},
   2544     {'category': 'C/C++', 'severity': Severity.HARMLESS,
   2545      'description': 'Extra or missing parentheses',
   2546      'patterns': [r".*: warning: equality comparison with extraneous parentheses",
   2547                   r".*: warning: .+ within .+Wlogical-op-parentheses"]},
   2548     {'category': 'C/C++', 'severity': Severity.HARMLESS, 'option': 'mismatched-tags',
   2549      'description': 'Mismatched class vs struct tags',
   2550      'patterns': [r".*: warning: '.+' defined as a .+ here but previously declared as a .+mismatched-tags",
   2551                   r".*: warning: .+ was previously declared as a .+mismatched-tags"]},
   2552     {'category': 'FindEmulator', 'severity': Severity.HARMLESS,
   2553      'description': 'FindEmulator: No such file or directory',
   2554      'patterns': [r".*: warning: FindEmulator: .* No such file or directory"]},
   2555     {'category': 'google_tests', 'severity': Severity.HARMLESS,
   2556      'description': 'google_tests: unknown installed file',
   2557      'patterns': [r".*: warning: .*_tests: Unknown installed file for module"]},
   2558     {'category': 'make', 'severity': Severity.HARMLESS,
   2559      'description': 'unusual tags debug eng',
   2560      'patterns': [r".*: warning: .*: unusual tags debug eng"]},
   2561 
   2562     # these next ones are to deal with formatting problems resulting from the log being mixed up by 'make -j'
   2563     {'category': 'C/C++', 'severity': Severity.SKIP,
   2564      'description': 'skip, ,',
   2565      'patterns': [r".*: warning: ,$"]},
   2566     {'category': 'C/C++', 'severity': Severity.SKIP,
   2567      'description': 'skip,',
   2568      'patterns': [r".*: warning: $"]},
   2569     {'category': 'C/C++', 'severity': Severity.SKIP,
   2570      'description': 'skip, In file included from ...',
   2571      'patterns': [r".*: warning: In file included from .+,"]},
   2572 
   2573     # warnings from clang-tidy
   2574     group_tidy_warn_pattern('android'),
   2575     simple_tidy_warn_pattern('bugprone-argument-comment'),
   2576     simple_tidy_warn_pattern('bugprone-copy-constructor-init'),
   2577     simple_tidy_warn_pattern('bugprone-fold-init-type'),
   2578     simple_tidy_warn_pattern('bugprone-forward-declaration-namespace'),
   2579     simple_tidy_warn_pattern('bugprone-forwarding-reference-overload'),
   2580     simple_tidy_warn_pattern('bugprone-inaccurate-erase'),
   2581     simple_tidy_warn_pattern('bugprone-incorrect-roundings'),
   2582     simple_tidy_warn_pattern('bugprone-integer-division'),
   2583     simple_tidy_warn_pattern('bugprone-lambda-function-name'),
   2584     simple_tidy_warn_pattern('bugprone-macro-parentheses'),
   2585     simple_tidy_warn_pattern('bugprone-misplaced-widening-cast'),
   2586     simple_tidy_warn_pattern('bugprone-move-forwarding-reference'),
   2587     simple_tidy_warn_pattern('bugprone-sizeof-expression'),
   2588     simple_tidy_warn_pattern('bugprone-string-constructor'),
   2589     simple_tidy_warn_pattern('bugprone-string-integer-assignment'),
   2590     simple_tidy_warn_pattern('bugprone-suspicious-enum-usage'),
   2591     simple_tidy_warn_pattern('bugprone-suspicious-missing-comma'),
   2592     simple_tidy_warn_pattern('bugprone-suspicious-string-compare'),
   2593     simple_tidy_warn_pattern('bugprone-suspicious-semicolon'),
   2594     simple_tidy_warn_pattern('bugprone-undefined-memory-manipulation'),
   2595     simple_tidy_warn_pattern('bugprone-unused-raii'),
   2596     simple_tidy_warn_pattern('bugprone-use-after-move'),
   2597     group_tidy_warn_pattern('bugprone'),
   2598     group_tidy_warn_pattern('cert'),
   2599     group_tidy_warn_pattern('clang-diagnostic'),
   2600     group_tidy_warn_pattern('cppcoreguidelines'),
   2601     group_tidy_warn_pattern('llvm'),
   2602     simple_tidy_warn_pattern('google-default-arguments'),
   2603     simple_tidy_warn_pattern('google-runtime-int'),
   2604     simple_tidy_warn_pattern('google-runtime-operator'),
   2605     simple_tidy_warn_pattern('google-runtime-references'),
   2606     group_tidy_warn_pattern('google-build'),
   2607     group_tidy_warn_pattern('google-explicit'),
   2608     group_tidy_warn_pattern('google-redability'),
   2609     group_tidy_warn_pattern('google-global'),
   2610     group_tidy_warn_pattern('google-redability'),
   2611     group_tidy_warn_pattern('google-redability'),
   2612     group_tidy_warn_pattern('google'),
   2613     simple_tidy_warn_pattern('hicpp-explicit-conversions'),
   2614     simple_tidy_warn_pattern('hicpp-function-size'),
   2615     simple_tidy_warn_pattern('hicpp-invalid-access-moved'),
   2616     simple_tidy_warn_pattern('hicpp-member-init'),
   2617     simple_tidy_warn_pattern('hicpp-delete-operators'),
   2618     simple_tidy_warn_pattern('hicpp-special-member-functions'),
   2619     simple_tidy_warn_pattern('hicpp-use-equals-default'),
   2620     simple_tidy_warn_pattern('hicpp-use-equals-delete'),
   2621     simple_tidy_warn_pattern('hicpp-no-assembler'),
   2622     simple_tidy_warn_pattern('hicpp-noexcept-move'),
   2623     simple_tidy_warn_pattern('hicpp-use-override'),
   2624     group_tidy_warn_pattern('hicpp'),
   2625     group_tidy_warn_pattern('modernize'),
   2626     group_tidy_warn_pattern('misc'),
   2627     simple_tidy_warn_pattern('performance-faster-string-find'),
   2628     simple_tidy_warn_pattern('performance-for-range-copy'),
   2629     simple_tidy_warn_pattern('performance-implicit-cast-in-loop'),
   2630     simple_tidy_warn_pattern('performance-inefficient-string-concatenation'),
   2631     simple_tidy_warn_pattern('performance-type-promotion-in-math-fn'),
   2632     simple_tidy_warn_pattern('performance-unnecessary-copy-initialization'),
   2633     simple_tidy_warn_pattern('performance-unnecessary-value-param'),
   2634     group_tidy_warn_pattern('performance'),
   2635     group_tidy_warn_pattern('readability'),
   2636 
   2637     # warnings from clang-tidy's clang-analyzer checks
   2638     {'category': 'C/C++', 'severity': Severity.ANALYZER,
   2639      'description': 'clang-analyzer Unreachable code',
   2640      'patterns': [r".*: warning: This statement is never executed.*UnreachableCode"]},
   2641     {'category': 'C/C++', 'severity': Severity.ANALYZER,
   2642      'description': 'clang-analyzer Size of malloc may overflow',
   2643      'patterns': [r".*: warning: .* size of .* may overflow .*MallocOverflow"]},
   2644     {'category': 'C/C++', 'severity': Severity.ANALYZER,
   2645      'description': 'clang-analyzer Stream pointer might be NULL',
   2646      'patterns': [r".*: warning: Stream pointer might be NULL .*unix.Stream"]},
   2647     {'category': 'C/C++', 'severity': Severity.ANALYZER,
   2648      'description': 'clang-analyzer Opened file never closed',
   2649      'patterns': [r".*: warning: Opened File never closed.*unix.Stream"]},
   2650     {'category': 'C/C++', 'severity': Severity.ANALYZER,
   2651      'description': 'clang-analyzer sozeof() on a pointer type',
   2652      'patterns': [r".*: warning: .*calls sizeof.* on a pointer type.*SizeofPtr"]},
   2653     {'category': 'C/C++', 'severity': Severity.ANALYZER,
   2654      'description': 'clang-analyzer Pointer arithmetic on non-array variables',
   2655      'patterns': [r".*: warning: Pointer arithmetic on non-array variables .*PointerArithm"]},
   2656     {'category': 'C/C++', 'severity': Severity.ANALYZER,
   2657      'description': 'clang-analyzer Subtraction of pointers of different memory chunks',
   2658      'patterns': [r".*: warning: Subtraction of two pointers .*PointerSub"]},
   2659     {'category': 'C/C++', 'severity': Severity.ANALYZER,
   2660      'description': 'clang-analyzer Access out-of-bound array element',
   2661      'patterns': [r".*: warning: Access out-of-bound array element .*ArrayBound"]},
   2662     {'category': 'C/C++', 'severity': Severity.ANALYZER,
   2663      'description': 'clang-analyzer Out of bound memory access',
   2664      'patterns': [r".*: warning: Out of bound memory access .*ArrayBoundV2"]},
   2665     {'category': 'C/C++', 'severity': Severity.ANALYZER,
   2666      'description': 'clang-analyzer Possible lock order reversal',
   2667      'patterns': [r".*: warning: .* Possible lock order reversal.*PthreadLock"]},
   2668     {'category': 'C/C++', 'severity': Severity.ANALYZER,
   2669      'description': 'clang-analyzer Argument is a pointer to uninitialized value',
   2670      'patterns': [r".*: warning: .* argument is a pointer to uninitialized value .*CallAndMessage"]},
   2671     {'category': 'C/C++', 'severity': Severity.ANALYZER,
   2672      'description': 'clang-analyzer cast to struct',
   2673      'patterns': [r".*: warning: Casting a non-structure type to a structure type .*CastToStruct"]},
   2674     {'category': 'C/C++', 'severity': Severity.ANALYZER,
   2675      'description': 'clang-analyzer call path problems',
   2676      'patterns': [r".*: warning: Call Path : .+"]},
   2677     {'category': 'C/C++', 'severity': Severity.ANALYZER,
   2678      'description': 'clang-analyzer excessive padding',
   2679      'patterns': [r".*: warning: Excessive padding in '.*'"]},
   2680     {'category': 'C/C++', 'severity': Severity.ANALYZER,
   2681      'description': 'clang-analyzer other',
   2682      'patterns': [r".*: .+\[clang-analyzer-.+\]$",
   2683                   r".*: Call Path : .+$"]},
   2684 
   2685     # catch-all for warnings this script doesn't know about yet
   2686     {'category': 'C/C++', 'severity': Severity.UNKNOWN,
   2687      'description': 'Unclassified/unrecognized warnings',
   2688      'patterns': [r".*: warning: .+"]},
   2689 ]
   2690 
   2691 
   2692 def project_name_and_pattern(name, pattern):
   2693   return [name, '(^|.*/)' + pattern + '/.*: warning:']
   2694 
   2695 
   2696 def simple_project_pattern(pattern):
   2697   return project_name_and_pattern(pattern, pattern)
   2698 
   2699 
   2700 # A list of [project_name, file_path_pattern].
   2701 # project_name should not contain comma, to be used in CSV output.
   2702 project_list = [
   2703     simple_project_pattern('art'),
   2704     simple_project_pattern('bionic'),
   2705     simple_project_pattern('bootable'),
   2706     simple_project_pattern('build'),
   2707     simple_project_pattern('cts'),
   2708     simple_project_pattern('dalvik'),
   2709     simple_project_pattern('developers'),
   2710     simple_project_pattern('development'),
   2711     simple_project_pattern('device'),
   2712     simple_project_pattern('doc'),
   2713     # match external/google* before external/
   2714     project_name_and_pattern('external/google', 'external/google.*'),
   2715     project_name_and_pattern('external/non-google', 'external'),
   2716     simple_project_pattern('frameworks/av/camera'),
   2717     simple_project_pattern('frameworks/av/cmds'),
   2718     simple_project_pattern('frameworks/av/drm'),
   2719     simple_project_pattern('frameworks/av/include'),
   2720     simple_project_pattern('frameworks/av/media/img_utils'),
   2721     simple_project_pattern('frameworks/av/media/libcpustats'),
   2722     simple_project_pattern('frameworks/av/media/libeffects'),
   2723     simple_project_pattern('frameworks/av/media/libmediaplayerservice'),
   2724     simple_project_pattern('frameworks/av/media/libmedia'),
   2725     simple_project_pattern('frameworks/av/media/libstagefright'),
   2726     simple_project_pattern('frameworks/av/media/mtp'),
   2727     simple_project_pattern('frameworks/av/media/ndk'),
   2728     simple_project_pattern('frameworks/av/media/utils'),
   2729     project_name_and_pattern('frameworks/av/media/Other',
   2730                              'frameworks/av/media'),
   2731     simple_project_pattern('frameworks/av/radio'),
   2732     simple_project_pattern('frameworks/av/services'),
   2733     simple_project_pattern('frameworks/av/soundtrigger'),
   2734     project_name_and_pattern('frameworks/av/Other', 'frameworks/av'),
   2735     simple_project_pattern('frameworks/base/cmds'),
   2736     simple_project_pattern('frameworks/base/core'),
   2737     simple_project_pattern('frameworks/base/drm'),
   2738     simple_project_pattern('frameworks/base/media'),
   2739     simple_project_pattern('frameworks/base/libs'),
   2740     simple_project_pattern('frameworks/base/native'),
   2741     simple_project_pattern('frameworks/base/packages'),
   2742     simple_project_pattern('frameworks/base/rs'),
   2743     simple_project_pattern('frameworks/base/services'),
   2744     simple_project_pattern('frameworks/base/tests'),
   2745     simple_project_pattern('frameworks/base/tools'),
   2746     project_name_and_pattern('frameworks/base/Other', 'frameworks/base'),
   2747     simple_project_pattern('frameworks/compile/libbcc'),
   2748     simple_project_pattern('frameworks/compile/mclinker'),
   2749     simple_project_pattern('frameworks/compile/slang'),
   2750     project_name_and_pattern('frameworks/compile/Other', 'frameworks/compile'),
   2751     simple_project_pattern('frameworks/minikin'),
   2752     simple_project_pattern('frameworks/ml'),
   2753     simple_project_pattern('frameworks/native/cmds'),
   2754     simple_project_pattern('frameworks/native/include'),
   2755     simple_project_pattern('frameworks/native/libs'),
   2756     simple_project_pattern('frameworks/native/opengl'),
   2757     simple_project_pattern('frameworks/native/services'),
   2758     simple_project_pattern('frameworks/native/vulkan'),
   2759     project_name_and_pattern('frameworks/native/Other', 'frameworks/native'),
   2760     simple_project_pattern('frameworks/opt'),
   2761     simple_project_pattern('frameworks/rs'),
   2762     simple_project_pattern('frameworks/webview'),
   2763     simple_project_pattern('frameworks/wilhelm'),
   2764     project_name_and_pattern('frameworks/Other', 'frameworks'),
   2765     simple_project_pattern('hardware/akm'),
   2766     simple_project_pattern('hardware/broadcom'),
   2767     simple_project_pattern('hardware/google'),
   2768     simple_project_pattern('hardware/intel'),
   2769     simple_project_pattern('hardware/interfaces'),
   2770     simple_project_pattern('hardware/libhardware'),
   2771     simple_project_pattern('hardware/libhardware_legacy'),
   2772     simple_project_pattern('hardware/qcom'),
   2773     simple_project_pattern('hardware/ril'),
   2774     project_name_and_pattern('hardware/Other', 'hardware'),
   2775     simple_project_pattern('kernel'),
   2776     simple_project_pattern('libcore'),
   2777     simple_project_pattern('libnativehelper'),
   2778     simple_project_pattern('ndk'),
   2779     # match vendor/unbungled_google/packages before other packages
   2780     simple_project_pattern('unbundled_google'),
   2781     simple_project_pattern('packages'),
   2782     simple_project_pattern('pdk'),
   2783     simple_project_pattern('prebuilts'),
   2784     simple_project_pattern('system/bt'),
   2785     simple_project_pattern('system/connectivity'),
   2786     simple_project_pattern('system/core/adb'),
   2787     simple_project_pattern('system/core/base'),
   2788     simple_project_pattern('system/core/debuggerd'),
   2789     simple_project_pattern('system/core/fastboot'),
   2790     simple_project_pattern('system/core/fingerprintd'),
   2791     simple_project_pattern('system/core/fs_mgr'),
   2792     simple_project_pattern('system/core/gatekeeperd'),
   2793     simple_project_pattern('system/core/healthd'),
   2794     simple_project_pattern('system/core/include'),
   2795     simple_project_pattern('system/core/init'),
   2796     simple_project_pattern('system/core/libbacktrace'),
   2797     simple_project_pattern('system/core/liblog'),
   2798     simple_project_pattern('system/core/libpixelflinger'),
   2799     simple_project_pattern('system/core/libprocessgroup'),
   2800     simple_project_pattern('system/core/libsysutils'),
   2801     simple_project_pattern('system/core/logcat'),
   2802     simple_project_pattern('system/core/logd'),
   2803     simple_project_pattern('system/core/run-as'),
   2804     simple_project_pattern('system/core/sdcard'),
   2805     simple_project_pattern('system/core/toolbox'),
   2806     project_name_and_pattern('system/core/Other', 'system/core'),
   2807     simple_project_pattern('system/extras/ANRdaemon'),
   2808     simple_project_pattern('system/extras/cpustats'),
   2809     simple_project_pattern('system/extras/crypto-perf'),
   2810     simple_project_pattern('system/extras/ext4_utils'),
   2811     simple_project_pattern('system/extras/f2fs_utils'),
   2812     simple_project_pattern('system/extras/iotop'),
   2813     simple_project_pattern('system/extras/libfec'),
   2814     simple_project_pattern('system/extras/memory_replay'),
   2815     simple_project_pattern('system/extras/mmap-perf'),
   2816     simple_project_pattern('system/extras/multinetwork'),
   2817     simple_project_pattern('system/extras/perfprofd'),
   2818     simple_project_pattern('system/extras/procrank'),
   2819     simple_project_pattern('system/extras/runconuid'),
   2820     simple_project_pattern('system/extras/showmap'),
   2821     simple_project_pattern('system/extras/simpleperf'),
   2822     simple_project_pattern('system/extras/su'),
   2823     simple_project_pattern('system/extras/tests'),
   2824     simple_project_pattern('system/extras/verity'),
   2825     project_name_and_pattern('system/extras/Other', 'system/extras'),
   2826     simple_project_pattern('system/gatekeeper'),
   2827     simple_project_pattern('system/keymaster'),
   2828     simple_project_pattern('system/libhidl'),
   2829     simple_project_pattern('system/libhwbinder'),
   2830     simple_project_pattern('system/media'),
   2831     simple_project_pattern('system/netd'),
   2832     simple_project_pattern('system/nvram'),
   2833     simple_project_pattern('system/security'),
   2834     simple_project_pattern('system/sepolicy'),
   2835     simple_project_pattern('system/tools'),
   2836     simple_project_pattern('system/update_engine'),
   2837     simple_project_pattern('system/vold'),
   2838     project_name_and_pattern('system/Other', 'system'),
   2839     simple_project_pattern('toolchain'),
   2840     simple_project_pattern('test'),
   2841     simple_project_pattern('tools'),
   2842     # match vendor/google* before vendor/
   2843     project_name_and_pattern('vendor/google', 'vendor/google.*'),
   2844     project_name_and_pattern('vendor/non-google', 'vendor'),
   2845     # keep out/obj and other patterns at the end.
   2846     ['out/obj',
   2847      '.*/(gen|obj[^/]*)/(include|EXECUTABLES|SHARED_LIBRARIES|'
   2848      'STATIC_LIBRARIES|NATIVE_TESTS)/.*: warning:'],
   2849     ['other', '.*']  # all other unrecognized patterns
   2850 ]
   2851 
   2852 project_patterns = []
   2853 project_names = []
   2854 warning_messages = []
   2855 warning_records = []
   2856 
   2857 
   2858 def initialize_arrays():
   2859   """Complete global arrays before they are used."""
   2860   global project_names, project_patterns
   2861   project_names = [p[0] for p in project_list]
   2862   project_patterns = [re.compile(p[1]) for p in project_list]
   2863   for w in warn_patterns:
   2864     w['members'] = []
   2865     if 'option' not in w:
   2866       w['option'] = ''
   2867     # Each warning pattern has a 'projects' dictionary, that
   2868     # maps a project name to number of warnings in that project.
   2869     w['projects'] = {}
   2870 
   2871 
   2872 initialize_arrays()
   2873 
   2874 
   2875 android_root = ''
   2876 platform_version = 'unknown'
   2877 target_product = 'unknown'
   2878 target_variant = 'unknown'
   2879 
   2880 
   2881 ##### Data and functions to dump html file. ##################################
   2882 
   2883 html_head_scripts = """\
   2884   <script type="text/javascript">
   2885   function expand(id) {
   2886     var e = document.getElementById(id);
   2887     var f = document.getElementById(id + "_mark");
   2888     if (e.style.display == 'block') {
   2889        e.style.display = 'none';
   2890        f.innerHTML = '&#x2295';
   2891     }
   2892     else {
   2893        e.style.display = 'block';
   2894        f.innerHTML = '&#x2296';
   2895     }
   2896   };
   2897   function expandCollapse(show) {
   2898     for (var id = 1; ; id++) {
   2899       var e = document.getElementById(id + "");
   2900       var f = document.getElementById(id + "_mark");
   2901       if (!e || !f) break;
   2902       e.style.display = (show ? 'block' : 'none');
   2903       f.innerHTML = (show ? '&#x2296' : '&#x2295');
   2904     }
   2905   };
   2906   </script>
   2907   <style type="text/css">
   2908   th,td{border-collapse:collapse; border:1px solid black;}
   2909   .button{color:blue;font-size:110%;font-weight:bolder;}
   2910   .bt{color:black;background-color:transparent;border:none;outline:none;
   2911       font-size:140%;font-weight:bolder;}
   2912   .c0{background-color:#e0e0e0;}
   2913   .c1{background-color:#d0d0d0;}
   2914   .t1{border-collapse:collapse; width:100%; border:1px solid black;}
   2915   </style>
   2916   <script src="https://www.gstatic.com/charts/loader.js"></script>
   2917 """
   2918 
   2919 
   2920 def html_big(param):
   2921   return '<font size="+2">' + param + '</font>'
   2922 
   2923 
   2924 def dump_html_prologue(title):
   2925   print '<html>\n<head>'
   2926   print '<title>' + title + '</title>'
   2927   print html_head_scripts
   2928   emit_stats_by_project()
   2929   print '</head>\n<body>'
   2930   print html_big(title)
   2931   print '<p>'
   2932 
   2933 
   2934 def dump_html_epilogue():
   2935   print '</body>\n</head>\n</html>'
   2936 
   2937 
   2938 def sort_warnings():
   2939   for i in warn_patterns:
   2940     i['members'] = sorted(set(i['members']))
   2941 
   2942 
   2943 def emit_stats_by_project():
   2944   """Dump a google chart table of warnings per project and severity."""
   2945   # warnings[p][s] is number of warnings in project p of severity s.
   2946   warnings = {p: {s: 0 for s in Severity.range} for p in project_names}
   2947   for i in warn_patterns:
   2948     s = i['severity']
   2949     for p in i['projects']:
   2950       warnings[p][s] += i['projects'][p]
   2951 
   2952   # total_by_project[p] is number of warnings in project p.
   2953   total_by_project = {p: sum(warnings[p][s] for s in Severity.range)
   2954                       for p in project_names}
   2955 
   2956   # total_by_severity[s] is number of warnings of severity s.
   2957   total_by_severity = {s: sum(warnings[p][s] for p in project_names)
   2958                        for s in Severity.range}
   2959 
   2960   # emit table header
   2961   stats_header = ['Project']
   2962   for s in Severity.range:
   2963     if total_by_severity[s]:
   2964       stats_header.append("<span style='background-color:{}'>{}</span>".
   2965                           format(Severity.colors[s],
   2966                                  Severity.column_headers[s]))
   2967   stats_header.append('TOTAL')
   2968 
   2969   # emit a row of warning counts per project, skip no-warning projects
   2970   total_all_projects = 0
   2971   stats_rows = []
   2972   for p in project_names:
   2973     if total_by_project[p]:
   2974       one_row = [p]
   2975       for s in Severity.range:
   2976         if total_by_severity[s]:
   2977           one_row.append(warnings[p][s])
   2978       one_row.append(total_by_project[p])
   2979       stats_rows.append(one_row)
   2980       total_all_projects += total_by_project[p]
   2981 
   2982   # emit a row of warning counts per severity
   2983   total_all_severities = 0
   2984   one_row = ['<b>TOTAL</b>']
   2985   for s in Severity.range:
   2986     if total_by_severity[s]:
   2987       one_row.append(total_by_severity[s])
   2988       total_all_severities += total_by_severity[s]
   2989   one_row.append(total_all_projects)
   2990   stats_rows.append(one_row)
   2991   print '<script>'
   2992   emit_const_string_array('StatsHeader', stats_header)
   2993   emit_const_object_array('StatsRows', stats_rows)
   2994   print draw_table_javascript
   2995   print '</script>'
   2996 
   2997 
   2998 def dump_stats():
   2999   """Dump some stats about total number of warnings and such."""
   3000   known = 0
   3001   skipped = 0
   3002   unknown = 0
   3003   sort_warnings()
   3004   for i in warn_patterns:
   3005     if i['severity'] == Severity.UNKNOWN:
   3006       unknown += len(i['members'])
   3007     elif i['severity'] == Severity.SKIP:
   3008       skipped += len(i['members'])
   3009     else:
   3010       known += len(i['members'])
   3011   print 'Number of classified warnings: <b>' + str(known) + '</b><br>'
   3012   print 'Number of skipped warnings: <b>' + str(skipped) + '</b><br>'
   3013   print 'Number of unclassified warnings: <b>' + str(unknown) + '</b><br>'
   3014   total = unknown + known + skipped
   3015   extra_msg = ''
   3016   if total < 1000:
   3017     extra_msg = ' (low count may indicate incremental build)'
   3018   print 'Total number of warnings: <b>' + str(total) + '</b>' + extra_msg
   3019 
   3020 
   3021 # New base table of warnings, [severity, warn_id, project, warning_message]
   3022 # Need buttons to show warnings in different grouping options.
   3023 # (1) Current, group by severity, id for each warning pattern
   3024 #     sort by severity, warn_id, warning_message
   3025 # (2) Current --byproject, group by severity,
   3026 #     id for each warning pattern + project name
   3027 #     sort by severity, warn_id, project, warning_message
   3028 # (3) New, group by project + severity,
   3029 #     id for each warning pattern
   3030 #     sort by project, severity, warn_id, warning_message
   3031 def emit_buttons():
   3032   print ('<button class="button" onclick="expandCollapse(1);">'
   3033          'Expand all warnings</button>\n'
   3034          '<button class="button" onclick="expandCollapse(0);">'
   3035          'Collapse all warnings</button>\n'
   3036          '<button class="button" onclick="groupBySeverity();">'
   3037          'Group warnings by severity</button>\n'
   3038          '<button class="button" onclick="groupByProject();">'
   3039          'Group warnings by project</button><br>')
   3040 
   3041 
   3042 def all_patterns(category):
   3043   patterns = ''
   3044   for i in category['patterns']:
   3045     patterns += i
   3046     patterns += ' / '
   3047   return patterns
   3048 
   3049 
   3050 def dump_fixed():
   3051   """Show which warnings no longer occur."""
   3052   anchor = 'fixed_warnings'
   3053   mark = anchor + '_mark'
   3054   print ('\n<br><p style="background-color:lightblue"><b>'
   3055          '<button id="' + mark + '" '
   3056          'class="bt" onclick="expand(\'' + anchor + '\');">'
   3057          '&#x2295</button> Fixed warnings. '
   3058          'No more occurrences. Please consider turning these into '
   3059          'errors if possible, before they are reintroduced in to the build'
   3060          ':</b></p>')
   3061   print '<blockquote>'
   3062   fixed_patterns = []
   3063   for i in warn_patterns:
   3064     if not i['members']:
   3065       fixed_patterns.append(i['description'] + ' (' +
   3066                             all_patterns(i) + ')')
   3067     if i['option']:
   3068       fixed_patterns.append(' ' + i['option'])
   3069   fixed_patterns.sort()
   3070   print '<div id="' + anchor + '" style="display:none;"><table>'
   3071   cur_row_class = 0
   3072   for text in fixed_patterns:
   3073     cur_row_class = 1 - cur_row_class
   3074     # remove last '\n'
   3075     t = text[:-1] if text[-1] == '\n' else text
   3076     print '<tr><td class="c' + str(cur_row_class) + '">' + t + '</td></tr>'
   3077   print '</table></div>'
   3078   print '</blockquote>'
   3079 
   3080 
   3081 def find_project_index(line):
   3082   for p in range(len(project_patterns)):
   3083     if project_patterns[p].match(line):
   3084       return p
   3085   return -1
   3086 
   3087 
   3088 def classify_one_warning(line, results):
   3089   """Classify one warning line."""
   3090   for i in range(len(warn_patterns)):
   3091     w = warn_patterns[i]
   3092     for cpat in w['compiled_patterns']:
   3093       if cpat.match(line):
   3094         p = find_project_index(line)
   3095         results.append([line, i, p])
   3096         return
   3097       else:
   3098         # If we end up here, there was a problem parsing the log
   3099         # probably caused by 'make -j' mixing the output from
   3100         # 2 or more concurrent compiles
   3101         pass
   3102 
   3103 
   3104 def classify_warnings(lines):
   3105   results = []
   3106   for line in lines:
   3107     classify_one_warning(line, results)
   3108   # After the main work, ignore all other signals to a child process,
   3109   # to avoid bad warning/error messages from the exit clean-up process.
   3110   if args.processes > 1:
   3111     signal.signal(signal.SIGTERM, lambda *args: sys.exit(-signal.SIGTERM))
   3112   return results
   3113 
   3114 
   3115 def parallel_classify_warnings(warning_lines):
   3116   """Classify all warning lines with num_cpu parallel processes."""
   3117   compile_patterns()
   3118   num_cpu = args.processes
   3119   if num_cpu > 1:
   3120     groups = [[] for x in range(num_cpu)]
   3121     i = 0
   3122     for x in warning_lines:
   3123       groups[i].append(x)
   3124       i = (i + 1) % num_cpu
   3125     pool = multiprocessing.Pool(num_cpu)
   3126     group_results = pool.map(classify_warnings, groups)
   3127   else:
   3128     group_results = [classify_warnings(warning_lines)]
   3129 
   3130   for result in group_results:
   3131     for line, pattern_idx, project_idx in result:
   3132       pattern = warn_patterns[pattern_idx]
   3133       pattern['members'].append(line)
   3134       message_idx = len(warning_messages)
   3135       warning_messages.append(line)
   3136       warning_records.append([pattern_idx, project_idx, message_idx])
   3137       pname = '???' if project_idx < 0 else project_names[project_idx]
   3138       # Count warnings by project.
   3139       if pname in pattern['projects']:
   3140         pattern['projects'][pname] += 1
   3141       else:
   3142         pattern['projects'][pname] = 1
   3143 
   3144 
   3145 def compile_patterns():
   3146   """Precompiling every pattern speeds up parsing by about 30x."""
   3147   for i in warn_patterns:
   3148     i['compiled_patterns'] = []
   3149     for pat in i['patterns']:
   3150       i['compiled_patterns'].append(re.compile(pat))
   3151 
   3152 
   3153 def find_android_root(path):
   3154   """Set and return android_root path if it is found."""
   3155   global android_root
   3156   parts = path.split('/')
   3157   for idx in reversed(range(2, len(parts))):
   3158     root_path = '/'.join(parts[:idx])
   3159     # Android root directory should contain this script.
   3160     if os.path.exists(root_path + '/build/make/tools/warn.py'):
   3161       android_root = root_path
   3162       return root_path
   3163   return ''
   3164 
   3165 
   3166 def remove_android_root_prefix(path):
   3167   """Remove android_root prefix from path if it is found."""
   3168   if path.startswith(android_root):
   3169     return path[1 + len(android_root):]
   3170   else:
   3171     return path
   3172 
   3173 
   3174 def normalize_path(path):
   3175   """Normalize file path relative to android_root."""
   3176   # If path is not an absolute path, just normalize it.
   3177   path = os.path.normpath(path)
   3178   if path[0] != '/':
   3179     return path
   3180   # Remove known prefix of root path and normalize the suffix.
   3181   if android_root or find_android_root(path):
   3182     return remove_android_root_prefix(path)
   3183   else:
   3184     return path
   3185 
   3186 
   3187 def normalize_warning_line(line):
   3188   """Normalize file path relative to android_root in a warning line."""
   3189   # replace fancy quotes with plain ol' quotes
   3190   line = line.replace('', "'")
   3191   line = line.replace('', "'")
   3192   line = line.strip()
   3193   first_column = line.find(':')
   3194   if first_column > 0:
   3195     return normalize_path(line[:first_column]) + line[first_column:]
   3196   else:
   3197     return line
   3198 
   3199 
   3200 def parse_input_file(infile):
   3201   """Parse input file, collect parameters and warning lines."""
   3202   global android_root
   3203   global platform_version
   3204   global target_product
   3205   global target_variant
   3206   line_counter = 0
   3207 
   3208   # handle only warning messages with a file path
   3209   warning_pattern = re.compile('^[^ ]*/[^ ]*: warning: .*')
   3210 
   3211   # Collect all warnings into the warning_lines set.
   3212   warning_lines = set()
   3213   for line in infile:
   3214     if warning_pattern.match(line):
   3215       line = normalize_warning_line(line)
   3216       warning_lines.add(line)
   3217     elif line_counter < 100:
   3218       # save a little bit of time by only doing this for the first few lines
   3219       line_counter += 1
   3220       m = re.search('(?<=^PLATFORM_VERSION=).*', line)
   3221       if m is not None:
   3222         platform_version = m.group(0)
   3223       m = re.search('(?<=^TARGET_PRODUCT=).*', line)
   3224       if m is not None:
   3225         target_product = m.group(0)
   3226       m = re.search('(?<=^TARGET_BUILD_VARIANT=).*', line)
   3227       if m is not None:
   3228         target_variant = m.group(0)
   3229       m = re.search('.* TOP=([^ ]*) .*', line)
   3230       if m is not None:
   3231         android_root = m.group(1)
   3232   return warning_lines
   3233 
   3234 
   3235 # Return s with escaped backslash and quotation characters.
   3236 def escape_string(s):
   3237   return s.replace('\\', '\\\\').replace('"', '\\"')
   3238 
   3239 
   3240 # Return s without trailing '\n' and escape the quotation characters.
   3241 def strip_escape_string(s):
   3242   if not s:
   3243     return s
   3244   s = s[:-1] if s[-1] == '\n' else s
   3245   return escape_string(s)
   3246 
   3247 
   3248 def emit_warning_array(name):
   3249   print 'var warning_{} = ['.format(name)
   3250   for i in range(len(warn_patterns)):
   3251     print '{},'.format(warn_patterns[i][name])
   3252   print '];'
   3253 
   3254 
   3255 def emit_warning_arrays():
   3256   emit_warning_array('severity')
   3257   print 'var warning_description = ['
   3258   for i in range(len(warn_patterns)):
   3259     if warn_patterns[i]['members']:
   3260       print '"{}",'.format(escape_string(warn_patterns[i]['description']))
   3261     else:
   3262       print '"",'  # no such warning
   3263   print '];'
   3264 
   3265 scripts_for_warning_groups = """
   3266   function compareMessages(x1, x2) { // of the same warning type
   3267     return (WarningMessages[x1[2]] <= WarningMessages[x2[2]]) ? -1 : 1;
   3268   }
   3269   function byMessageCount(x1, x2) {
   3270     return x2[2] - x1[2];  // reversed order
   3271   }
   3272   function bySeverityMessageCount(x1, x2) {
   3273     // orer by severity first
   3274     if (x1[1] != x2[1])
   3275       return  x1[1] - x2[1];
   3276     return byMessageCount(x1, x2);
   3277   }
   3278   const ParseLinePattern = /^([^ :]+):(\\d+):(.+)/;
   3279   function addURL(line) {
   3280     if (FlagURL == "") return line;
   3281     if (FlagSeparator == "") {
   3282       return line.replace(ParseLinePattern,
   3283         "<a target='_blank' href='" + FlagURL + "/$1'>$1</a>:$2:$3");
   3284     }
   3285     return line.replace(ParseLinePattern,
   3286       "<a target='_blank' href='" + FlagURL + "/$1" + FlagSeparator +
   3287         "$2'>$1:$2</a>:$3");
   3288   }
   3289   function createArrayOfDictionaries(n) {
   3290     var result = [];
   3291     for (var i=0; i<n; i++) result.push({});
   3292     return result;
   3293   }
   3294   function groupWarningsBySeverity() {
   3295     // groups is an array of dictionaries,
   3296     // each dictionary maps from warning type to array of warning messages.
   3297     var groups = createArrayOfDictionaries(SeverityColors.length);
   3298     for (var i=0; i<Warnings.length; i++) {
   3299       var w = Warnings[i][0];
   3300       var s = WarnPatternsSeverity[w];
   3301       var k = w.toString();
   3302       if (!(k in groups[s]))
   3303         groups[s][k] = [];
   3304       groups[s][k].push(Warnings[i]);
   3305     }
   3306     return groups;
   3307   }
   3308   function groupWarningsByProject() {
   3309     var groups = createArrayOfDictionaries(ProjectNames.length);
   3310     for (var i=0; i<Warnings.length; i++) {
   3311       var w = Warnings[i][0];
   3312       var p = Warnings[i][1];
   3313       var k = w.toString();
   3314       if (!(k in groups[p]))
   3315         groups[p][k] = [];
   3316       groups[p][k].push(Warnings[i]);
   3317     }
   3318     return groups;
   3319   }
   3320   var GlobalAnchor = 0;
   3321   function createWarningSection(header, color, group) {
   3322     var result = "";
   3323     var groupKeys = [];
   3324     var totalMessages = 0;
   3325     for (var k in group) {
   3326        totalMessages += group[k].length;
   3327        groupKeys.push([k, WarnPatternsSeverity[parseInt(k)], group[k].length]);
   3328     }
   3329     groupKeys.sort(bySeverityMessageCount);
   3330     for (var idx=0; idx<groupKeys.length; idx++) {
   3331       var k = groupKeys[idx][0];
   3332       var messages = group[k];
   3333       var w = parseInt(k);
   3334       var wcolor = SeverityColors[WarnPatternsSeverity[w]];
   3335       var description = WarnPatternsDescription[w];
   3336       if (description.length == 0)
   3337           description = "???";
   3338       GlobalAnchor += 1;
   3339       result += "<table class='t1'><tr bgcolor='" + wcolor + "'><td>" +
   3340                 "<button class='bt' id='" + GlobalAnchor + "_mark" +
   3341                 "' onclick='expand(\\"" + GlobalAnchor + "\\");'>" +
   3342                 "&#x2295</button> " +
   3343                 description + " (" + messages.length + ")</td></tr></table>";
   3344       result += "<div id='" + GlobalAnchor +
   3345                 "' style='display:none;'><table class='t1'>";
   3346       var c = 0;
   3347       messages.sort(compareMessages);
   3348       for (var i=0; i<messages.length; i++) {
   3349         result += "<tr><td class='c" + c + "'>" +
   3350                   addURL(WarningMessages[messages[i][2]]) + "</td></tr>";
   3351         c = 1 - c;
   3352       }
   3353       result += "</table></div>";
   3354     }
   3355     if (result.length > 0) {
   3356       return "<br><span style='background-color:" + color + "'><b>" +
   3357              header + ": " + totalMessages +
   3358              "</b></span><blockquote><table class='t1'>" +
   3359              result + "</table></blockquote>";
   3360 
   3361     }
   3362     return "";  // empty section
   3363   }
   3364   function generateSectionsBySeverity() {
   3365     var result = "";
   3366     var groups = groupWarningsBySeverity();
   3367     for (s=0; s<SeverityColors.length; s++) {
   3368       result += createWarningSection(SeverityHeaders[s], SeverityColors[s], groups[s]);
   3369     }
   3370     return result;
   3371   }
   3372   function generateSectionsByProject() {
   3373     var result = "";
   3374     var groups = groupWarningsByProject();
   3375     for (i=0; i<groups.length; i++) {
   3376       result += createWarningSection(ProjectNames[i], 'lightgrey', groups[i]);
   3377     }
   3378     return result;
   3379   }
   3380   function groupWarnings(generator) {
   3381     GlobalAnchor = 0;
   3382     var e = document.getElementById("warning_groups");
   3383     e.innerHTML = generator();
   3384   }
   3385   function groupBySeverity() {
   3386     groupWarnings(generateSectionsBySeverity);
   3387   }
   3388   function groupByProject() {
   3389     groupWarnings(generateSectionsByProject);
   3390   }
   3391 """
   3392 
   3393 
   3394 # Emit a JavaScript const string
   3395 def emit_const_string(name, value):
   3396   print 'const ' + name + ' = "' + escape_string(value) + '";'
   3397 
   3398 
   3399 # Emit a JavaScript const integer array.
   3400 def emit_const_int_array(name, array):
   3401   print 'const ' + name + ' = ['
   3402   for n in array:
   3403     print str(n) + ','
   3404   print '];'
   3405 
   3406 
   3407 # Emit a JavaScript const string array.
   3408 def emit_const_string_array(name, array):
   3409   print 'const ' + name + ' = ['
   3410   for s in array:
   3411     print '"' + strip_escape_string(s) + '",'
   3412   print '];'
   3413 
   3414 
   3415 # Emit a JavaScript const string array for HTML.
   3416 def emit_const_html_string_array(name, array):
   3417   print 'const ' + name + ' = ['
   3418   for s in array:
   3419     print '"' + cgi.escape(strip_escape_string(s)) + '",'
   3420   print '];'
   3421 
   3422 
   3423 # Emit a JavaScript const object array.
   3424 def emit_const_object_array(name, array):
   3425   print 'const ' + name + ' = ['
   3426   for x in array:
   3427     print str(x) + ','
   3428   print '];'
   3429 
   3430 
   3431 def emit_js_data():
   3432   """Dump dynamic HTML page's static JavaScript data."""
   3433   emit_const_string('FlagURL', args.url if args.url else '')
   3434   emit_const_string('FlagSeparator', args.separator if args.separator else '')
   3435   emit_const_string_array('SeverityColors', Severity.colors)
   3436   emit_const_string_array('SeverityHeaders', Severity.headers)
   3437   emit_const_string_array('SeverityColumnHeaders', Severity.column_headers)
   3438   emit_const_string_array('ProjectNames', project_names)
   3439   emit_const_int_array('WarnPatternsSeverity',
   3440                        [w['severity'] for w in warn_patterns])
   3441   emit_const_html_string_array('WarnPatternsDescription',
   3442                                [w['description'] for w in warn_patterns])
   3443   emit_const_html_string_array('WarnPatternsOption',
   3444                                [w['option'] for w in warn_patterns])
   3445   emit_const_html_string_array('WarningMessages', warning_messages)
   3446   emit_const_object_array('Warnings', warning_records)
   3447 
   3448 draw_table_javascript = """
   3449 google.charts.load('current', {'packages':['table']});
   3450 google.charts.setOnLoadCallback(drawTable);
   3451 function drawTable() {
   3452   var data = new google.visualization.DataTable();
   3453   data.addColumn('string', StatsHeader[0]);
   3454   for (var i=1; i<StatsHeader.length; i++) {
   3455     data.addColumn('number', StatsHeader[i]);
   3456   }
   3457   data.addRows(StatsRows);
   3458   for (var i=0; i<StatsRows.length; i++) {
   3459     for (var j=0; j<StatsHeader.length; j++) {
   3460       data.setProperty(i, j, 'style', 'border:1px solid black;');
   3461     }
   3462   }
   3463   var table = new google.visualization.Table(document.getElementById('stats_table'));
   3464   table.draw(data, {allowHtml: true, alternatingRowStyle: true});
   3465 }
   3466 """
   3467 
   3468 
   3469 def dump_html():
   3470   """Dump the html output to stdout."""
   3471   dump_html_prologue('Warnings for ' + platform_version + ' - ' +
   3472                      target_product + ' - ' + target_variant)
   3473   dump_stats()
   3474   print '<br><div id="stats_table"></div><br>'
   3475   print '\n<script>'
   3476   emit_js_data()
   3477   print scripts_for_warning_groups
   3478   print '</script>'
   3479   emit_buttons()
   3480   # Warning messages are grouped by severities or project names.
   3481   print '<br><div id="warning_groups"></div>'
   3482   if args.byproject:
   3483     print '<script>groupByProject();</script>'
   3484   else:
   3485     print '<script>groupBySeverity();</script>'
   3486   dump_fixed()
   3487   dump_html_epilogue()
   3488 
   3489 
   3490 ##### Functions to count warnings and dump csv file. #########################
   3491 
   3492 
   3493 def description_for_csv(category):
   3494   if not category['description']:
   3495     return '?'
   3496   return category['description']
   3497 
   3498 
   3499 def count_severity(writer, sev, kind):
   3500   """Count warnings of given severity."""
   3501   total = 0
   3502   for i in warn_patterns:
   3503     if i['severity'] == sev and i['members']:
   3504       n = len(i['members'])
   3505       total += n
   3506       warning = kind + ': ' + description_for_csv(i)
   3507       writer.writerow([n, '', warning])
   3508       # print number of warnings for each project, ordered by project name.
   3509       projects = i['projects'].keys()
   3510       projects.sort()
   3511       for p in projects:
   3512         writer.writerow([i['projects'][p], p, warning])
   3513   writer.writerow([total, '', kind + ' warnings'])
   3514 
   3515   return total
   3516 
   3517 
   3518 # dump number of warnings in csv format to stdout
   3519 def dump_csv(writer):
   3520   """Dump number of warnings in csv format to stdout."""
   3521   sort_warnings()
   3522   total = 0
   3523   for s in Severity.range:
   3524     total += count_severity(writer, s, Severity.column_headers[s])
   3525   writer.writerow([total, '', 'All warnings'])
   3526 
   3527 
   3528 def main():
   3529   warning_lines = parse_input_file(open(args.buildlog, 'r'))
   3530   parallel_classify_warnings(warning_lines)
   3531   # If a user pases a csv path, save the fileoutput to the path
   3532   # If the user also passed gencsv write the output to stdout
   3533   # If the user did not pass gencsv flag dump the html report to stdout.
   3534   if args.csvpath:
   3535     with open(args.csvpath, 'w') as f:
   3536       dump_csv(csv.writer(f, lineterminator='\n'))
   3537   if args.gencsv:
   3538     dump_csv(csv.writer(sys.stdout, lineterminator='\n'))
   3539   else:
   3540     dump_html()
   3541 
   3542 
   3543 # Run main function if warn.py is the main program.
   3544 if __name__ == '__main__':
   3545   main()
   3546