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