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