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