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