Marco Nelissen | 594375d | 2009-07-14 09:04:04 -0700 | [diff] [blame] | 1 | #!/usr/bin/env python |
Marco Nelissen | 8e20196 | 2010-03-10 16:16:02 -0800 | [diff] [blame] | 2 | # This file uses the following encoding: utf-8 |
Marco Nelissen | 594375d | 2009-07-14 09:04:04 -0700 | [diff] [blame] | 3 | |
Ian Rogers | f382973 | 2016-05-10 12:06:01 -0700 | [diff] [blame] | 4 | import argparse |
Marco Nelissen | 594375d | 2009-07-14 09:04:04 -0700 | [diff] [blame] | 5 | import sys |
| 6 | import re |
| 7 | |
Ian Rogers | f382973 | 2016-05-10 12:06:01 -0700 | [diff] [blame] | 8 | parser = argparse.ArgumentParser(description='Convert a build log into HTML') |
Chih-Hung Hsieh | 48a16ba | 2016-07-21 14:22:53 -0700 | [diff] [blame] | 9 | parser.add_argument('--gencsv', |
| 10 | help='Generate a CSV file with number of various warnings', |
| 11 | action="store_true", |
| 12 | default=False) |
Chih-Hung Hsieh | 4354a33 | 2016-07-22 14:09:31 -0700 | [diff] [blame] | 13 | parser.add_argument('--byproject', |
| 14 | help='Separate warnings in HTML output by project names', |
| 15 | action="store_true", |
| 16 | default=False) |
Ian Rogers | f382973 | 2016-05-10 12:06:01 -0700 | [diff] [blame] | 17 | parser.add_argument('--url', |
| 18 | help='Root URL of an Android source code tree prefixed ' |
| 19 | 'before files in warnings') |
| 20 | parser.add_argument('--separator', |
| 21 | help='Separator between the end of a URL and the line ' |
| 22 | 'number argument. e.g. #') |
| 23 | parser.add_argument(dest='buildlog', metavar='build.log', |
| 24 | help='Path to build.log file') |
| 25 | args = parser.parse_args() |
Marco Nelissen | 594375d | 2009-07-14 09:04:04 -0700 | [diff] [blame] | 26 | |
| 27 | # if you add another level, don't forget to give it a color below |
| 28 | class severity: |
| 29 | UNKNOWN=0 |
| 30 | SKIP=100 |
| 31 | FIXMENOW=1 |
| 32 | HIGH=2 |
| 33 | MEDIUM=3 |
| 34 | LOW=4 |
Chih-Hung Hsieh | 90d4619 | 2016-03-29 15:33:11 -0700 | [diff] [blame] | 35 | TIDY=5 |
| 36 | HARMLESS=6 |
Marco Nelissen | 594375d | 2009-07-14 09:04:04 -0700 | [diff] [blame] | 37 | |
| 38 | def colorforseverity(sev): |
| 39 | if sev == severity.FIXMENOW: |
| 40 | return 'fuchsia' |
| 41 | if sev == severity.HIGH: |
| 42 | return 'red' |
| 43 | if sev == severity.MEDIUM: |
| 44 | return 'orange' |
| 45 | if sev == severity.LOW: |
| 46 | return 'yellow' |
Chih-Hung Hsieh | 90d4619 | 2016-03-29 15:33:11 -0700 | [diff] [blame] | 47 | if sev == severity.TIDY: |
| 48 | return 'peachpuff' |
Marco Nelissen | 594375d | 2009-07-14 09:04:04 -0700 | [diff] [blame] | 49 | if sev == severity.HARMLESS: |
| 50 | return 'limegreen' |
| 51 | if sev == severity.UNKNOWN: |
Chih-Hung Hsieh | a9be47e | 2016-03-21 14:11:03 -0700 | [diff] [blame] | 52 | return 'lightblue' |
Marco Nelissen | 594375d | 2009-07-14 09:04:04 -0700 | [diff] [blame] | 53 | return 'grey' |
| 54 | |
Chih-Hung Hsieh | a9be47e | 2016-03-21 14:11:03 -0700 | [diff] [blame] | 55 | def headerforseverity(sev): |
| 56 | if sev == severity.FIXMENOW: |
| 57 | return 'Critical warnings, fix me now' |
| 58 | if sev == severity.HIGH: |
| 59 | return 'High severity warnings' |
| 60 | if sev == severity.MEDIUM: |
| 61 | return 'Medium severity warnings' |
| 62 | if sev == severity.LOW: |
| 63 | return 'Low severity warnings' |
| 64 | if sev == severity.HARMLESS: |
| 65 | return 'Harmless warnings' |
Chih-Hung Hsieh | 90d4619 | 2016-03-29 15:33:11 -0700 | [diff] [blame] | 66 | if sev == severity.TIDY: |
| 67 | return 'Clang-Tidy warnings' |
Chih-Hung Hsieh | a9be47e | 2016-03-21 14:11:03 -0700 | [diff] [blame] | 68 | if sev == severity.UNKNOWN: |
| 69 | return 'Unknown warnings' |
| 70 | return 'Unhandled warnings' |
| 71 | |
Marco Nelissen | 594375d | 2009-07-14 09:04:04 -0700 | [diff] [blame] | 72 | warnpatterns = [ |
| 73 | { 'category':'make', 'severity':severity.MEDIUM, 'members':[], 'option':'', |
| 74 | 'description':'make: overriding commands/ignoring old commands', |
| 75 | 'patterns':[r".*: warning: overriding commands for target .+", |
| 76 | r".*: warning: ignoring old commands for target .+"] }, |
Chih-Hung Hsieh | d9cd1fa | 2016-08-02 14:22:06 -0700 | [diff] [blame] | 77 | { 'category':'make', 'severity':severity.HIGH, 'members':[], 'option':'', |
| 78 | 'description':'make: LOCAL_CLANG is false', |
| 79 | 'patterns':[r".*: warning: LOCAL_CLANG is set to false"] }, |
Marco Nelissen | 594375d | 2009-07-14 09:04:04 -0700 | [diff] [blame] | 80 | { 'category':'C/C++', 'severity':severity.HIGH, 'members':[], 'option':'-Wimplicit-function-declaration', |
| 81 | 'description':'Implicit function declaration', |
Chih-Hung Hsieh | 8d14543 | 2016-07-01 15:48:06 -0700 | [diff] [blame] | 82 | 'patterns':[r".*: warning: implicit declaration of function .+", |
| 83 | r".*: warning: implicitly declaring library function" ] }, |
Marco Nelissen | 594375d | 2009-07-14 09:04:04 -0700 | [diff] [blame] | 84 | { 'category':'C/C++', 'severity':severity.SKIP, 'members':[], 'option':'', |
| 85 | 'description':'', |
| 86 | 'patterns':[r".*: warning: conflicting types for '.+'"] }, |
| 87 | { 'category':'C/C++', 'severity':severity.HIGH, 'members':[], 'option':'-Wtype-limits', |
| 88 | 'description':'Expression always evaluates to true or false', |
Chih-Hung Hsieh | f8aaf60 | 2016-03-16 12:18:16 -0700 | [diff] [blame] | 89 | 'patterns':[r".*: warning: comparison is always .+ due to limited range of data type", |
Chih-Hung Hsieh | ba0ddcd | 2016-03-21 11:28:30 -0700 | [diff] [blame] | 90 | r".*: warning: comparison of unsigned .*expression .+ is always true", |
| 91 | r".*: warning: comparison of unsigned .*expression .+ is always false"] }, |
Chih-Hung Hsieh | f8aaf60 | 2016-03-16 12:18:16 -0700 | [diff] [blame] | 92 | { 'category':'C/C++', 'severity':severity.HIGH, 'members':[], 'option':'', |
| 93 | 'description':'Potential leak of memory, bad free, use after free', |
| 94 | 'patterns':[r".*: warning: Potential leak of memory", |
| 95 | r".*: warning: Potential memory leak", |
Chih-Hung Hsieh | 8d14543 | 2016-07-01 15:48:06 -0700 | [diff] [blame] | 96 | r".*: warning: Memory allocated by alloca\(\) should not be deallocated", |
Chih-Hung Hsieh | f8aaf60 | 2016-03-16 12:18:16 -0700 | [diff] [blame] | 97 | r".*: warning: Memory allocated by .+ should be deallocated by .+ not .+", |
| 98 | r".*: warning: 'delete' applied to a pointer that was allocated", |
| 99 | r".*: warning: Use of memory after it is freed", |
| 100 | r".*: warning: Argument to .+ is the address of .+ variable", |
| 101 | r".*: warning: Argument to free\(\) is offset by .+ of memory allocated by", |
| 102 | r".*: warning: Attempt to .+ released memory"] }, |
| 103 | { 'category':'C/C++', 'severity':severity.HIGH, 'members':[], 'option':'', |
Chih-Hung Hsieh | 8d14543 | 2016-07-01 15:48:06 -0700 | [diff] [blame] | 104 | 'description':'Use transient memory for control value', |
| 105 | 'patterns':[r".*: warning: .+Using such transient memory for the control value is .*dangerous."] }, |
| 106 | { 'category':'C/C++', 'severity':severity.HIGH, 'members':[], 'option':'', |
Chih-Hung Hsieh | f8aaf60 | 2016-03-16 12:18:16 -0700 | [diff] [blame] | 107 | 'description':'Return address of stack memory', |
Chih-Hung Hsieh | ba0ddcd | 2016-03-21 11:28:30 -0700 | [diff] [blame] | 108 | 'patterns':[r".*: warning: Address of stack memory .+ returned to caller", |
| 109 | r".*: warning: Address of stack memory .+ will be a dangling reference"] }, |
Chih-Hung Hsieh | f8aaf60 | 2016-03-16 12:18:16 -0700 | [diff] [blame] | 110 | { 'category':'C/C++', 'severity':severity.HIGH, 'members':[], 'option':'', |
| 111 | 'description':'Problem with vfork', |
| 112 | 'patterns':[r".*: warning: This .+ is prohibited after a successful vfork", |
Chih-Hung Hsieh | 8d14543 | 2016-07-01 15:48:06 -0700 | [diff] [blame] | 113 | r".*: warning: Call to function '.+' is insecure "] }, |
Chih-Hung Hsieh | f8aaf60 | 2016-03-16 12:18:16 -0700 | [diff] [blame] | 114 | { 'category':'C/C++', 'severity':severity.HIGH, 'members':[], 'option':'infinite-recursion', |
| 115 | 'description':'Infinite recursion', |
| 116 | 'patterns':[r".*: warning: all paths through this function will call itself"] }, |
| 117 | { 'category':'C/C++', 'severity':severity.HIGH, 'members':[], 'option':'', |
| 118 | 'description':'Potential buffer overflow', |
| 119 | 'patterns':[r".*: warning: Size argument is greater than .+ the destination buffer", |
| 120 | r".*: warning: Potential buffer overflow.", |
| 121 | r".*: warning: String copy function overflows destination buffer"] }, |
Marco Nelissen | 594375d | 2009-07-14 09:04:04 -0700 | [diff] [blame] | 122 | { 'category':'C/C++', 'severity':severity.MEDIUM, 'members':[], 'option':'', |
| 123 | 'description':'Incompatible pointer types', |
| 124 | 'patterns':[r".*: warning: assignment from incompatible pointer type", |
Marco Nelissen | 8e20196 | 2010-03-10 16:16:02 -0800 | [diff] [blame] | 125 | r".*: warning: return from incompatible pointer type", |
Marco Nelissen | 594375d | 2009-07-14 09:04:04 -0700 | [diff] [blame] | 126 | r".*: warning: passing argument [0-9]+ of '.*' from incompatible pointer type", |
| 127 | r".*: warning: initialization from incompatible pointer type"] }, |
| 128 | { 'category':'C/C++', 'severity':severity.HIGH, 'members':[], 'option':'-fno-builtin', |
| 129 | 'description':'Incompatible declaration of built in function', |
| 130 | 'patterns':[r".*: warning: incompatible implicit declaration of built-in function .+"] }, |
Chih-Hung Hsieh | 8d14543 | 2016-07-01 15:48:06 -0700 | [diff] [blame] | 131 | { 'category':'C/C++', 'severity':severity.HIGH, 'members':[], 'option':'', |
| 132 | 'description':'Null passed as non-null argument', |
Chih-Hung Hsieh | c21ddbd | 2016-07-20 10:08:51 -0700 | [diff] [blame] | 133 | 'patterns':[r".*: warning: Null passed to a callee that requires a non-null"] }, |
Marco Nelissen | 594375d | 2009-07-14 09:04:04 -0700 | [diff] [blame] | 134 | { 'category':'C/C++', 'severity':severity.MEDIUM, 'members':[], 'option':'-Wunused-parameter', |
| 135 | 'description':'Unused parameter', |
| 136 | 'patterns':[r".*: warning: unused parameter '.*'"] }, |
| 137 | { 'category':'C/C++', 'severity':severity.MEDIUM, 'members':[], 'option':'-Wunused', |
| 138 | 'description':'Unused function, variable or label', |
Marco Nelissen | 8e20196 | 2010-03-10 16:16:02 -0800 | [diff] [blame] | 139 | 'patterns':[r".*: warning: '.+' defined but not used", |
Chih-Hung Hsieh | ba0ddcd | 2016-03-21 11:28:30 -0700 | [diff] [blame] | 140 | r".*: warning: unused function '.+'", |
Chih-Hung Hsieh | 90d4619 | 2016-03-29 15:33:11 -0700 | [diff] [blame] | 141 | r".*: warning: private field '.+' is not used", |
Marco Nelissen | 8e20196 | 2010-03-10 16:16:02 -0800 | [diff] [blame] | 142 | r".*: warning: unused variable '.+'"] }, |
Marco Nelissen | 594375d | 2009-07-14 09:04:04 -0700 | [diff] [blame] | 143 | { 'category':'C/C++', 'severity':severity.MEDIUM, 'members':[], 'option':'-Wunused-value', |
Chih-Hung Hsieh | 90d4619 | 2016-03-29 15:33:11 -0700 | [diff] [blame] | 144 | 'description':'Statement with no effect or result unused', |
| 145 | 'patterns':[r".*: warning: statement with no effect", |
| 146 | r".*: warning: expression result unused"] }, |
| 147 | { 'category':'C/C++', 'severity':severity.MEDIUM, 'members':[], 'option':'-Wunused-result', |
| 148 | 'description':'Ignoreing return value of function', |
| 149 | 'patterns':[r".*: warning: ignoring return value of function .+Wunused-result"] }, |
Marco Nelissen | 594375d | 2009-07-14 09:04:04 -0700 | [diff] [blame] | 150 | { 'category':'C/C++', 'severity':severity.MEDIUM, 'members':[], 'option':'-Wmissing-field-initializers', |
| 151 | 'description':'Missing initializer', |
| 152 | 'patterns':[r".*: warning: missing initializer"] }, |
Chih-Hung Hsieh | 8d14543 | 2016-07-01 15:48:06 -0700 | [diff] [blame] | 153 | { 'category':'C/C++', 'severity':severity.MEDIUM, 'members':[], 'option':'-Wdelete-non-virtual-dtor', |
| 154 | 'description':'Need virtual destructor', |
| 155 | 'patterns':[r".*: warning: delete called .* has virtual functions but non-virtual destructor"] }, |
Marco Nelissen | 594375d | 2009-07-14 09:04:04 -0700 | [diff] [blame] | 156 | { 'category':'cont.', 'severity':severity.SKIP, 'members':[], 'option':'', |
| 157 | 'description':'', |
| 158 | 'patterns':[r".*: warning: \(near initialization for '.+'\)"] }, |
Chih-Hung Hsieh | 8d14543 | 2016-07-01 15:48:06 -0700 | [diff] [blame] | 159 | { 'category':'C/C++', 'severity':severity.MEDIUM, 'members':[], 'option':'-Wdate-time', |
| 160 | 'description':'Expansion of data or time macro', |
| 161 | 'patterns':[r".*: warning: expansion of date or time macro is not reproducible"] }, |
Marco Nelissen | 594375d | 2009-07-14 09:04:04 -0700 | [diff] [blame] | 162 | { 'category':'C/C++', 'severity':severity.MEDIUM, 'members':[], 'option':'-Wformat', |
| 163 | 'description':'Format string does not match arguments', |
Chih-Hung Hsieh | f8aaf60 | 2016-03-16 12:18:16 -0700 | [diff] [blame] | 164 | 'patterns':[r".*: warning: format '.+' expects type '.+', but argument [0-9]+ has type '.+'", |
| 165 | r".*: warning: more '%' conversions than data arguments", |
| 166 | r".*: warning: data argument not used by format string", |
| 167 | r".*: warning: incomplete format specifier", |
Chih-Hung Hsieh | 8d14543 | 2016-07-01 15:48:06 -0700 | [diff] [blame] | 168 | r".*: warning: unknown conversion type .* in format", |
Chih-Hung Hsieh | f8aaf60 | 2016-03-16 12:18:16 -0700 | [diff] [blame] | 169 | r".*: warning: format .+ expects .+ but argument .+Wformat=", |
| 170 | r".*: warning: field precision should have .+ but argument has .+Wformat", |
Chih-Hung Hsieh | ba0ddcd | 2016-03-21 11:28:30 -0700 | [diff] [blame] | 171 | r".*: warning: format specifies type .+ but the argument has .*type .+Wformat"] }, |
Marco Nelissen | 594375d | 2009-07-14 09:04:04 -0700 | [diff] [blame] | 172 | { 'category':'C/C++', 'severity':severity.MEDIUM, 'members':[], 'option':'-Wformat-extra-args', |
| 173 | 'description':'Too many arguments for format string', |
| 174 | 'patterns':[r".*: warning: too many arguments for format"] }, |
Chih-Hung Hsieh | f8aaf60 | 2016-03-16 12:18:16 -0700 | [diff] [blame] | 175 | { 'category':'C/C++', 'severity':severity.MEDIUM, 'members':[], 'option':'-Wformat-invalid-specifier', |
| 176 | 'description':'Invalid format specifier', |
| 177 | 'patterns':[r".*: warning: invalid .+ specifier '.+'.+format-invalid-specifier"] }, |
Marco Nelissen | 594375d | 2009-07-14 09:04:04 -0700 | [diff] [blame] | 178 | { 'category':'C/C++', 'severity':severity.MEDIUM, 'members':[], 'option':'-Wsign-compare', |
| 179 | 'description':'Comparison between signed and unsigned', |
| 180 | 'patterns':[r".*: warning: comparison between signed and unsigned", |
| 181 | r".*: warning: comparison of promoted \~unsigned with unsigned", |
| 182 | r".*: warning: signed and unsigned type in conditional expression"] }, |
Marco Nelissen | 8e20196 | 2010-03-10 16:16:02 -0800 | [diff] [blame] | 183 | { 'category':'C/C++', 'severity':severity.MEDIUM, 'members':[], 'option':'', |
| 184 | 'description':'Comparison between enum and non-enum', |
| 185 | 'patterns':[r".*: warning: enumeral and non-enumeral type in conditional expression"] }, |
Marco Nelissen | 594375d | 2009-07-14 09:04:04 -0700 | [diff] [blame] | 186 | { 'category':'libpng', 'severity':severity.MEDIUM, 'members':[], 'option':'', |
| 187 | 'description':'libpng: zero area', |
| 188 | 'patterns':[r".*libpng warning: Ignoring attempt to set cHRM RGB triangle with zero area"] }, |
| 189 | { 'category':'aapt', 'severity':severity.MEDIUM, 'members':[], 'option':'', |
| 190 | 'description':'aapt: no comment for public symbol', |
| 191 | 'patterns':[r".*: warning: No comment for public symbol .+"] }, |
| 192 | { 'category':'C/C++', 'severity':severity.MEDIUM, 'members':[], 'option':'-Wmissing-braces', |
| 193 | 'description':'Missing braces around initializer', |
| 194 | 'patterns':[r".*: warning: missing braces around initializer.*"] }, |
| 195 | { 'category':'C/C++', 'severity':severity.HARMLESS, 'members':[], 'option':'', |
| 196 | 'description':'No newline at end of file', |
| 197 | 'patterns':[r".*: warning: no newline at end of file"] }, |
Chih-Hung Hsieh | 8d14543 | 2016-07-01 15:48:06 -0700 | [diff] [blame] | 198 | { 'category':'C/C++', 'severity':severity.HARMLESS, 'members':[], 'option':'', |
| 199 | 'description':'Missing space after macro name', |
| 200 | 'patterns':[r".*: warning: missing whitespace after the macro name"] }, |
| 201 | { 'category':'C/C++', 'severity':severity.LOW, 'members':[], 'option':'-Wcast-align', |
| 202 | 'description':'Cast increases required alignment', |
| 203 | 'patterns':[r".*: warning: cast from .* to .* increases required alignment .*"] }, |
Marco Nelissen | 594375d | 2009-07-14 09:04:04 -0700 | [diff] [blame] | 204 | { 'category':'C/C++', 'severity':severity.MEDIUM, 'members':[], 'option':'-Wcast-qual', |
| 205 | 'description':'Qualifier discarded', |
| 206 | 'patterns':[r".*: warning: passing argument [0-9]+ of '.+' discards qualifiers from pointer target type", |
| 207 | r".*: warning: assignment discards qualifiers from pointer target type", |
Chih-Hung Hsieh | ba0ddcd | 2016-03-21 11:28:30 -0700 | [diff] [blame] | 208 | r".*: warning: passing .+ to parameter of type .+ discards qualifiers", |
| 209 | r".*: warning: assigning to .+ from .+ discards qualifiers", |
Chih-Hung Hsieh | 8d14543 | 2016-07-01 15:48:06 -0700 | [diff] [blame] | 210 | r".*: warning: initializing .+ discards qualifiers .+types-discards-qualifiers", |
Marco Nelissen | 594375d | 2009-07-14 09:04:04 -0700 | [diff] [blame] | 211 | r".*: warning: return discards qualifiers from pointer target type"] }, |
Chih-Hung Hsieh | 8d14543 | 2016-07-01 15:48:06 -0700 | [diff] [blame] | 212 | { 'category':'C/C++', 'severity':severity.MEDIUM, 'members':[], 'option':'-Wunknown-attributes', |
| 213 | 'description':'Unknown attribute', |
| 214 | 'patterns':[r".*: warning: unknown attribute '.+'"] }, |
| 215 | { 'category':'C/C++', 'severity':severity.MEDIUM, 'members':[], 'option':'-Wignored-attributes', |
Marco Nelissen | 594375d | 2009-07-14 09:04:04 -0700 | [diff] [blame] | 216 | 'description':'Attribute ignored', |
Chih-Hung Hsieh | 8d14543 | 2016-07-01 15:48:06 -0700 | [diff] [blame] | 217 | 'patterns':[r".*: warning: '_*packed_*' attribute ignored", |
| 218 | r".*: warning: attribute declaration must precede definition .+ignored-attributes"] }, |
| 219 | { 'category':'C/C++', 'severity':severity.MEDIUM, 'members':[], 'option':'-Wvisibility', |
| 220 | 'description':'Visibility problem', |
| 221 | 'patterns':[r".*: warning: declaration of '.+' will not be visible outside of this function"] }, |
Marco Nelissen | 594375d | 2009-07-14 09:04:04 -0700 | [diff] [blame] | 222 | { 'category':'C/C++', 'severity':severity.MEDIUM, 'members':[], 'option':'-Wattributes', |
| 223 | 'description':'Visibility mismatch', |
| 224 | 'patterns':[r".*: warning: '.+' declared with greater visibility than the type of its field '.+'"] }, |
| 225 | { 'category':'C/C++', 'severity':severity.MEDIUM, 'members':[], 'option':'', |
| 226 | 'description':'Shift count greater than width of type', |
| 227 | 'patterns':[r".*: warning: (left|right) shift count >= width of type"] }, |
Chih-Hung Hsieh | 8d14543 | 2016-07-01 15:48:06 -0700 | [diff] [blame] | 228 | { 'category':'C/C++', 'severity':severity.MEDIUM, 'members':[], 'option':'-Wextern-initializer', |
Marco Nelissen | 594375d | 2009-07-14 09:04:04 -0700 | [diff] [blame] | 229 | 'description':'extern <foo> is initialized', |
Chih-Hung Hsieh | 8d14543 | 2016-07-01 15:48:06 -0700 | [diff] [blame] | 230 | 'patterns':[r".*: warning: '.+' initialized and declared 'extern'", |
| 231 | r".*: warning: 'extern' variable has an initializer"] }, |
Marco Nelissen | 594375d | 2009-07-14 09:04:04 -0700 | [diff] [blame] | 232 | { 'category':'C/C++', 'severity':severity.MEDIUM, 'members':[], 'option':'-Wold-style-declaration', |
| 233 | 'description':'Old style declaration', |
| 234 | 'patterns':[r".*: warning: 'static' is not at beginning of declaration"] }, |
Chih-Hung Hsieh | 8d14543 | 2016-07-01 15:48:06 -0700 | [diff] [blame] | 235 | { 'category':'C/C++', 'severity':severity.MEDIUM, 'members':[], 'option':'-Wreturn-type', |
| 236 | 'description':'Missing return value', |
| 237 | 'patterns':[r".*: warning: control reaches end of non-void function"] }, |
| 238 | { 'category':'C/C++', 'severity':severity.MEDIUM, 'members':[], 'option':'-Wimplicit-int', |
| 239 | 'description':'Implicit int type', |
| 240 | 'patterns':[r".*: warning: type specifier missing, defaults to 'int'"] }, |
| 241 | { 'category':'C/C++', 'severity':severity.MEDIUM, 'members':[], 'option':'-Wmain-return-type', |
| 242 | 'description':'Main function should return int', |
| 243 | 'patterns':[r".*: warning: return type of 'main' is not 'int'"] }, |
Marco Nelissen | 594375d | 2009-07-14 09:04:04 -0700 | [diff] [blame] | 244 | { 'category':'C/C++', 'severity':severity.MEDIUM, 'members':[], 'option':'-Wuninitialized', |
| 245 | 'description':'Variable may be used uninitialized', |
| 246 | 'patterns':[r".*: warning: '.+' may be used uninitialized in this function"] }, |
| 247 | { 'category':'C/C++', 'severity':severity.HIGH, 'members':[], 'option':'-Wuninitialized', |
| 248 | 'description':'Variable is used uninitialized', |
Chih-Hung Hsieh | f8aaf60 | 2016-03-16 12:18:16 -0700 | [diff] [blame] | 249 | 'patterns':[r".*: warning: '.+' is used uninitialized in this function", |
| 250 | r".*: warning: variable '.+' is uninitialized when used here"] }, |
Marco Nelissen | 594375d | 2009-07-14 09:04:04 -0700 | [diff] [blame] | 251 | { 'category':'ld', 'severity':severity.MEDIUM, 'members':[], 'option':'-fshort-enums', |
| 252 | 'description':'ld: possible enum size mismatch', |
| 253 | 'patterns':[r".*: warning: .* uses variable-size enums yet the output is to use 32-bit enums; use of enum values across objects may fail"] }, |
| 254 | { 'category':'C/C++', 'severity':severity.MEDIUM, 'members':[], 'option':'-Wpointer-sign', |
| 255 | 'description':'Pointer targets differ in signedness', |
| 256 | 'patterns':[r".*: warning: pointer targets in initialization differ in signedness", |
| 257 | r".*: warning: pointer targets in assignment differ in signedness", |
| 258 | r".*: warning: pointer targets in return differ in signedness", |
| 259 | r".*: warning: pointer targets in passing argument [0-9]+ of '.+' differ in signedness"] }, |
| 260 | { 'category':'C/C++', 'severity':severity.MEDIUM, 'members':[], 'option':'-Wstrict-overflow', |
| 261 | 'description':'Assuming overflow does not occur', |
| 262 | 'patterns':[r".*: warning: assuming signed overflow does not occur when assuming that .* is always (true|false)"] }, |
| 263 | { 'category':'C/C++', 'severity':severity.MEDIUM, 'members':[], 'option':'-Wempty-body', |
| 264 | 'description':'Suggest adding braces around empty body', |
| 265 | 'patterns':[r".*: warning: suggest braces around empty body in an 'if' statement", |
| 266 | r".*: warning: empty body in an if-statement", |
| 267 | r".*: warning: suggest braces around empty body in an 'else' statement", |
| 268 | r".*: warning: empty body in an else-statement"] }, |
| 269 | { 'category':'C/C++', 'severity':severity.MEDIUM, 'members':[], 'option':'-Wparentheses', |
| 270 | 'description':'Suggest adding parentheses', |
| 271 | 'patterns':[r".*: warning: suggest explicit braces to avoid ambiguous 'else'", |
| 272 | r".*: warning: suggest parentheses around arithmetic in operand of '.+'", |
| 273 | r".*: warning: suggest parentheses around comparison in operand of '.+'", |
Chih-Hung Hsieh | ba0ddcd | 2016-03-21 11:28:30 -0700 | [diff] [blame] | 274 | r".*: warning: logical not is only applied to the left hand side of this comparison", |
| 275 | r".*: warning: using the result of an assignment as a condition without parentheses", |
| 276 | r".*: warning: .+ has lower precedence than .+ be evaluated first .+Wparentheses", |
Marco Nelissen | 594375d | 2009-07-14 09:04:04 -0700 | [diff] [blame] | 277 | r".*: warning: suggest parentheses around '.+?' .+ '.+?'", |
| 278 | r".*: warning: suggest parentheses around assignment used as truth value"] }, |
| 279 | { 'category':'C/C++', 'severity':severity.MEDIUM, 'members':[], 'option':'', |
| 280 | 'description':'Static variable used in non-static inline function', |
| 281 | 'patterns':[r".*: warning: '.+' is static but used in inline function '.+' which is not static"] }, |
| 282 | { 'category':'C/C++', 'severity':severity.MEDIUM, 'members':[], 'option':'-Wimplicit int', |
| 283 | 'description':'No type or storage class (will default to int)', |
| 284 | 'patterns':[r".*: warning: data definition has no type or storage class"] }, |
Chih-Hung Hsieh | f8aaf60 | 2016-03-16 12:18:16 -0700 | [diff] [blame] | 285 | { 'category':'C/C++', 'severity':severity.MEDIUM, 'members':[], 'option':'', |
| 286 | 'description':'Null pointer', |
| 287 | 'patterns':[r".*: warning: Dereference of null pointer", |
| 288 | r".*: warning: Called .+ pointer is null", |
| 289 | r".*: warning: Forming reference to null pointer", |
| 290 | r".*: warning: Returning null reference", |
| 291 | r".*: warning: Null pointer passed as an argument to a 'nonnull' parameter", |
| 292 | r".*: warning: .+ results in a null pointer dereference", |
| 293 | r".*: warning: Access to .+ results in a dereference of a null pointer", |
| 294 | r".*: warning: Null pointer argument in"] }, |
Marco Nelissen | 594375d | 2009-07-14 09:04:04 -0700 | [diff] [blame] | 295 | { 'category':'cont.', 'severity':severity.SKIP, 'members':[], 'option':'', |
| 296 | 'description':'', |
| 297 | 'patterns':[r".*: warning: type defaults to 'int' in declaration of '.+'"] }, |
| 298 | { 'category':'cont.', 'severity':severity.SKIP, 'members':[], 'option':'', |
| 299 | 'description':'', |
| 300 | 'patterns':[r".*: warning: parameter names \(without types\) in function declaration"] }, |
| 301 | { 'category':'C/C++', 'severity':severity.MEDIUM, 'members':[], 'option':'-Wstrict-aliasing', |
| 302 | 'description':'Dereferencing <foo> breaks strict aliasing rules', |
| 303 | 'patterns':[r".*: warning: dereferencing .* break strict-aliasing rules"] }, |
| 304 | { 'category':'C/C++', 'severity':severity.MEDIUM, 'members':[], 'option':'-Wpointer-to-int-cast', |
| 305 | 'description':'Cast from pointer to integer of different size', |
Chih-Hung Hsieh | 8d14543 | 2016-07-01 15:48:06 -0700 | [diff] [blame] | 306 | 'patterns':[r".*: warning: cast from pointer to integer of different size", |
| 307 | r".*: warning: initialization makes pointer from integer without a cast"] } , |
Marco Nelissen | 594375d | 2009-07-14 09:04:04 -0700 | [diff] [blame] | 308 | { 'category':'C/C++', 'severity':severity.MEDIUM, 'members':[], 'option':'-Wint-to-pointer-cast', |
| 309 | 'description':'Cast to pointer from integer of different size', |
| 310 | 'patterns':[r".*: warning: cast to pointer from integer of different size"] }, |
| 311 | { 'category':'C/C++', 'severity':severity.MEDIUM, 'members':[], 'option':'', |
| 312 | 'description':'Symbol redefined', |
| 313 | 'patterns':[r".*: warning: "".+"" redefined"] }, |
| 314 | { 'category':'cont.', 'severity':severity.SKIP, 'members':[], 'option':'', |
| 315 | 'description':'', |
| 316 | 'patterns':[r".*: warning: this is the location of the previous definition"] }, |
| 317 | { 'category':'ld', 'severity':severity.MEDIUM, 'members':[], 'option':'', |
| 318 | 'description':'ld: type and size of dynamic symbol are not defined', |
| 319 | 'patterns':[r".*: warning: type and size of dynamic symbol `.+' are not defined"] }, |
| 320 | { 'category':'C/C++', 'severity':severity.MEDIUM, 'members':[], 'option':'', |
| 321 | 'description':'Pointer from integer without cast', |
| 322 | 'patterns':[r".*: warning: assignment makes pointer from integer without a cast"] }, |
| 323 | { 'category':'C/C++', 'severity':severity.MEDIUM, 'members':[], 'option':'', |
| 324 | 'description':'Pointer from integer without cast', |
| 325 | 'patterns':[r".*: warning: passing argument [0-9]+ of '.+' makes pointer from integer without a cast"] }, |
| 326 | { 'category':'C/C++', 'severity':severity.MEDIUM, 'members':[], 'option':'', |
| 327 | 'description':'Integer from pointer without cast', |
| 328 | 'patterns':[r".*: warning: assignment makes integer from pointer without a cast"] }, |
| 329 | { 'category':'C/C++', 'severity':severity.MEDIUM, 'members':[], 'option':'', |
| 330 | 'description':'Integer from pointer without cast', |
| 331 | 'patterns':[r".*: warning: passing argument [0-9]+ of '.+' makes integer from pointer without a cast"] }, |
| 332 | { 'category':'C/C++', 'severity':severity.MEDIUM, 'members':[], 'option':'', |
| 333 | 'description':'Integer from pointer without cast', |
| 334 | 'patterns':[r".*: warning: return makes integer from pointer without a cast"] }, |
| 335 | { 'category':'C/C++', 'severity':severity.MEDIUM, 'members':[], 'option':'-Wunknown-pragmas', |
| 336 | 'description':'Ignoring pragma', |
| 337 | 'patterns':[r".*: warning: ignoring #pragma .+"] }, |
| 338 | { 'category':'C/C++', 'severity':severity.MEDIUM, 'members':[], 'option':'-Wclobbered', |
| 339 | 'description':'Variable might be clobbered by longjmp or vfork', |
| 340 | 'patterns':[r".*: warning: variable '.+' might be clobbered by 'longjmp' or 'vfork'"] }, |
| 341 | { 'category':'C/C++', 'severity':severity.MEDIUM, 'members':[], 'option':'-Wclobbered', |
| 342 | 'description':'Argument might be clobbered by longjmp or vfork', |
| 343 | 'patterns':[r".*: warning: argument '.+' might be clobbered by 'longjmp' or 'vfork'"] }, |
| 344 | { 'category':'C/C++', 'severity':severity.MEDIUM, 'members':[], 'option':'-Wredundant-decls', |
| 345 | 'description':'Redundant declaration', |
| 346 | 'patterns':[r".*: warning: redundant redeclaration of '.+'"] }, |
| 347 | { 'category':'cont.', 'severity':severity.SKIP, 'members':[], 'option':'', |
| 348 | 'description':'', |
| 349 | 'patterns':[r".*: warning: previous declaration of '.+' was here"] }, |
| 350 | { 'category':'C/C++', 'severity':severity.MEDIUM, 'members':[], 'option':'-Wswitch-enum', |
| 351 | 'description':'Enum value not handled in switch', |
Chih-Hung Hsieh | ba0ddcd | 2016-03-21 11:28:30 -0700 | [diff] [blame] | 352 | 'patterns':[r".*: warning: .*enumeration value.* not handled in switch.+Wswitch"] }, |
Marco Nelissen | 594375d | 2009-07-14 09:04:04 -0700 | [diff] [blame] | 353 | { 'category':'java', 'severity':severity.MEDIUM, 'members':[], 'option':'-encoding', |
| 354 | 'description':'Java: Non-ascii characters used, but ascii encoding specified', |
| 355 | 'patterns':[r".*: warning: unmappable character for encoding ascii"] }, |
| 356 | { 'category':'java', 'severity':severity.MEDIUM, 'members':[], 'option':'', |
| 357 | 'description':'Java: Non-varargs call of varargs method with inexact argument type for last parameter', |
| 358 | 'patterns':[r".*: warning: non-varargs call of varargs method with inexact argument type for last parameter"] }, |
Chih-Hung Hsieh | ba0ddcd | 2016-03-21 11:28:30 -0700 | [diff] [blame] | 359 | { 'category':'java', 'severity':severity.MEDIUM, 'members':[], 'option':'', |
| 360 | 'description':'Java: Unchecked method invocation', |
| 361 | 'patterns':[r".*: warning: \[unchecked\] unchecked method invocation: .+ in class .+"] }, |
| 362 | { 'category':'java', 'severity':severity.MEDIUM, 'members':[], 'option':'', |
| 363 | 'description':'Java: Unchecked conversion', |
| 364 | 'patterns':[r".*: warning: \[unchecked\] unchecked conversion"] }, |
Ian Rogers | 32bb9bd | 2016-05-09 23:19:42 -0700 | [diff] [blame] | 365 | |
Ian Rogers | 6e52003 | 2016-05-13 08:59:00 -0700 | [diff] [blame] | 366 | # Warnings from Error Prone. |
| 367 | {'category': 'java', |
| 368 | 'severity': severity.MEDIUM, |
| 369 | 'members': [], |
| 370 | 'option': '', |
| 371 | 'description': 'Java: Use of deprecated member', |
| 372 | 'patterns': [r'.*: warning: \[deprecation\] .+']}, |
| 373 | {'category': 'java', |
| 374 | 'severity': severity.MEDIUM, |
| 375 | 'members': [], |
| 376 | 'option': '', |
| 377 | 'description': 'Java: Unchecked conversion', |
| 378 | 'patterns': [r'.*: warning: \[unchecked\] .+']}, |
Ian Rogers | 32bb9bd | 2016-05-09 23:19:42 -0700 | [diff] [blame] | 379 | |
Ian Rogers | 6e52003 | 2016-05-13 08:59:00 -0700 | [diff] [blame] | 380 | # Warnings from Error Prone (auto generated list). |
| 381 | {'category': 'java', |
| 382 | 'severity': severity.LOW, |
| 383 | 'members': [], |
| 384 | 'option': '', |
| 385 | 'description': |
| 386 | 'Java: Deprecated item is not annotated with @Deprecated', |
| 387 | 'patterns': [r".*: warning: \[DepAnn\] .+"]}, |
| 388 | {'category': 'java', |
| 389 | 'severity': severity.LOW, |
| 390 | 'members': [], |
| 391 | 'option': '', |
| 392 | 'description': |
| 393 | 'Java: Fallthrough warning suppression has no effect if warning is suppressed', |
| 394 | 'patterns': [r".*: warning: \[FallthroughSuppression\] .+"]}, |
| 395 | {'category': 'java', |
| 396 | 'severity': severity.LOW, |
| 397 | 'members': [], |
| 398 | 'option': '', |
| 399 | 'description': |
| 400 | 'Java: Prefer \'L\' to \'l\' for the suffix to long literals', |
| 401 | 'patterns': [r".*: warning: \[LongLiteralLowerCaseSuffix\] .+"]}, |
| 402 | {'category': 'java', |
| 403 | 'severity': severity.LOW, |
| 404 | 'members': [], |
| 405 | 'option': '', |
| 406 | 'description': |
| 407 | 'Java: @Binds is a more efficient and declaritive mechanism for delegating a binding.', |
| 408 | 'patterns': [r".*: warning: \[UseBinds\] .+"]}, |
| 409 | {'category': 'java', |
| 410 | 'severity': severity.MEDIUM, |
| 411 | 'members': [], |
| 412 | 'option': '', |
| 413 | 'description': |
| 414 | 'Java: Assertions may be disabled at runtime and do not guarantee that execution will halt here; consider throwing an exception instead', |
| 415 | 'patterns': [r".*: warning: \[AssertFalse\] .+"]}, |
| 416 | {'category': 'java', |
| 417 | 'severity': severity.MEDIUM, |
| 418 | 'members': [], |
| 419 | 'option': '', |
| 420 | 'description': |
| 421 | 'Java: Classes that implement Annotation must override equals and hashCode. Consider using AutoAnnotation instead of implementing Annotation by hand.', |
| 422 | 'patterns': [r".*: warning: \[BadAnnotationImplementation\] .+"]}, |
| 423 | {'category': 'java', |
| 424 | 'severity': severity.MEDIUM, |
| 425 | 'members': [], |
| 426 | 'option': '', |
| 427 | 'description': |
| 428 | 'Java: BigDecimal(double) and BigDecimal.valueOf(double) may lose precision, prefer BigDecimal(String) or BigDecimal(long)', |
| 429 | 'patterns': [r".*: warning: \[BigDecimalLiteralDouble\] .+"]}, |
| 430 | {'category': 'java', |
| 431 | 'severity': severity.MEDIUM, |
| 432 | 'members': [], |
| 433 | 'option': '', |
| 434 | 'description': |
| 435 | 'Java: Mockito cannot mock final classes', |
| 436 | 'patterns': [r".*: warning: \[CannotMockFinalClass\] .+"]}, |
| 437 | {'category': 'java', |
| 438 | 'severity': severity.MEDIUM, |
| 439 | 'members': [], |
| 440 | 'option': '', |
| 441 | 'description': |
| 442 | 'Java: This code, which counts elements using a loop, can be replaced by a simpler library method', |
| 443 | 'patterns': [r".*: warning: \[ElementsCountedInLoop\] .+"]}, |
| 444 | {'category': 'java', |
| 445 | 'severity': severity.MEDIUM, |
| 446 | 'members': [], |
| 447 | 'option': '', |
| 448 | 'description': |
| 449 | 'Java: Empty top-level type declaration', |
| 450 | 'patterns': [r".*: warning: \[EmptyTopLevelDeclaration\] .+"]}, |
| 451 | {'category': 'java', |
| 452 | 'severity': severity.MEDIUM, |
| 453 | 'members': [], |
| 454 | 'option': '', |
| 455 | 'description': |
| 456 | 'Java: Classes that override equals should also override hashCode.', |
| 457 | 'patterns': [r".*: warning: \[EqualsHashCode\] .+"]}, |
| 458 | {'category': 'java', |
| 459 | 'severity': severity.MEDIUM, |
| 460 | 'members': [], |
| 461 | 'option': '', |
| 462 | 'description': |
| 463 | 'Java: An equality test between objects with incompatible types always returns false', |
| 464 | 'patterns': [r".*: warning: \[EqualsIncompatibleType\] .+"]}, |
| 465 | {'category': 'java', |
| 466 | 'severity': severity.MEDIUM, |
| 467 | 'members': [], |
| 468 | 'option': '', |
| 469 | 'description': |
| 470 | '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.', |
| 471 | 'patterns': [r".*: warning: \[Finally\] .+"]}, |
| 472 | {'category': 'java', |
| 473 | 'severity': severity.MEDIUM, |
| 474 | 'members': [], |
| 475 | 'option': '', |
| 476 | 'description': |
| 477 | 'Java: This annotation has incompatible modifiers as specified by its @IncompatibleModifiers annotation', |
| 478 | 'patterns': [r".*: warning: \[IncompatibleModifiers\] .+"]}, |
| 479 | {'category': 'java', |
| 480 | 'severity': severity.MEDIUM, |
| 481 | 'members': [], |
| 482 | 'option': '', |
| 483 | 'description': |
| 484 | 'Java: Class should not implement both `Iterable` and `Iterator`', |
| 485 | 'patterns': [r".*: warning: \[IterableAndIterator\] .+"]}, |
| 486 | {'category': 'java', |
| 487 | 'severity': severity.MEDIUM, |
| 488 | 'members': [], |
| 489 | 'option': '', |
| 490 | 'description': |
| 491 | 'Java: Floating-point comparison without error tolerance', |
| 492 | 'patterns': [r".*: warning: \[JUnit3FloatingPointComparisonWithoutDelta\] .+"]}, |
| 493 | {'category': 'java', |
| 494 | 'severity': severity.MEDIUM, |
| 495 | 'members': [], |
| 496 | 'option': '', |
| 497 | 'description': |
| 498 | 'Java: Test class inherits from JUnit 3\'s TestCase but has JUnit 4 @Test annotations.', |
| 499 | 'patterns': [r".*: warning: \[JUnitAmbiguousTestClass\] .+"]}, |
| 500 | {'category': 'java', |
| 501 | 'severity': severity.MEDIUM, |
| 502 | 'members': [], |
| 503 | 'option': '', |
| 504 | 'description': |
| 505 | 'Java: Enum switch statement is missing cases', |
| 506 | 'patterns': [r".*: warning: \[MissingCasesInEnumSwitch\] .+"]}, |
| 507 | {'category': 'java', |
| 508 | 'severity': severity.MEDIUM, |
| 509 | 'members': [], |
| 510 | 'option': '', |
| 511 | 'description': |
| 512 | 'Java: Not calling fail() when expecting an exception masks bugs', |
| 513 | 'patterns': [r".*: warning: \[MissingFail\] .+"]}, |
| 514 | {'category': 'java', |
| 515 | 'severity': severity.MEDIUM, |
| 516 | 'members': [], |
| 517 | 'option': '', |
| 518 | 'description': |
| 519 | 'Java: method overrides method in supertype; expected @Override', |
| 520 | 'patterns': [r".*: warning: \[MissingOverride\] .+"]}, |
| 521 | {'category': 'java', |
| 522 | 'severity': severity.MEDIUM, |
| 523 | 'members': [], |
| 524 | 'option': '', |
| 525 | 'description': |
| 526 | 'Java: Source files should not contain multiple top-level class declarations', |
| 527 | 'patterns': [r".*: warning: \[MultipleTopLevelClasses\] .+"]}, |
| 528 | {'category': 'java', |
| 529 | 'severity': severity.MEDIUM, |
| 530 | 'members': [], |
| 531 | 'option': '', |
| 532 | 'description': |
| 533 | 'Java: This update of a volatile variable is non-atomic', |
| 534 | 'patterns': [r".*: warning: \[NonAtomicVolatileUpdate\] .+"]}, |
| 535 | {'category': 'java', |
| 536 | 'severity': severity.MEDIUM, |
| 537 | 'members': [], |
| 538 | 'option': '', |
| 539 | 'description': |
| 540 | 'Java: Static import of member uses non-canonical name', |
| 541 | 'patterns': [r".*: warning: \[NonCanonicalStaticMemberImport\] .+"]}, |
| 542 | {'category': 'java', |
| 543 | 'severity': severity.MEDIUM, |
| 544 | 'members': [], |
| 545 | 'option': '', |
| 546 | 'description': |
| 547 | 'Java: equals method doesn\'t override Object.equals', |
| 548 | 'patterns': [r".*: warning: \[NonOverridingEquals\] .+"]}, |
| 549 | {'category': 'java', |
| 550 | 'severity': severity.MEDIUM, |
| 551 | 'members': [], |
| 552 | 'option': '', |
| 553 | 'description': |
| 554 | 'Java: Constructors should not be annotated with @Nullable since they cannot return null', |
| 555 | 'patterns': [r".*: warning: \[NullableConstructor\] .+"]}, |
| 556 | {'category': 'java', |
| 557 | 'severity': severity.MEDIUM, |
| 558 | 'members': [], |
| 559 | 'option': '', |
| 560 | 'description': |
| 561 | 'Java: @Nullable should not be used for primitive types since they cannot be null', |
| 562 | 'patterns': [r".*: warning: \[NullablePrimitive\] .+"]}, |
| 563 | {'category': 'java', |
| 564 | 'severity': severity.MEDIUM, |
| 565 | 'members': [], |
| 566 | 'option': '', |
| 567 | 'description': |
| 568 | 'Java: void-returning methods should not be annotated with @Nullable, since they cannot return null', |
| 569 | 'patterns': [r".*: warning: \[NullableVoid\] .+"]}, |
| 570 | {'category': 'java', |
| 571 | 'severity': severity.MEDIUM, |
| 572 | 'members': [], |
| 573 | 'option': '', |
| 574 | 'description': |
| 575 | 'Java: Package names should match the directory they are declared in', |
| 576 | 'patterns': [r".*: warning: \[PackageLocation\] .+"]}, |
| 577 | {'category': 'java', |
| 578 | 'severity': severity.MEDIUM, |
| 579 | 'members': [], |
| 580 | 'option': '', |
| 581 | 'description': |
| 582 | 'Java: Second argument to Preconditions.* is a call to String.format(), which can be unwrapped', |
| 583 | 'patterns': [r".*: warning: \[PreconditionsErrorMessageEagerEvaluation\] .+"]}, |
| 584 | {'category': 'java', |
| 585 | 'severity': severity.MEDIUM, |
| 586 | 'members': [], |
| 587 | 'option': '', |
| 588 | 'description': |
| 589 | 'Java: Preconditions only accepts the %s placeholder in error message strings', |
| 590 | 'patterns': [r".*: warning: \[PreconditionsInvalidPlaceholder\] .+"]}, |
| 591 | {'category': 'java', |
| 592 | 'severity': severity.MEDIUM, |
| 593 | 'members': [], |
| 594 | 'option': '', |
| 595 | 'description': |
| 596 | 'Java: Passing a primitive array to a varargs method is usually wrong', |
| 597 | 'patterns': [r".*: warning: \[PrimitiveArrayPassedToVarargsMethod\] .+"]}, |
| 598 | {'category': 'java', |
| 599 | 'severity': severity.MEDIUM, |
| 600 | 'members': [], |
| 601 | 'option': '', |
| 602 | 'description': |
| 603 | 'Java: Protobuf fields cannot be null, so this check is redundant', |
| 604 | 'patterns': [r".*: warning: \[ProtoFieldPreconditionsCheckNotNull\] .+"]}, |
| 605 | {'category': 'java', |
| 606 | 'severity': severity.MEDIUM, |
| 607 | 'members': [], |
| 608 | 'option': '', |
| 609 | 'description': |
| 610 | 'Java: This annotation is missing required modifiers as specified by its @RequiredModifiers annotation', |
| 611 | 'patterns': [r".*: warning: \[RequiredModifiers\] .+"]}, |
| 612 | {'category': 'java', |
| 613 | 'severity': severity.MEDIUM, |
| 614 | 'members': [], |
| 615 | 'option': '', |
| 616 | 'description': |
| 617 | 'Java: A static variable or method should not be accessed from an object instance', |
| 618 | 'patterns': [r".*: warning: \[StaticAccessedFromInstance\] .+"]}, |
| 619 | {'category': 'java', |
| 620 | 'severity': severity.MEDIUM, |
| 621 | 'members': [], |
| 622 | 'option': '', |
| 623 | 'description': |
| 624 | 'Java: String comparison using reference equality instead of value equality', |
| 625 | 'patterns': [r".*: warning: \[StringEquality\] .+"]}, |
| 626 | {'category': 'java', |
| 627 | 'severity': severity.MEDIUM, |
| 628 | 'members': [], |
| 629 | 'option': '', |
| 630 | 'description': |
| 631 | '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.', |
| 632 | 'patterns': [r".*: warning: \[TypeParameterUnusedInFormals\] .+"]}, |
| 633 | {'category': 'java', |
| 634 | 'severity': severity.MEDIUM, |
| 635 | 'members': [], |
| 636 | 'option': '', |
| 637 | 'description': |
| 638 | 'Java: Using static imports for types is unnecessary', |
| 639 | 'patterns': [r".*: warning: \[UnnecessaryStaticImport\] .+"]}, |
| 640 | {'category': 'java', |
| 641 | 'severity': severity.MEDIUM, |
| 642 | 'members': [], |
| 643 | 'option': '', |
| 644 | 'description': |
| 645 | 'Java: Unsynchronized method overrides a synchronized method.', |
| 646 | 'patterns': [r".*: warning: \[UnsynchronizedOverridesSynchronized\] .+"]}, |
| 647 | {'category': 'java', |
| 648 | 'severity': severity.MEDIUM, |
| 649 | 'members': [], |
| 650 | 'option': '', |
| 651 | 'description': |
| 652 | 'Java: Non-constant variable missing @Var annotation', |
| 653 | 'patterns': [r".*: warning: \[Var\] .+"]}, |
| 654 | {'category': 'java', |
| 655 | 'severity': severity.MEDIUM, |
| 656 | 'members': [], |
| 657 | 'option': '', |
| 658 | 'description': |
| 659 | 'Java: Because of spurious wakeups, Object.wait() and Condition.await() must always be called in a loop', |
| 660 | 'patterns': [r".*: warning: \[WaitNotInLoop\] .+"]}, |
| 661 | {'category': 'java', |
| 662 | 'severity': severity.MEDIUM, |
| 663 | 'members': [], |
| 664 | 'option': '', |
| 665 | 'description': |
| 666 | 'Java: Subclasses of Fragment must be instantiable via Class#newInstance(): the class must be public, static and have a public nullary constructor', |
| 667 | 'patterns': [r".*: warning: \[FragmentNotInstantiable\] .+"]}, |
| 668 | {'category': 'java', |
| 669 | 'severity': severity.MEDIUM, |
| 670 | 'members': [], |
| 671 | 'option': '', |
| 672 | 'description': |
| 673 | 'Java: Hardcoded reference to /sdcard', |
| 674 | 'patterns': [r".*: warning: \[HardCodedSdCardPath\] .+"]}, |
| 675 | {'category': 'java', |
| 676 | 'severity': severity.MEDIUM, |
| 677 | 'members': [], |
| 678 | 'option': '', |
| 679 | 'description': |
| 680 | 'Java: Incompatible type as argument to Object-accepting Java collections method', |
| 681 | 'patterns': [r".*: warning: \[CollectionIncompatibleType\] .+"]}, |
| 682 | {'category': 'java', |
| 683 | 'severity': severity.MEDIUM, |
| 684 | 'members': [], |
| 685 | 'option': '', |
| 686 | 'description': |
| 687 | 'Java: @AssistedInject and @Inject should not be used on different constructors in the same class.', |
| 688 | 'patterns': [r".*: warning: \[AssistedInjectAndInjectOnConstructors\] .+"]}, |
| 689 | {'category': 'java', |
| 690 | 'severity': severity.MEDIUM, |
| 691 | 'members': [], |
| 692 | 'option': '', |
| 693 | 'description': |
| 694 | 'Java: Although Guice allows injecting final fields, doing so is not recommended because the injected value may not be visible to other threads.', |
| 695 | 'patterns': [r".*: warning: \[GuiceInjectOnFinalField\] .+"]}, |
| 696 | {'category': 'java', |
| 697 | 'severity': severity.MEDIUM, |
| 698 | 'members': [], |
| 699 | 'option': '', |
| 700 | 'description': |
| 701 | '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.', |
| 702 | 'patterns': [r".*: warning: \[OverridesGuiceInjectableMethod\] .+"]}, |
| 703 | {'category': 'java', |
| 704 | 'severity': severity.MEDIUM, |
| 705 | 'members': [], |
| 706 | 'option': '', |
| 707 | 'description': |
| 708 | 'Java: Double-checked locking on non-volatile fields is unsafe', |
| 709 | 'patterns': [r".*: warning: \[DoubleCheckedLocking\] .+"]}, |
| 710 | {'category': 'java', |
| 711 | 'severity': severity.MEDIUM, |
| 712 | 'members': [], |
| 713 | 'option': '', |
| 714 | 'description': |
| 715 | 'Java: Writes to static fields should not be guarded by instance locks', |
| 716 | 'patterns': [r".*: warning: \[StaticGuardedByInstance\] .+"]}, |
| 717 | {'category': 'java', |
| 718 | 'severity': severity.MEDIUM, |
| 719 | 'members': [], |
| 720 | 'option': '', |
| 721 | 'description': |
| 722 | 'Java: Synchronizing on non-final fields is not safe: if the field is ever updated, different threads may end up locking on different objects.', |
| 723 | 'patterns': [r".*: warning: \[SynchronizeOnNonFinalField\] .+"]}, |
| 724 | {'category': 'java', |
| 725 | 'severity': severity.HIGH, |
| 726 | 'members': [], |
| 727 | 'option': '', |
| 728 | 'description': |
| 729 | 'Java: Reference equality used to compare arrays', |
| 730 | 'patterns': [r".*: warning: \[ArrayEquals\] .+"]}, |
| 731 | {'category': 'java', |
| 732 | 'severity': severity.HIGH, |
| 733 | 'members': [], |
| 734 | 'option': '', |
| 735 | 'description': |
| 736 | 'Java: hashcode method on array does not hash array contents', |
| 737 | 'patterns': [r".*: warning: \[ArrayHashCode\] .+"]}, |
| 738 | {'category': 'java', |
| 739 | 'severity': severity.HIGH, |
| 740 | 'members': [], |
| 741 | 'option': '', |
| 742 | 'description': |
| 743 | 'Java: Calling toString on an array does not provide useful information', |
| 744 | 'patterns': [r".*: warning: \[ArrayToString.*\] .+"]}, |
| 745 | {'category': 'java', |
| 746 | 'severity': severity.HIGH, |
| 747 | 'members': [], |
| 748 | 'option': '', |
| 749 | 'description': |
| 750 | 'Java: Arrays.asList does not autobox primitive arrays, as one might expect.', |
| 751 | 'patterns': [r".*: warning: \[ArraysAsListPrimitiveArray\] .+"]}, |
| 752 | {'category': 'java', |
| 753 | 'severity': severity.HIGH, |
| 754 | 'members': [], |
| 755 | 'option': '', |
| 756 | 'description': |
| 757 | 'Java: AsyncCallable should not return a null Future, only a Future whose result is null.', |
| 758 | 'patterns': [r".*: warning: \[AsyncCallableReturnsNull\] .+"]}, |
| 759 | {'category': 'java', |
| 760 | 'severity': severity.HIGH, |
| 761 | 'members': [], |
| 762 | 'option': '', |
| 763 | 'description': |
| 764 | 'Java: AsyncFunction should not return a null Future, only a Future whose result is null.', |
| 765 | 'patterns': [r".*: warning: \[AsyncFunctionReturnsNull\] .+"]}, |
| 766 | {'category': 'java', |
| 767 | 'severity': severity.HIGH, |
| 768 | 'members': [], |
| 769 | 'option': '', |
| 770 | 'description': |
| 771 | 'Java: Possible sign flip from narrowing conversion', |
| 772 | 'patterns': [r".*: warning: \[BadComparable\] .+"]}, |
| 773 | {'category': 'java', |
| 774 | 'severity': severity.HIGH, |
| 775 | 'members': [], |
| 776 | 'option': '', |
| 777 | 'description': |
| 778 | 'Java: Shift by an amount that is out of range', |
| 779 | 'patterns': [r".*: warning: \[BadShiftAmount\] .+"]}, |
| 780 | {'category': 'java', |
| 781 | 'severity': severity.HIGH, |
| 782 | 'members': [], |
| 783 | 'option': '', |
| 784 | 'description': |
| 785 | 'Java: valueOf provides better time and space performance', |
| 786 | 'patterns': [r".*: warning: \[BoxedPrimitiveConstructor\] .+"]}, |
| 787 | {'category': 'java', |
| 788 | 'severity': severity.HIGH, |
| 789 | 'members': [], |
| 790 | 'option': '', |
| 791 | 'description': |
| 792 | '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.', |
| 793 | 'patterns': [r".*: warning: \[ChainingConstructorIgnoresParameter\] .+"]}, |
| 794 | {'category': 'java', |
| 795 | 'severity': severity.HIGH, |
| 796 | 'members': [], |
| 797 | 'option': '', |
| 798 | 'description': |
| 799 | 'Java: Ignored return value of method that is annotated with @CheckReturnValue', |
| 800 | 'patterns': [r".*: warning: \[CheckReturnValue\] .+"]}, |
| 801 | {'category': 'java', |
| 802 | 'severity': severity.HIGH, |
| 803 | 'members': [], |
| 804 | 'option': '', |
| 805 | 'description': |
| 806 | 'Java: Inner class is non-static but does not reference enclosing class', |
| 807 | 'patterns': [r".*: warning: \[ClassCanBeStatic\] .+"]}, |
| 808 | {'category': 'java', |
| 809 | 'severity': severity.HIGH, |
| 810 | 'members': [], |
| 811 | 'option': '', |
| 812 | 'description': |
| 813 | 'Java: The source file name should match the name of the top-level class it contains', |
| 814 | 'patterns': [r".*: warning: \[ClassName\] .+"]}, |
| 815 | {'category': 'java', |
| 816 | 'severity': severity.HIGH, |
| 817 | 'members': [], |
| 818 | 'option': '', |
| 819 | 'description': |
| 820 | 'Java: This comparison method violates the contract', |
| 821 | 'patterns': [r".*: warning: \[ComparisonContractViolated\] .+"]}, |
| 822 | {'category': 'java', |
| 823 | 'severity': severity.HIGH, |
| 824 | 'members': [], |
| 825 | 'option': '', |
| 826 | 'description': |
| 827 | 'Java: Comparison to value that is out of range for the compared type', |
| 828 | 'patterns': [r".*: warning: \[ComparisonOutOfRange\] .+"]}, |
| 829 | {'category': 'java', |
| 830 | 'severity': severity.HIGH, |
| 831 | 'members': [], |
| 832 | 'option': '', |
| 833 | 'description': |
| 834 | 'Java: Non-compile-time constant expression passed to parameter with @CompileTimeConstant type annotation.', |
| 835 | 'patterns': [r".*: warning: \[CompileTimeConstant\] .+"]}, |
| 836 | {'category': 'java', |
| 837 | 'severity': severity.HIGH, |
| 838 | 'members': [], |
| 839 | 'option': '', |
| 840 | 'description': |
| 841 | 'Java: Exception created but not thrown', |
| 842 | 'patterns': [r".*: warning: \[DeadException\] .+"]}, |
| 843 | {'category': 'java', |
| 844 | 'severity': severity.HIGH, |
| 845 | 'members': [], |
| 846 | 'option': '', |
| 847 | 'description': |
| 848 | 'Java: Division by integer literal zero', |
| 849 | 'patterns': [r".*: warning: \[DivZero\] .+"]}, |
| 850 | {'category': 'java', |
| 851 | 'severity': severity.HIGH, |
| 852 | 'members': [], |
| 853 | 'option': '', |
| 854 | 'description': |
| 855 | 'Java: Empty statement after if', |
| 856 | 'patterns': [r".*: warning: \[EmptyIf\] .+"]}, |
| 857 | {'category': 'java', |
| 858 | 'severity': severity.HIGH, |
| 859 | 'members': [], |
| 860 | 'option': '', |
| 861 | 'description': |
| 862 | 'Java: == NaN always returns false; use the isNaN methods instead', |
| 863 | 'patterns': [r".*: warning: \[EqualsNaN\] .+"]}, |
| 864 | {'category': 'java', |
| 865 | 'severity': severity.HIGH, |
| 866 | 'members': [], |
| 867 | 'option': '', |
| 868 | 'description': |
| 869 | 'Java: Method annotated @ForOverride must be protected or package-private and only invoked from declaring class', |
| 870 | 'patterns': [r".*: warning: \[ForOverride\] .+"]}, |
| 871 | {'category': 'java', |
| 872 | 'severity': severity.HIGH, |
| 873 | 'members': [], |
| 874 | 'option': '', |
| 875 | 'description': |
| 876 | 'Java: Futures.getChecked requires a checked exception type with a standard constructor.', |
| 877 | 'patterns': [r".*: warning: \[FuturesGetCheckedIllegalExceptionType\] .+"]}, |
| 878 | {'category': 'java', |
| 879 | 'severity': severity.HIGH, |
| 880 | 'members': [], |
| 881 | 'option': '', |
| 882 | 'description': |
| 883 | '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', |
| 884 | 'patterns': [r".*: warning: \[GetClassOnClass\] .+"]}, |
| 885 | {'category': 'java', |
| 886 | 'severity': severity.HIGH, |
| 887 | 'members': [], |
| 888 | 'option': '', |
| 889 | 'description': |
| 890 | 'Java: An object is tested for equality to itself using Guava Libraries', |
| 891 | 'patterns': [r".*: warning: \[GuavaSelfEquals\] .+"]}, |
| 892 | {'category': 'java', |
| 893 | 'severity': severity.HIGH, |
| 894 | 'members': [], |
| 895 | 'option': '', |
| 896 | 'description': |
| 897 | 'Java: contains() is a legacy method that is equivalent to containsValue()', |
| 898 | 'patterns': [r".*: warning: \[HashtableContains\] .+"]}, |
| 899 | {'category': 'java', |
| 900 | 'severity': severity.HIGH, |
| 901 | 'members': [], |
| 902 | 'option': '', |
| 903 | 'description': |
| 904 | 'Java: Cipher.getInstance() is invoked using either the default settings or ECB mode', |
| 905 | 'patterns': [r".*: warning: \[InsecureCipherMode\] .+"]}, |
| 906 | {'category': 'java', |
| 907 | 'severity': severity.HIGH, |
| 908 | 'members': [], |
| 909 | 'option': '', |
| 910 | 'description': |
| 911 | 'Java: Invalid syntax used for a regular expression', |
| 912 | 'patterns': [r".*: warning: \[InvalidPatternSyntax\] .+"]}, |
| 913 | {'category': 'java', |
| 914 | 'severity': severity.HIGH, |
| 915 | 'members': [], |
| 916 | 'option': '', |
| 917 | 'description': |
| 918 | 'Java: The argument to Class#isInstance(Object) should not be a Class', |
| 919 | 'patterns': [r".*: warning: \[IsInstanceOfClass\] .+"]}, |
| 920 | {'category': 'java', |
| 921 | 'severity': severity.HIGH, |
| 922 | 'members': [], |
| 923 | 'option': '', |
| 924 | 'description': |
| 925 | 'Java: jMock tests must have a @RunWith(JMock.class) annotation, or the Mockery field must have a @Rule JUnit annotation', |
| 926 | 'patterns': [r".*: warning: \[JMockTestWithoutRunWithOrRuleAnnotation\] .+"]}, |
| 927 | {'category': 'java', |
| 928 | 'severity': severity.HIGH, |
| 929 | 'members': [], |
| 930 | 'option': '', |
| 931 | 'description': |
| 932 | 'Java: Test method will not be run; please prefix name with "test"', |
| 933 | 'patterns': [r".*: warning: \[JUnit3TestNotRun\] .+"]}, |
| 934 | {'category': 'java', |
| 935 | 'severity': severity.HIGH, |
| 936 | 'members': [], |
| 937 | 'option': '', |
| 938 | 'description': |
| 939 | 'Java: setUp() method will not be run; Please add a @Before annotation', |
| 940 | 'patterns': [r".*: warning: \[JUnit4SetUpNotRun\] .+"]}, |
| 941 | {'category': 'java', |
| 942 | 'severity': severity.HIGH, |
| 943 | 'members': [], |
| 944 | 'option': '', |
| 945 | 'description': |
| 946 | 'Java: tearDown() method will not be run; Please add an @After annotation', |
| 947 | 'patterns': [r".*: warning: \[JUnit4TearDownNotRun\] .+"]}, |
| 948 | {'category': 'java', |
| 949 | 'severity': severity.HIGH, |
| 950 | 'members': [], |
| 951 | 'option': '', |
| 952 | 'description': |
| 953 | 'Java: Test method will not be run; please add @Test annotation', |
| 954 | 'patterns': [r".*: warning: \[JUnit4TestNotRun\] .+"]}, |
| 955 | {'category': 'java', |
| 956 | 'severity': severity.HIGH, |
| 957 | 'members': [], |
| 958 | 'option': '', |
| 959 | 'description': |
| 960 | 'Java: Printf-like format string does not match its arguments', |
| 961 | 'patterns': [r".*: warning: \[MalformedFormatString\] .+"]}, |
| 962 | {'category': 'java', |
| 963 | 'severity': severity.HIGH, |
| 964 | 'members': [], |
| 965 | 'option': '', |
| 966 | 'description': |
| 967 | 'Java: Use of "YYYY" (week year) in a date pattern without "ww" (week in year). You probably meant to use "yyyy" (year) instead.', |
| 968 | 'patterns': [r".*: warning: \[MisusedWeekYear\] .+"]}, |
| 969 | {'category': 'java', |
| 970 | 'severity': severity.HIGH, |
| 971 | 'members': [], |
| 972 | 'option': '', |
| 973 | 'description': |
| 974 | 'Java: A bug in Mockito will cause this test to fail at runtime with a ClassCastException', |
| 975 | 'patterns': [r".*: warning: \[MockitoCast\] .+"]}, |
| 976 | {'category': 'java', |
| 977 | 'severity': severity.HIGH, |
| 978 | 'members': [], |
| 979 | 'option': '', |
| 980 | 'description': |
| 981 | 'Java: Missing method call for verify(mock) here', |
| 982 | 'patterns': [r".*: warning: \[MockitoUsage\] .+"]}, |
| 983 | {'category': 'java', |
| 984 | 'severity': severity.HIGH, |
| 985 | 'members': [], |
| 986 | 'option': '', |
| 987 | 'description': |
| 988 | 'Java: Modifying a collection with itself', |
| 989 | 'patterns': [r".*: warning: \[ModifyingCollectionWithItself\] .+"]}, |
| 990 | {'category': 'java', |
| 991 | 'severity': severity.HIGH, |
| 992 | 'members': [], |
| 993 | 'option': '', |
| 994 | 'description': |
| 995 | 'Java: Compound assignments to bytes, shorts, chars, and floats hide dangerous casts', |
| 996 | 'patterns': [r".*: warning: \[NarrowingCompoundAssignment\] .+"]}, |
| 997 | {'category': 'java', |
| 998 | 'severity': severity.HIGH, |
| 999 | 'members': [], |
| 1000 | 'option': '', |
| 1001 | 'description': |
| 1002 | 'Java: @NoAllocation was specified on this method, but something was found that would trigger an allocation', |
| 1003 | 'patterns': [r".*: warning: \[NoAllocation\] .+"]}, |
| 1004 | {'category': 'java', |
| 1005 | 'severity': severity.HIGH, |
| 1006 | 'members': [], |
| 1007 | 'option': '', |
| 1008 | 'description': |
| 1009 | 'Java: Static import of type uses non-canonical name', |
| 1010 | 'patterns': [r".*: warning: \[NonCanonicalStaticImport\] .+"]}, |
| 1011 | {'category': 'java', |
| 1012 | 'severity': severity.HIGH, |
| 1013 | 'members': [], |
| 1014 | 'option': '', |
| 1015 | 'description': |
| 1016 | 'Java: @CompileTimeConstant parameters should be final', |
| 1017 | 'patterns': [r".*: warning: \[NonFinalCompileTimeConstant\] .+"]}, |
| 1018 | {'category': 'java', |
| 1019 | 'severity': severity.HIGH, |
| 1020 | 'members': [], |
| 1021 | 'option': '', |
| 1022 | 'description': |
| 1023 | 'Java: Calling getAnnotation on an annotation that is not retained at runtime.', |
| 1024 | 'patterns': [r".*: warning: \[NonRuntimeAnnotation\] .+"]}, |
| 1025 | {'category': 'java', |
| 1026 | 'severity': severity.HIGH, |
| 1027 | 'members': [], |
| 1028 | 'option': '', |
| 1029 | 'description': |
| 1030 | 'Java: Numeric comparison using reference equality instead of value equality', |
| 1031 | 'patterns': [r".*: warning: \[NumericEquality\] .+"]}, |
| 1032 | {'category': 'java', |
| 1033 | 'severity': severity.HIGH, |
| 1034 | 'members': [], |
| 1035 | 'option': '', |
| 1036 | 'description': |
| 1037 | 'Java: Comparison using reference equality instead of value equality', |
| 1038 | 'patterns': [r".*: warning: \[OptionalEquality\] .+"]}, |
| 1039 | {'category': 'java', |
| 1040 | 'severity': severity.HIGH, |
| 1041 | 'members': [], |
| 1042 | 'option': '', |
| 1043 | 'description': |
| 1044 | 'Java: Varargs doesn\'t agree for overridden method', |
| 1045 | 'patterns': [r".*: warning: \[Overrides\] .+"]}, |
| 1046 | {'category': 'java', |
| 1047 | 'severity': severity.HIGH, |
| 1048 | 'members': [], |
| 1049 | 'option': '', |
| 1050 | 'description': |
| 1051 | 'Java: Literal passed as first argument to Preconditions.checkNotNull() can never be null', |
| 1052 | 'patterns': [r".*: warning: \[PreconditionsCheckNotNull\] .+"]}, |
| 1053 | {'category': 'java', |
| 1054 | 'severity': severity.HIGH, |
| 1055 | 'members': [], |
| 1056 | 'option': '', |
| 1057 | 'description': |
| 1058 | 'Java: First argument to `Preconditions.checkNotNull()` is a primitive rather than an object reference', |
| 1059 | 'patterns': [r".*: warning: \[PreconditionsCheckNotNullPrimitive\] .+"]}, |
| 1060 | {'category': 'java', |
| 1061 | 'severity': severity.HIGH, |
| 1062 | 'members': [], |
| 1063 | 'option': '', |
| 1064 | 'description': |
| 1065 | 'Java: Protobuf fields cannot be null', |
| 1066 | 'patterns': [r".*: warning: \[ProtoFieldNullComparison\] .+"]}, |
| 1067 | {'category': 'java', |
| 1068 | 'severity': severity.HIGH, |
| 1069 | 'members': [], |
| 1070 | 'option': '', |
| 1071 | 'description': |
| 1072 | 'Java: Comparing protobuf fields of type String using reference equality', |
| 1073 | 'patterns': [r".*: warning: \[ProtoStringFieldReferenceEquality\] .+"]}, |
| 1074 | {'category': 'java', |
| 1075 | 'severity': severity.HIGH, |
| 1076 | 'members': [], |
| 1077 | 'option': '', |
| 1078 | 'description': |
| 1079 | 'Java: Check for non-whitelisted callers to RestrictedApiChecker.', |
| 1080 | 'patterns': [r".*: warning: \[RestrictedApiChecker\] .+"]}, |
| 1081 | {'category': 'java', |
| 1082 | 'severity': severity.HIGH, |
| 1083 | 'members': [], |
| 1084 | 'option': '', |
| 1085 | 'description': |
| 1086 | 'Java: Return value of this method must be used', |
| 1087 | 'patterns': [r".*: warning: \[ReturnValueIgnored\] .+"]}, |
| 1088 | {'category': 'java', |
| 1089 | 'severity': severity.HIGH, |
| 1090 | 'members': [], |
| 1091 | 'option': '', |
| 1092 | 'description': |
| 1093 | 'Java: Variable assigned to itself', |
| 1094 | 'patterns': [r".*: warning: \[SelfAssignment\] .+"]}, |
| 1095 | {'category': 'java', |
| 1096 | 'severity': severity.HIGH, |
| 1097 | 'members': [], |
| 1098 | 'option': '', |
| 1099 | 'description': |
| 1100 | 'Java: An object is compared to itself', |
| 1101 | 'patterns': [r".*: warning: \[SelfComparision\] .+"]}, |
| 1102 | {'category': 'java', |
| 1103 | 'severity': severity.HIGH, |
| 1104 | 'members': [], |
| 1105 | 'option': '', |
| 1106 | 'description': |
| 1107 | 'Java: Variable compared to itself', |
| 1108 | 'patterns': [r".*: warning: \[SelfEquality\] .+"]}, |
| 1109 | {'category': 'java', |
| 1110 | 'severity': severity.HIGH, |
| 1111 | 'members': [], |
| 1112 | 'option': '', |
| 1113 | 'description': |
| 1114 | 'Java: An object is tested for equality to itself', |
| 1115 | 'patterns': [r".*: warning: \[SelfEquals\] .+"]}, |
| 1116 | {'category': 'java', |
| 1117 | 'severity': severity.HIGH, |
| 1118 | 'members': [], |
| 1119 | 'option': '', |
| 1120 | 'description': |
| 1121 | 'Java: Comparison of a size >= 0 is always true, did you intend to check for non-emptiness?', |
| 1122 | 'patterns': [r".*: warning: \[SizeGreaterThanOrEqualsZero\] .+"]}, |
| 1123 | {'category': 'java', |
| 1124 | 'severity': severity.HIGH, |
| 1125 | 'members': [], |
| 1126 | 'option': '', |
| 1127 | 'description': |
| 1128 | 'Java: Calling toString on a Stream does not provide useful information', |
| 1129 | 'patterns': [r".*: warning: \[StreamToString\] .+"]}, |
| 1130 | {'category': 'java', |
| 1131 | 'severity': severity.HIGH, |
| 1132 | 'members': [], |
| 1133 | 'option': '', |
| 1134 | 'description': |
| 1135 | 'Java: StringBuilder does not have a char constructor; this invokes the int constructor.', |
| 1136 | 'patterns': [r".*: warning: \[StringBuilderInitWithChar\] .+"]}, |
| 1137 | {'category': 'java', |
| 1138 | 'severity': severity.HIGH, |
| 1139 | 'members': [], |
| 1140 | 'option': '', |
| 1141 | 'description': |
| 1142 | 'Java: Suppressing "deprecated" is probably a typo for "deprecation"', |
| 1143 | 'patterns': [r".*: warning: \[SuppressWarningsDeprecated\] .+"]}, |
| 1144 | {'category': 'java', |
| 1145 | 'severity': severity.HIGH, |
| 1146 | 'members': [], |
| 1147 | 'option': '', |
| 1148 | 'description': |
| 1149 | 'Java: throwIfUnchecked(knownCheckedException) is a no-op.', |
| 1150 | 'patterns': [r".*: warning: \[ThrowIfUncheckedKnownChecked\] .+"]}, |
| 1151 | {'category': 'java', |
| 1152 | 'severity': severity.HIGH, |
| 1153 | 'members': [], |
| 1154 | 'option': '', |
| 1155 | 'description': |
| 1156 | 'Java: Catching Throwable/Error masks failures from fail() or assert*() in the try block', |
| 1157 | 'patterns': [r".*: warning: \[TryFailThrowable\] .+"]}, |
| 1158 | {'category': 'java', |
| 1159 | 'severity': severity.HIGH, |
| 1160 | 'members': [], |
| 1161 | 'option': '', |
| 1162 | 'description': |
| 1163 | 'Java: Type parameter used as type qualifier', |
| 1164 | 'patterns': [r".*: warning: \[TypeParameterQualifier\] .+"]}, |
| 1165 | {'category': 'java', |
| 1166 | 'severity': severity.HIGH, |
| 1167 | 'members': [], |
| 1168 | 'option': '', |
| 1169 | 'description': |
| 1170 | 'Java: Non-generic methods should not be invoked with type arguments', |
| 1171 | 'patterns': [r".*: warning: \[UnnecessaryTypeArgument\] .+"]}, |
| 1172 | {'category': 'java', |
| 1173 | 'severity': severity.HIGH, |
| 1174 | 'members': [], |
| 1175 | 'option': '', |
| 1176 | 'description': |
| 1177 | 'Java: Instance created but never used', |
| 1178 | 'patterns': [r".*: warning: \[UnusedAnonymousClass\] .+"]}, |
| 1179 | {'category': 'java', |
| 1180 | 'severity': severity.HIGH, |
| 1181 | 'members': [], |
| 1182 | 'option': '', |
| 1183 | 'description': |
| 1184 | 'Java: Use of wildcard imports is forbidden', |
| 1185 | 'patterns': [r".*: warning: \[WildcardImport\] .+"]}, |
| 1186 | {'category': 'java', |
| 1187 | 'severity': severity.HIGH, |
| 1188 | 'members': [], |
| 1189 | 'option': '', |
| 1190 | 'description': |
| 1191 | 'Java: Method parameter has wrong package', |
| 1192 | 'patterns': [r".*: warning: \[ParameterPackage\] .+"]}, |
| 1193 | {'category': 'java', |
| 1194 | 'severity': severity.HIGH, |
| 1195 | 'members': [], |
| 1196 | 'option': '', |
| 1197 | 'description': |
| 1198 | 'Java: Certain resources in `android.R.string` have names that do not match their content', |
| 1199 | 'patterns': [r".*: warning: \[MislabeledAndroidString\] .+"]}, |
| 1200 | {'category': 'java', |
| 1201 | 'severity': severity.HIGH, |
| 1202 | 'members': [], |
| 1203 | 'option': '', |
| 1204 | 'description': |
| 1205 | 'Java: Return value of android.graphics.Rect.intersect() must be checked', |
| 1206 | 'patterns': [r".*: warning: \[RectIntersectReturnValueIgnored\] .+"]}, |
| 1207 | {'category': 'java', |
| 1208 | 'severity': severity.HIGH, |
| 1209 | 'members': [], |
| 1210 | 'option': '', |
| 1211 | 'description': |
| 1212 | 'Java: Invalid printf-style format string', |
| 1213 | 'patterns': [r".*: warning: \[FormatString\] .+"]}, |
| 1214 | {'category': 'java', |
| 1215 | 'severity': severity.HIGH, |
| 1216 | 'members': [], |
| 1217 | 'option': '', |
| 1218 | 'description': |
| 1219 | 'Java: @AssistedInject and @Inject cannot be used on the same constructor.', |
| 1220 | 'patterns': [r".*: warning: \[AssistedInjectAndInjectOnSameConstructor\] .+"]}, |
| 1221 | {'category': 'java', |
| 1222 | 'severity': severity.HIGH, |
| 1223 | 'members': [], |
| 1224 | 'option': '', |
| 1225 | 'description': |
| 1226 | 'Java: Injected constructors cannot be optional nor have binding annotations', |
| 1227 | 'patterns': [r".*: warning: \[InjectedConstructorAnnotations\] .+"]}, |
| 1228 | {'category': 'java', |
| 1229 | 'severity': severity.HIGH, |
| 1230 | 'members': [], |
| 1231 | 'option': '', |
| 1232 | 'description': |
| 1233 | 'Java: The target of a scoping annotation must be set to METHOD and/or TYPE.', |
| 1234 | 'patterns': [r".*: warning: \[InjectInvalidTargetingOnScopingAnnotation\] .+"]}, |
| 1235 | {'category': 'java', |
| 1236 | 'severity': severity.HIGH, |
| 1237 | 'members': [], |
| 1238 | 'option': '', |
| 1239 | 'description': |
| 1240 | 'Java: Abstract methods are not injectable with javax.inject.Inject.', |
| 1241 | 'patterns': [r".*: warning: \[JavaxInjectOnAbstractMethod\] .+"]}, |
| 1242 | {'category': 'java', |
| 1243 | 'severity': severity.HIGH, |
| 1244 | 'members': [], |
| 1245 | 'option': '', |
| 1246 | 'description': |
| 1247 | 'Java: @javax.inject.Inject cannot be put on a final field.', |
| 1248 | 'patterns': [r".*: warning: \[JavaxInjectOnFinalField\] .+"]}, |
| 1249 | {'category': 'java', |
| 1250 | 'severity': severity.HIGH, |
| 1251 | 'members': [], |
| 1252 | 'option': '', |
| 1253 | 'description': |
| 1254 | 'Java: A class may not have more than one injectable constructor.', |
| 1255 | 'patterns': [r".*: warning: \[MoreThanOneInjectableConstructor\] .+"]}, |
| 1256 | {'category': 'java', |
| 1257 | 'severity': severity.HIGH, |
| 1258 | 'members': [], |
| 1259 | 'option': '', |
| 1260 | 'description': |
| 1261 | 'Java: Using more than one qualifier annotation on the same element is not allowed.', |
| 1262 | 'patterns': [r".*: warning: \[InjectMoreThanOneQualifier\] .+"]}, |
| 1263 | {'category': 'java', |
| 1264 | 'severity': severity.HIGH, |
| 1265 | 'members': [], |
| 1266 | 'option': '', |
| 1267 | 'description': |
| 1268 | 'Java: A class can be annotated with at most one scope annotation', |
| 1269 | 'patterns': [r".*: warning: \[InjectMoreThanOneScopeAnnotationOnClass\] .+"]}, |
| 1270 | {'category': 'java', |
| 1271 | 'severity': severity.HIGH, |
| 1272 | 'members': [], |
| 1273 | 'option': '', |
| 1274 | 'description': |
| 1275 | 'Java: Annotations cannot be both Qualifiers/BindingAnnotations and Scopes', |
| 1276 | 'patterns': [r".*: warning: \[OverlappingQualifierAndScopeAnnotation\] .+"]}, |
| 1277 | {'category': 'java', |
| 1278 | 'severity': severity.HIGH, |
| 1279 | 'members': [], |
| 1280 | 'option': '', |
| 1281 | 'description': |
| 1282 | 'Java: Scope annotation on an interface or abstact class is not allowed', |
| 1283 | 'patterns': [r".*: warning: \[InjectScopeAnnotationOnInterfaceOrAbstractClass\] .+"]}, |
| 1284 | {'category': 'java', |
| 1285 | 'severity': severity.HIGH, |
| 1286 | 'members': [], |
| 1287 | 'option': '', |
| 1288 | 'description': |
| 1289 | 'Java: Scoping and qualifier annotations must have runtime retention.', |
| 1290 | 'patterns': [r".*: warning: \[InjectScopeOrQualifierAnnotationRetention\] .+"]}, |
| 1291 | {'category': 'java', |
| 1292 | 'severity': severity.HIGH, |
| 1293 | 'members': [], |
| 1294 | 'option': '', |
| 1295 | 'description': |
| 1296 | 'Java: Dagger @Provides methods may not return null unless annotated with @Nullable', |
| 1297 | 'patterns': [r".*: warning: \[DaggerProvidesNull\] .+"]}, |
| 1298 | {'category': 'java', |
| 1299 | 'severity': severity.HIGH, |
| 1300 | 'members': [], |
| 1301 | 'option': '', |
| 1302 | 'description': |
| 1303 | 'Java: Scope annotation on implementation class of AssistedInject factory is not allowed', |
| 1304 | 'patterns': [r".*: warning: \[GuiceAssistedInjectScoping\] .+"]}, |
| 1305 | {'category': 'java', |
| 1306 | 'severity': severity.HIGH, |
| 1307 | 'members': [], |
| 1308 | 'option': '', |
| 1309 | 'description': |
| 1310 | 'Java: A constructor cannot have two @Assisted parameters of the same type unless they are disambiguated with named @Assisted annotations. ', |
| 1311 | 'patterns': [r".*: warning: \[GuiceAssistedParameters\] .+"]}, |
| 1312 | {'category': 'java', |
| 1313 | 'severity': severity.HIGH, |
| 1314 | 'members': [], |
| 1315 | 'option': '', |
| 1316 | 'description': |
| 1317 | 'Java: This method is not annotated with @Inject, but it overrides a method that is annotated with @javax.inject.Inject.', |
| 1318 | 'patterns': [r".*: warning: \[OverridesJavaxInjectableMethod\] .+"]}, |
| 1319 | {'category': 'java', |
| 1320 | 'severity': severity.HIGH, |
| 1321 | 'members': [], |
| 1322 | 'option': '', |
| 1323 | 'description': |
| 1324 | 'Java: Checks for unguarded accesses to fields and methods with @GuardedBy annotations', |
| 1325 | 'patterns': [r".*: warning: \[GuardedByChecker\] .+"]}, |
| 1326 | {'category': 'java', |
| 1327 | 'severity': severity.HIGH, |
| 1328 | 'members': [], |
| 1329 | 'option': '', |
| 1330 | 'description': |
| 1331 | 'Java: Invalid @GuardedBy expression', |
| 1332 | 'patterns': [r".*: warning: \[GuardedByValidator\] .+"]}, |
| 1333 | {'category': 'java', |
| 1334 | 'severity': severity.HIGH, |
| 1335 | 'members': [], |
| 1336 | 'option': '', |
| 1337 | 'description': |
| 1338 | 'Java: Type declaration annotated with @Immutable is not immutable', |
| 1339 | 'patterns': [r".*: warning: \[Immutable\] .+"]}, |
| 1340 | {'category': 'java', |
| 1341 | 'severity': severity.HIGH, |
| 1342 | 'members': [], |
| 1343 | 'option': '', |
| 1344 | 'description': |
| 1345 | 'Java: This method does not acquire the locks specified by its @LockMethod annotation', |
| 1346 | 'patterns': [r".*: warning: \[LockMethodChecker\] .+"]}, |
| 1347 | {'category': 'java', |
| 1348 | 'severity': severity.HIGH, |
| 1349 | 'members': [], |
| 1350 | 'option': '', |
| 1351 | 'description': |
| 1352 | 'Java: This method does not acquire the locks specified by its @UnlockMethod annotation', |
| 1353 | 'patterns': [r".*: warning: \[UnlockMethod\] .+"]}, |
Ian Rogers | 32bb9bd | 2016-05-09 23:19:42 -0700 | [diff] [blame] | 1354 | |
Ian Rogers | 6e52003 | 2016-05-13 08:59:00 -0700 | [diff] [blame] | 1355 | {'category': 'java', |
| 1356 | 'severity': severity.UNKNOWN, |
| 1357 | 'members': [], |
| 1358 | 'option': '', |
| 1359 | 'description': 'Java: Unclassified/unrecognized warnings', |
| 1360 | 'patterns': [r".*: warning: \[.+\] .+"]}, |
Ian Rogers | 32bb9bd | 2016-05-09 23:19:42 -0700 | [diff] [blame] | 1361 | |
Marco Nelissen | 594375d | 2009-07-14 09:04:04 -0700 | [diff] [blame] | 1362 | { 'category':'aapt', 'severity':severity.MEDIUM, 'members':[], 'option':'', |
Marco Nelissen | 8e20196 | 2010-03-10 16:16:02 -0800 | [diff] [blame] | 1363 | 'description':'aapt: No default translation', |
| 1364 | 'patterns':[r".*: warning: string '.+' has no default translation in .*"] }, |
| 1365 | { 'category':'aapt', 'severity':severity.MEDIUM, 'members':[], 'option':'', |
| 1366 | 'description':'aapt: Missing default or required localization', |
| 1367 | 'patterns':[r".*: warning: \*\*\*\* string '.+' has no default or required localization for '.+' in .+"] }, |
| 1368 | { 'category':'aapt', 'severity':severity.MEDIUM, 'members':[], 'option':'', |
Marco Nelissen | 594375d | 2009-07-14 09:04:04 -0700 | [diff] [blame] | 1369 | 'description':'aapt: String marked untranslatable, but translation exists', |
| 1370 | 'patterns':[r".*: warning: string '.+' in .* marked untranslatable but exists in locale '??_??'"] }, |
| 1371 | { 'category':'aapt', 'severity':severity.MEDIUM, 'members':[], 'option':'', |
| 1372 | 'description':'aapt: empty span in string', |
| 1373 | 'patterns':[r".*: warning: empty '.+' span found in text '.+"] }, |
| 1374 | { 'category':'C/C++', 'severity':severity.MEDIUM, 'members':[], 'option':'', |
| 1375 | 'description':'Taking address of temporary', |
| 1376 | 'patterns':[r".*: warning: taking address of temporary"] }, |
| 1377 | { 'category':'C/C++', 'severity':severity.MEDIUM, 'members':[], 'option':'', |
| 1378 | 'description':'Possible broken line continuation', |
| 1379 | 'patterns':[r".*: warning: backslash and newline separated by space"] }, |
Chih-Hung Hsieh | c21ddbd | 2016-07-20 10:08:51 -0700 | [diff] [blame] | 1380 | { 'category':'C/C++', 'severity':severity.MEDIUM, 'members':[], 'option':'-Wundefined-var-template', |
| 1381 | 'description':'Undefined variable template', |
| 1382 | 'patterns':[r".*: warning: instantiation of variable .* no definition is available"] }, |
Chih-Hung Hsieh | 8d14543 | 2016-07-01 15:48:06 -0700 | [diff] [blame] | 1383 | { 'category':'C/C++', 'severity':severity.MEDIUM, 'members':[], 'option':'-Wundefined-inline', |
| 1384 | 'description':'Inline function is not defined', |
| 1385 | 'patterns':[r".*: warning: inline function '.*' is not defined"] }, |
Marco Nelissen | 594375d | 2009-07-14 09:04:04 -0700 | [diff] [blame] | 1386 | { 'category':'C/C++', 'severity':severity.MEDIUM, 'members':[], 'option':'-Warray-bounds', |
| 1387 | 'description':'Array subscript out of bounds', |
Marco Nelissen | 8e20196 | 2010-03-10 16:16:02 -0800 | [diff] [blame] | 1388 | 'patterns':[r".*: warning: array subscript is above array bounds", |
Chih-Hung Hsieh | ba0ddcd | 2016-03-21 11:28:30 -0700 | [diff] [blame] | 1389 | r".*: warning: Array subscript is undefined", |
Marco Nelissen | 8e20196 | 2010-03-10 16:16:02 -0800 | [diff] [blame] | 1390 | r".*: warning: array subscript is below array bounds"] }, |
Marco Nelissen | 594375d | 2009-07-14 09:04:04 -0700 | [diff] [blame] | 1391 | { 'category':'C/C++', 'severity':severity.MEDIUM, 'members':[], 'option':'', |
Chih-Hung Hsieh | ba0ddcd | 2016-03-21 11:28:30 -0700 | [diff] [blame] | 1392 | 'description':'Excess elements in initializer', |
| 1393 | 'patterns':[r".*: warning: excess elements in .+ initializer"] }, |
| 1394 | { 'category':'C/C++', 'severity':severity.MEDIUM, 'members':[], 'option':'', |
Marco Nelissen | 594375d | 2009-07-14 09:04:04 -0700 | [diff] [blame] | 1395 | 'description':'Decimal constant is unsigned only in ISO C90', |
| 1396 | 'patterns':[r".*: warning: this decimal constant is unsigned only in ISO C90"] }, |
| 1397 | { 'category':'C/C++', 'severity':severity.MEDIUM, 'members':[], 'option':'-Wmain', |
| 1398 | 'description':'main is usually a function', |
| 1399 | 'patterns':[r".*: warning: 'main' is usually a function"] }, |
| 1400 | { 'category':'C/C++', 'severity':severity.MEDIUM, 'members':[], 'option':'', |
| 1401 | 'description':'Typedef ignored', |
| 1402 | 'patterns':[r".*: warning: 'typedef' was ignored in this declaration"] }, |
| 1403 | { 'category':'C/C++', 'severity':severity.HIGH, 'members':[], 'option':'-Waddress', |
| 1404 | 'description':'Address always evaluates to true', |
| 1405 | 'patterns':[r".*: warning: the address of '.+' will always evaluate as 'true'"] }, |
| 1406 | { 'category':'C/C++', 'severity':severity.FIXMENOW, 'members':[], 'option':'', |
| 1407 | 'description':'Freeing a non-heap object', |
| 1408 | 'patterns':[r".*: warning: attempt to free a non-heap object '.+'"] }, |
| 1409 | { 'category':'C/C++', 'severity':severity.MEDIUM, 'members':[], 'option':'-Wchar-subscripts', |
| 1410 | 'description':'Array subscript has type char', |
Chih-Hung Hsieh | f8aaf60 | 2016-03-16 12:18:16 -0700 | [diff] [blame] | 1411 | 'patterns':[r".*: warning: array subscript .+ type 'char'.+Wchar-subscripts"] }, |
Marco Nelissen | 594375d | 2009-07-14 09:04:04 -0700 | [diff] [blame] | 1412 | { 'category':'C/C++', 'severity':severity.MEDIUM, 'members':[], 'option':'', |
| 1413 | 'description':'Constant too large for type', |
| 1414 | 'patterns':[r".*: warning: integer constant is too large for '.+' type"] }, |
| 1415 | { 'category':'C/C++', 'severity':severity.MEDIUM, 'members':[], 'option':'-Woverflow', |
| 1416 | 'description':'Constant too large for type, truncated', |
| 1417 | 'patterns':[r".*: warning: large integer implicitly truncated to unsigned type"] }, |
Chih-Hung Hsieh | 8d14543 | 2016-07-01 15:48:06 -0700 | [diff] [blame] | 1418 | { 'category':'C/C++', 'severity':severity.MEDIUM, 'members':[], 'option':'-Winteger-overflow', |
| 1419 | 'description':'Overflow in expression', |
| 1420 | 'patterns':[r".*: warning: overflow in expression; .*Winteger-overflow"] }, |
Marco Nelissen | 594375d | 2009-07-14 09:04:04 -0700 | [diff] [blame] | 1421 | { 'category':'C/C++', 'severity':severity.MEDIUM, 'members':[], 'option':'-Woverflow', |
| 1422 | 'description':'Overflow in implicit constant conversion', |
| 1423 | 'patterns':[r".*: warning: overflow in implicit constant conversion"] }, |
| 1424 | { 'category':'C/C++', 'severity':severity.MEDIUM, 'members':[], 'option':'', |
| 1425 | 'description':'Declaration does not declare anything', |
| 1426 | 'patterns':[r".*: warning: declaration 'class .+' does not declare anything"] }, |
| 1427 | { 'category':'C/C++', 'severity':severity.MEDIUM, 'members':[], 'option':'-Wreorder', |
| 1428 | 'description':'Initialization order will be different', |
Chih-Hung Hsieh | ba0ddcd | 2016-03-21 11:28:30 -0700 | [diff] [blame] | 1429 | 'patterns':[r".*: warning: '.+' will be initialized after", |
| 1430 | r".*: warning: field .+ will be initialized after .+Wreorder"] }, |
Marco Nelissen | 594375d | 2009-07-14 09:04:04 -0700 | [diff] [blame] | 1431 | { 'category':'cont.', 'severity':severity.SKIP, 'members':[], 'option':'', |
| 1432 | 'description':'', |
| 1433 | 'patterns':[r".*: warning: '.+'"] }, |
| 1434 | { 'category':'cont.', 'severity':severity.SKIP, 'members':[], 'option':'', |
| 1435 | 'description':'', |
Marco Nelissen | 8e20196 | 2010-03-10 16:16:02 -0800 | [diff] [blame] | 1436 | 'patterns':[r".*: warning: base '.+'"] }, |
| 1437 | { 'category':'cont.', 'severity':severity.SKIP, 'members':[], 'option':'', |
| 1438 | 'description':'', |
Marco Nelissen | 594375d | 2009-07-14 09:04:04 -0700 | [diff] [blame] | 1439 | 'patterns':[r".*: warning: when initialized here"] }, |
| 1440 | { 'category':'C/C++', 'severity':severity.MEDIUM, 'members':[], 'option':'-Wmissing-parameter-type', |
| 1441 | 'description':'Parameter type not specified', |
| 1442 | 'patterns':[r".*: warning: type of '.+' defaults to 'int'"] }, |
Chih-Hung Hsieh | 8d14543 | 2016-07-01 15:48:06 -0700 | [diff] [blame] | 1443 | { 'category':'C/C++', 'severity':severity.MEDIUM, 'members':[], 'option':'-Wmissing-declarations', |
| 1444 | 'description':'Missing declarations', |
| 1445 | 'patterns':[r".*: warning: declaration does not declare anything"] }, |
| 1446 | { 'category':'C/C++', 'severity':severity.MEDIUM, 'members':[], 'option':'-Wmissing-noreturn', |
| 1447 | 'description':'Missing noreturn', |
| 1448 | 'patterns':[r".*: warning: function '.*' could be declared with attribute 'noreturn'"] }, |
Marco Nelissen | 594375d | 2009-07-14 09:04:04 -0700 | [diff] [blame] | 1449 | { 'category':'gcc', 'severity':severity.MEDIUM, 'members':[], 'option':'', |
| 1450 | 'description':'Invalid option for C file', |
| 1451 | 'patterns':[r".*: warning: command line option "".+"" is valid for C\+\+\/ObjC\+\+ but not for C"] }, |
| 1452 | { 'category':'C/C++', 'severity':severity.MEDIUM, 'members':[], 'option':'', |
| 1453 | 'description':'User warning', |
| 1454 | 'patterns':[r".*: warning: #warning "".+"""] }, |
Chih-Hung Hsieh | 8d14543 | 2016-07-01 15:48:06 -0700 | [diff] [blame] | 1455 | { 'category':'C/C++', 'severity':severity.MEDIUM, 'members':[], 'option':'-Wvexing-parse', |
| 1456 | 'description':'Vexing parsing problem', |
| 1457 | 'patterns':[r".*: warning: empty parentheses interpreted as a function declaration"] }, |
Marco Nelissen | 594375d | 2009-07-14 09:04:04 -0700 | [diff] [blame] | 1458 | { 'category':'C/C++', 'severity':severity.MEDIUM, 'members':[], 'option':'-Wextra', |
| 1459 | 'description':'Dereferencing void*', |
| 1460 | 'patterns':[r".*: warning: dereferencing 'void \*' pointer"] }, |
Chih-Hung Hsieh | 8d14543 | 2016-07-01 15:48:06 -0700 | [diff] [blame] | 1461 | { 'category':'C/C++', 'severity':severity.MEDIUM, 'members':[], 'option':'', |
| 1462 | 'description':'Comparison of pointer and integer', |
| 1463 | 'patterns':[r".*: warning: ordered comparison of pointer with integer zero", |
| 1464 | r".*: warning: .*comparison between pointer and integer"] }, |
| 1465 | { 'category':'C/C++', 'severity':severity.MEDIUM, 'members':[], 'option':'', |
| 1466 | 'description':'Use of error-prone unary operator', |
| 1467 | 'patterns':[r".*: warning: use of unary operator that may be intended as compound assignment"] }, |
Marco Nelissen | 594375d | 2009-07-14 09:04:04 -0700 | [diff] [blame] | 1468 | { 'category':'C/C++', 'severity':severity.MEDIUM, 'members':[], 'option':'-Wwrite-strings', |
| 1469 | 'description':'Conversion of string constant to non-const char*', |
| 1470 | 'patterns':[r".*: warning: deprecated conversion from string constant to '.+'"] }, |
| 1471 | { 'category':'C/C++', 'severity':severity.MEDIUM, 'members':[], 'option':'-Wstrict-prototypes', |
| 1472 | 'description':'Function declaration isn''t a prototype', |
| 1473 | 'patterns':[r".*: warning: function declaration isn't a prototype"] }, |
| 1474 | { 'category':'C/C++', 'severity':severity.MEDIUM, 'members':[], 'option':'-Wignored-qualifiers', |
| 1475 | 'description':'Type qualifiers ignored on function return value', |
Chih-Hung Hsieh | f8aaf60 | 2016-03-16 12:18:16 -0700 | [diff] [blame] | 1476 | 'patterns':[r".*: warning: type qualifiers ignored on function return type", |
| 1477 | r".*: warning: .+ type qualifier .+ has no effect .+Wignored-qualifiers"] }, |
Marco Nelissen | 594375d | 2009-07-14 09:04:04 -0700 | [diff] [blame] | 1478 | { 'category':'C/C++', 'severity':severity.MEDIUM, 'members':[], 'option':'', |
| 1479 | 'description':'<foo> declared inside parameter list, scope limited to this definition', |
| 1480 | 'patterns':[r".*: warning: '.+' declared inside parameter list"] }, |
| 1481 | { 'category':'cont.', 'severity':severity.SKIP, 'members':[], 'option':'', |
| 1482 | 'description':'', |
| 1483 | 'patterns':[r".*: warning: its scope is only this definition or declaration, which is probably not what you want"] }, |
| 1484 | { 'category':'C/C++', 'severity':severity.LOW, 'members':[], 'option':'-Wcomment', |
| 1485 | 'description':'Line continuation inside comment', |
| 1486 | 'patterns':[r".*: warning: multi-line comment"] }, |
Marco Nelissen | 8e20196 | 2010-03-10 16:16:02 -0800 | [diff] [blame] | 1487 | { 'category':'C/C++', 'severity':severity.LOW, 'members':[], 'option':'-Wcomment', |
| 1488 | 'description':'Comment inside comment', |
| 1489 | 'patterns':[r".*: warning: "".+"" within comment"] }, |
Chih-Hung Hsieh | f8aaf60 | 2016-03-16 12:18:16 -0700 | [diff] [blame] | 1490 | { 'category':'C/C++', 'severity':severity.LOW, 'members':[], 'option':'', |
| 1491 | 'description':'Value stored is never read', |
| 1492 | 'patterns':[r".*: warning: Value stored to .+ is never read"] }, |
| 1493 | { 'category':'C/C++', 'severity':severity.LOW, 'members':[], 'option':'-Wdeprecated-declarations', |
| 1494 | 'description':'Deprecated declarations', |
| 1495 | 'patterns':[r".*: warning: .+ is deprecated.+deprecated-declarations"] }, |
Chih-Hung Hsieh | 90d4619 | 2016-03-29 15:33:11 -0700 | [diff] [blame] | 1496 | { 'category':'C/C++', 'severity':severity.LOW, 'members':[], 'option':'-Wdeprecated-register', |
| 1497 | 'description':'Deprecated register', |
| 1498 | 'patterns':[r".*: warning: 'register' storage class specifier is deprecated"] }, |
Chih-Hung Hsieh | f8aaf60 | 2016-03-16 12:18:16 -0700 | [diff] [blame] | 1499 | { 'category':'C/C++', 'severity':severity.LOW, 'members':[], 'option':'-Wpointer-sign', |
| 1500 | 'description':'Converts between pointers to integer types with different sign', |
| 1501 | 'patterns':[r".*: warning: .+ converts between pointers to integer types with different sign"] }, |
Marco Nelissen | 594375d | 2009-07-14 09:04:04 -0700 | [diff] [blame] | 1502 | { 'category':'C/C++', 'severity':severity.HARMLESS, 'members':[], 'option':'', |
| 1503 | 'description':'Extra tokens after #endif', |
| 1504 | 'patterns':[r".*: warning: extra tokens at end of #endif directive"] }, |
| 1505 | { 'category':'C/C++', 'severity':severity.MEDIUM, 'members':[], 'option':'-Wenum-compare', |
| 1506 | 'description':'Comparison between different enums', |
Chih-Hung Hsieh | f8aaf60 | 2016-03-16 12:18:16 -0700 | [diff] [blame] | 1507 | 'patterns':[r".*: warning: comparison between '.+' and '.+'.+Wenum-compare"] }, |
Marco Nelissen | 594375d | 2009-07-14 09:04:04 -0700 | [diff] [blame] | 1508 | { 'category':'C/C++', 'severity':severity.MEDIUM, 'members':[], 'option':'-Wconversion', |
Chih-Hung Hsieh | 8d14543 | 2016-07-01 15:48:06 -0700 | [diff] [blame] | 1509 | 'description':'Conversion may change value', |
| 1510 | 'patterns':[r".*: warning: converting negative value '.+' to '.+'", |
| 1511 | r".*: warning: conversion to '.+' .+ may alter its value"] }, |
| 1512 | { 'category':'C/C++', 'severity':severity.MEDIUM, 'members':[], 'option':'-Wconversion-null', |
| 1513 | 'description':'Converting to non-pointer type from NULL', |
| 1514 | 'patterns':[r".*: warning: converting to non-pointer type '.+' from NULL"] }, |
| 1515 | { 'category':'C/C++', 'severity':severity.MEDIUM, 'members':[], 'option':'-Wnull-conversion', |
| 1516 | 'description':'Converting NULL to non-pointer type', |
| 1517 | 'patterns':[r".*: warning: implicit conversion of NULL constant to '.+'"] }, |
| 1518 | { 'category':'C/C++', 'severity':severity.MEDIUM, 'members':[], 'option':'-Wnon-literal-null-conversion', |
| 1519 | 'description':'Zero used as null pointer', |
| 1520 | 'patterns':[r".*: warning: expression .* zero treated as a null pointer constant"] }, |
Chih-Hung Hsieh | c21ddbd | 2016-07-20 10:08:51 -0700 | [diff] [blame] | 1521 | { 'category':'C/C++', 'severity':severity.MEDIUM, 'members':[], 'option':'', |
Chih-Hung Hsieh | 8d14543 | 2016-07-01 15:48:06 -0700 | [diff] [blame] | 1522 | 'description':'Implicit conversion changes value', |
Chih-Hung Hsieh | c21ddbd | 2016-07-20 10:08:51 -0700 | [diff] [blame] | 1523 | 'patterns':[r".*: warning: implicit conversion .* changes value from .* to .*-conversion"] }, |
Marco Nelissen | 594375d | 2009-07-14 09:04:04 -0700 | [diff] [blame] | 1524 | { 'category':'C/C++', 'severity':severity.MEDIUM, 'members':[], 'option':'', |
| 1525 | 'description':'Passing NULL as non-pointer argument', |
Marco Nelissen | 5236fbd | 2009-07-31 08:30:34 -0700 | [diff] [blame] | 1526 | 'patterns':[r".*: warning: passing NULL to non-pointer argument [0-9]+ of '.+'"] }, |
Marco Nelissen | 594375d | 2009-07-14 09:04:04 -0700 | [diff] [blame] | 1527 | { 'category':'C/C++', 'severity':severity.MEDIUM, 'members':[], 'option':'-Wctor-dtor-privacy', |
| 1528 | 'description':'Class seems unusable because of private ctor/dtor' , |
| 1529 | 'patterns':[r".*: warning: all member functions in class '.+' are private"] }, |
| 1530 | # skip this next one, because it only points out some RefBase-based classes where having a private destructor is perfectly fine |
| 1531 | { 'category':'C/C++', 'severity':severity.SKIP, 'members':[], 'option':'-Wctor-dtor-privacy', |
| 1532 | 'description':'Class seems unusable because of private ctor/dtor' , |
| 1533 | 'patterns':[r".*: warning: 'class .+' only defines a private destructor and has no friends"] }, |
| 1534 | { 'category':'C/C++', 'severity':severity.MEDIUM, 'members':[], 'option':'-Wctor-dtor-privacy', |
| 1535 | 'description':'Class seems unusable because of private ctor/dtor' , |
| 1536 | 'patterns':[r".*: warning: 'class .+' only defines private constructors and has no friends"] }, |
Chih-Hung Hsieh | ba0ddcd | 2016-03-21 11:28:30 -0700 | [diff] [blame] | 1537 | { 'category':'C/C++', 'severity':severity.MEDIUM, 'members':[], 'option':'-Wgnu-static-float-init', |
| 1538 | 'description':'In-class initializer for static const float/double' , |
| 1539 | 'patterns':[r".*: warning: in-class initializer for static data member of .+const (float|double)"] }, |
Marco Nelissen | 594375d | 2009-07-14 09:04:04 -0700 | [diff] [blame] | 1540 | { 'category':'C/C++', 'severity':severity.MEDIUM, 'members':[], 'option':'-Wpointer-arith', |
| 1541 | 'description':'void* used in arithmetic' , |
| 1542 | 'patterns':[r".*: warning: pointer of type 'void \*' used in (arithmetic|subtraction)", |
Chih-Hung Hsieh | f8aaf60 | 2016-03-16 12:18:16 -0700 | [diff] [blame] | 1543 | r".*: warning: arithmetic on .+ to void is a GNU extension.*Wpointer-arith", |
Marco Nelissen | 594375d | 2009-07-14 09:04:04 -0700 | [diff] [blame] | 1544 | r".*: warning: wrong type argument to increment"] }, |
| 1545 | { 'category':'C/C++', 'severity':severity.MEDIUM, 'members':[], 'option':'-Wsign-promo', |
| 1546 | 'description':'Overload resolution chose to promote from unsigned or enum to signed type' , |
| 1547 | 'patterns':[r".*: warning: passing '.+' chooses 'int' over '.* int'"] }, |
| 1548 | { 'category':'cont.', 'severity':severity.SKIP, 'members':[], 'option':'', |
| 1549 | 'description':'', |
| 1550 | 'patterns':[r".*: warning: in call to '.+'"] }, |
Marco Nelissen | 5236fbd | 2009-07-31 08:30:34 -0700 | [diff] [blame] | 1551 | { 'category':'C/C++', 'severity':severity.HIGH, 'members':[], 'option':'-Wextra', |
| 1552 | 'description':'Base should be explicitly initialized in copy constructor', |
| 1553 | 'patterns':[r".*: warning: base class '.+' should be explicitly initialized in the copy constructor"] }, |
| 1554 | { 'category':'C/C++', 'severity':severity.MEDIUM, 'members':[], 'option':'', |
| 1555 | 'description':'Converting from <type> to <other type>', |
| 1556 | 'patterns':[r".*: warning: converting to '.+' from '.+'"] }, |
Marco Nelissen | 8e20196 | 2010-03-10 16:16:02 -0800 | [diff] [blame] | 1557 | { 'category':'C/C++', 'severity':severity.MEDIUM, 'members':[], 'option':'', |
Chih-Hung Hsieh | f8aaf60 | 2016-03-16 12:18:16 -0700 | [diff] [blame] | 1558 | 'description':'VLA has zero or negative size', |
| 1559 | 'patterns':[r".*: warning: Declared variable-length array \(VLA\) has .+ size"] }, |
| 1560 | { 'category':'C/C++', 'severity':severity.MEDIUM, 'members':[], 'option':'', |
Marco Nelissen | 8e20196 | 2010-03-10 16:16:02 -0800 | [diff] [blame] | 1561 | 'description':'Return value from void function', |
| 1562 | 'patterns':[r".*: warning: 'return' with a value, in function returning void"] }, |
Chih-Hung Hsieh | f8aaf60 | 2016-03-16 12:18:16 -0700 | [diff] [blame] | 1563 | { 'category':'C/C++', 'severity':severity.MEDIUM, 'members':[], 'option':'multichar', |
| 1564 | 'description':'Multi-character character constant', |
| 1565 | 'patterns':[r".*: warning: multi-character character constant"] }, |
Chih-Hung Hsieh | ba0ddcd | 2016-03-21 11:28:30 -0700 | [diff] [blame] | 1566 | { 'category':'C/C++', 'severity':severity.MEDIUM, 'members':[], 'option':'writable-strings', |
| 1567 | 'description':'Conversion from string literal to char*', |
| 1568 | 'patterns':[r".*: warning: .+ does not allow conversion from string literal to 'char \*'"] }, |
Chih-Hung Hsieh | 8d14543 | 2016-07-01 15:48:06 -0700 | [diff] [blame] | 1569 | { 'category':'C/C++', 'severity':severity.LOW, 'members':[], 'option':'-Wextra-semi', |
| 1570 | 'description':'Extra \';\'', |
| 1571 | 'patterns':[r".*: warning: extra ';' .+extra-semi"] }, |
Marco Nelissen | 8e20196 | 2010-03-10 16:16:02 -0800 | [diff] [blame] | 1572 | { 'category':'C/C++', 'severity':severity.LOW, 'members':[], 'option':'', |
| 1573 | 'description':'Useless specifier', |
| 1574 | 'patterns':[r".*: warning: useless storage class specifier in empty declaration"] }, |
Chih-Hung Hsieh | 90d4619 | 2016-03-29 15:33:11 -0700 | [diff] [blame] | 1575 | { 'category':'C/C++', 'severity':severity.LOW, 'members':[], 'option':'-Wduplicate-decl-specifier', |
| 1576 | 'description':'Duplicate declaration specifier', |
| 1577 | 'patterns':[r".*: warning: duplicate '.+' declaration specifier"] }, |
Marco Nelissen | 8e20196 | 2010-03-10 16:16:02 -0800 | [diff] [blame] | 1578 | { 'category':'logtags', 'severity':severity.LOW, 'members':[], 'option':'', |
| 1579 | 'description':'Duplicate logtag', |
Chih-Hung Hsieh | 90d4619 | 2016-03-29 15:33:11 -0700 | [diff] [blame] | 1580 | 'patterns':[r".*: warning: tag \".+\" \(.+\) duplicated in .+"] }, |
Chih-Hung Hsieh | f8aaf60 | 2016-03-16 12:18:16 -0700 | [diff] [blame] | 1581 | { 'category':'logtags', 'severity':severity.LOW, 'members':[], 'option':'typedef-redefinition', |
| 1582 | 'description':'Typedef redefinition', |
| 1583 | 'patterns':[r".*: warning: redefinition of typedef '.+' is a C11 feature"] }, |
| 1584 | { 'category':'logtags', 'severity':severity.LOW, 'members':[], 'option':'gnu-designator', |
| 1585 | 'description':'GNU old-style field designator', |
| 1586 | 'patterns':[r".*: warning: use of GNU old-style field designator extension"] }, |
| 1587 | { 'category':'logtags', 'severity':severity.LOW, 'members':[], 'option':'missing-field-initializers', |
| 1588 | 'description':'Missing field initializers', |
| 1589 | 'patterns':[r".*: warning: missing field '.+' initializer"] }, |
| 1590 | { 'category':'logtags', 'severity':severity.LOW, 'members':[], 'option':'missing-braces', |
| 1591 | 'description':'Missing braces', |
| 1592 | 'patterns':[r".*: warning: suggest braces around initialization of", |
Chih-Hung Hsieh | ba0ddcd | 2016-03-21 11:28:30 -0700 | [diff] [blame] | 1593 | r".*: warning: too many braces around scalar initializer .+Wmany-braces-around-scalar-init", |
Chih-Hung Hsieh | f8aaf60 | 2016-03-16 12:18:16 -0700 | [diff] [blame] | 1594 | r".*: warning: braces around scalar initializer"] }, |
| 1595 | { 'category':'logtags', 'severity':severity.LOW, 'members':[], 'option':'sign-compare', |
| 1596 | 'description':'Comparison of integers of different signs', |
| 1597 | 'patterns':[r".*: warning: comparison of integers of different signs.+sign-compare"] }, |
| 1598 | { 'category':'logtags', 'severity':severity.LOW, 'members':[], 'option':'dangling-else', |
| 1599 | 'description':'Add braces to avoid dangling else', |
| 1600 | 'patterns':[r".*: warning: add explicit braces to avoid dangling else"] }, |
| 1601 | { 'category':'logtags', 'severity':severity.LOW, 'members':[], 'option':'initializer-overrides', |
| 1602 | 'description':'Initializer overrides prior initialization', |
| 1603 | 'patterns':[r".*: warning: initializer overrides prior initialization of this subobject"] }, |
| 1604 | { 'category':'logtags', 'severity':severity.LOW, 'members':[], 'option':'self-assign', |
| 1605 | 'description':'Assigning value to self', |
| 1606 | 'patterns':[r".*: warning: explicitly assigning value of .+ to itself"] }, |
| 1607 | { 'category':'logtags', 'severity':severity.LOW, 'members':[], 'option':'gnu-variable-sized-type-not-at-end', |
| 1608 | 'description':'GNU extension, variable sized type not at end', |
| 1609 | 'patterns':[r".*: warning: field '.+' with variable sized type '.+' not at the end of a struct or class"] }, |
| 1610 | { 'category':'logtags', 'severity':severity.LOW, 'members':[], 'option':'tautological-constant-out-of-range-compare', |
| 1611 | 'description':'Comparison of constant is always false/true', |
| 1612 | 'patterns':[r".*: comparison of .+ is always .+Wtautological-constant-out-of-range-compare"] }, |
| 1613 | { 'category':'logtags', 'severity':severity.LOW, 'members':[], 'option':'overloaded-virtual', |
| 1614 | 'description':'Hides overloaded virtual function', |
| 1615 | 'patterns':[r".*: '.+' hides overloaded virtual function"] }, |
| 1616 | { 'category':'logtags', 'severity':severity.LOW, 'members':[], 'option':'incompatible-pointer-types', |
| 1617 | 'description':'Incompatible pointer types', |
| 1618 | 'patterns':[r".*: warning: incompatible pointer types .+Wincompatible-pointer-types"] }, |
| 1619 | { 'category':'logtags', 'severity':severity.LOW, 'members':[], 'option':'asm-operand-widths', |
Chih-Hung Hsieh | ba0ddcd | 2016-03-21 11:28:30 -0700 | [diff] [blame] | 1620 | 'description':'ASM value size does not match register size', |
Chih-Hung Hsieh | f8aaf60 | 2016-03-16 12:18:16 -0700 | [diff] [blame] | 1621 | 'patterns':[r".*: warning: value size does not match register size specified by the constraint and modifier"] }, |
Chih-Hung Hsieh | 8d14543 | 2016-07-01 15:48:06 -0700 | [diff] [blame] | 1622 | { 'category':'C/C++', 'severity':severity.LOW, 'members':[], 'option':'tautological-compare', |
| 1623 | 'description':'Comparison of self is always false', |
| 1624 | 'patterns':[r".*: self-comparison always evaluates to false"] }, |
| 1625 | { 'category':'C/C++', 'severity':severity.LOW, 'members':[], 'option':'constant-logical-operand', |
| 1626 | 'description':'Logical op with constant operand', |
| 1627 | 'patterns':[r".*: use of logical '.+' with constant operand"] }, |
Chih-Hung Hsieh | ba0ddcd | 2016-03-21 11:28:30 -0700 | [diff] [blame] | 1628 | { 'category':'C/C++', 'severity':severity.LOW, 'members':[], 'option':'literal-suffix', |
Chih-Hung Hsieh | f8aaf60 | 2016-03-16 12:18:16 -0700 | [diff] [blame] | 1629 | 'description':'Needs a space between literal and string macro', |
| 1630 | 'patterns':[r".*: warning: invalid suffix on literal.+ requires a space .+Wliteral-suffix"] }, |
Chih-Hung Hsieh | ba0ddcd | 2016-03-21 11:28:30 -0700 | [diff] [blame] | 1631 | { 'category':'C/C++', 'severity':severity.LOW, 'members':[], 'option':'#warnings', |
Chih-Hung Hsieh | f8aaf60 | 2016-03-16 12:18:16 -0700 | [diff] [blame] | 1632 | 'description':'Warnings from #warning', |
| 1633 | 'patterns':[r".*: warning: .+-W#warnings"] }, |
Chih-Hung Hsieh | ba0ddcd | 2016-03-21 11:28:30 -0700 | [diff] [blame] | 1634 | { 'category':'C/C++', 'severity':severity.LOW, 'members':[], 'option':'absolute-value', |
| 1635 | 'description':'Using float/int absolute value function with int/float argument', |
Chih-Hung Hsieh | 8d14543 | 2016-07-01 15:48:06 -0700 | [diff] [blame] | 1636 | 'patterns':[r".*: warning: using .+ absolute value function .+ when argument is .+ type .+Wabsolute-value", |
| 1637 | r".*: warning: absolute value function '.+' given .+ which may cause truncation .+Wabsolute-value"] }, |
| 1638 | { 'category':'C/C++', 'severity':severity.LOW, 'members':[], 'option':'-Wc++11-extensions', |
| 1639 | 'description':'Using C++11 extensions', |
| 1640 | 'patterns':[r".*: warning: 'auto' type specifier is a C\+\+11 extension"] }, |
Chih-Hung Hsieh | ba0ddcd | 2016-03-21 11:28:30 -0700 | [diff] [blame] | 1641 | { 'category':'C/C++', 'severity':severity.LOW, 'members':[], 'option':'', |
| 1642 | 'description':'Refers to implicitly defined namespace', |
| 1643 | 'patterns':[r".*: warning: using directive refers to implicitly-defined namespace .+"] }, |
Chih-Hung Hsieh | 90d4619 | 2016-03-29 15:33:11 -0700 | [diff] [blame] | 1644 | { 'category':'C/C++', 'severity':severity.LOW, 'members':[], 'option':'-Winvalid-pp-token', |
| 1645 | 'description':'Invalid pp token', |
| 1646 | 'patterns':[r".*: warning: missing .+Winvalid-pp-token"] }, |
Chih-Hung Hsieh | f8aaf60 | 2016-03-16 12:18:16 -0700 | [diff] [blame] | 1647 | |
Marco Nelissen | 8e20196 | 2010-03-10 16:16:02 -0800 | [diff] [blame] | 1648 | { 'category':'C/C++', 'severity':severity.MEDIUM, 'members':[], 'option':'', |
| 1649 | 'description':'Operator new returns NULL', |
| 1650 | 'patterns':[r".*: warning: 'operator new' must not return NULL unless it is declared 'throw\(\)' .+"] }, |
Chih-Hung Hsieh | 8d14543 | 2016-07-01 15:48:06 -0700 | [diff] [blame] | 1651 | { 'category':'C/C++', 'severity':severity.MEDIUM, 'members':[], 'option':'-Wnull-arithmetic', |
Marco Nelissen | 8e20196 | 2010-03-10 16:16:02 -0800 | [diff] [blame] | 1652 | 'description':'NULL used in arithmetic', |
Chih-Hung Hsieh | 8d14543 | 2016-07-01 15:48:06 -0700 | [diff] [blame] | 1653 | 'patterns':[r".*: warning: NULL used in arithmetic", |
| 1654 | r".*: warning: comparison between NULL and non-pointer"] }, |
Chih-Hung Hsieh | ba0ddcd | 2016-03-21 11:28:30 -0700 | [diff] [blame] | 1655 | { 'category':'C/C++', 'severity':severity.MEDIUM, 'members':[], 'option':'header-guard', |
| 1656 | 'description':'Misspelled header guard', |
| 1657 | 'patterns':[r".*: warning: '.+' is used as a header guard .+ followed by .+ different macro"] }, |
| 1658 | { 'category':'C/C++', 'severity':severity.MEDIUM, 'members':[], 'option':'empty-body', |
| 1659 | 'description':'Empty loop body', |
| 1660 | 'patterns':[r".*: warning: .+ loop has empty body"] }, |
Chih-Hung Hsieh | f8aaf60 | 2016-03-16 12:18:16 -0700 | [diff] [blame] | 1661 | { 'category':'C/C++', 'severity':severity.MEDIUM, 'members':[], 'option':'enum-conversion', |
| 1662 | 'description':'Implicit conversion from enumeration type', |
| 1663 | 'patterns':[r".*: warning: implicit conversion from enumeration type '.+'"] }, |
| 1664 | { 'category':'C/C++', 'severity':severity.MEDIUM, 'members':[], 'option':'switch', |
| 1665 | 'description':'case value not in enumerated type', |
| 1666 | 'patterns':[r".*: warning: case value not in enumerated type '.+'"] }, |
| 1667 | { 'category':'C/C++', 'severity':severity.MEDIUM, 'members':[], 'option':'', |
| 1668 | 'description':'Undefined result', |
| 1669 | 'patterns':[r".*: warning: The result of .+ is undefined", |
Chih-Hung Hsieh | 4354a33 | 2016-07-22 14:09:31 -0700 | [diff] [blame] | 1670 | r".*: warning: passing an object that .+ has undefined behavior \[-Wvarargs\]", |
Chih-Hung Hsieh | f8aaf60 | 2016-03-16 12:18:16 -0700 | [diff] [blame] | 1671 | r".*: warning: 'this' pointer cannot be null in well-defined C\+\+ code;", |
| 1672 | r".*: warning: shifting a negative signed value is undefined"] }, |
| 1673 | { 'category':'C/C++', 'severity':severity.MEDIUM, 'members':[], 'option':'', |
| 1674 | 'description':'Division by zero', |
| 1675 | 'patterns':[r".*: warning: Division by zero"] }, |
Marco Nelissen | 8e20196 | 2010-03-10 16:16:02 -0800 | [diff] [blame] | 1676 | { 'category':'C/C++', 'severity':severity.MEDIUM, 'members':[], 'option':'', |
| 1677 | 'description':'Use of deprecated method', |
| 1678 | 'patterns':[r".*: warning: '.+' is deprecated .+"] }, |
Chih-Hung Hsieh | f8aaf60 | 2016-03-16 12:18:16 -0700 | [diff] [blame] | 1679 | { 'category':'C/C++', 'severity':severity.MEDIUM, 'members':[], 'option':'', |
| 1680 | 'description':'Use of garbage or uninitialized value', |
| 1681 | 'patterns':[r".*: warning: .+ is a garbage value", |
| 1682 | r".*: warning: Function call argument is an uninitialized value", |
| 1683 | r".*: warning: Undefined or garbage value returned to caller", |
Chih-Hung Hsieh | ba0ddcd | 2016-03-21 11:28:30 -0700 | [diff] [blame] | 1684 | r".*: warning: Called .+ pointer is.+uninitialized", |
| 1685 | r".*: warning: Called .+ pointer is.+uninitalized", # match a typo in compiler message |
| 1686 | r".*: warning: Use of zero-allocated memory", |
Chih-Hung Hsieh | f8aaf60 | 2016-03-16 12:18:16 -0700 | [diff] [blame] | 1687 | r".*: warning: Dereference of undefined pointer value", |
| 1688 | r".*: warning: Passed-by-value .+ contains uninitialized data", |
| 1689 | r".*: warning: Branch condition evaluates to a garbage value", |
| 1690 | r".*: warning: The .+ of .+ is an uninitialized value.", |
| 1691 | r".*: warning: .+ is used uninitialized whenever .+sometimes-uninitialized", |
| 1692 | r".*: warning: Assigned value is garbage or undefined"] }, |
| 1693 | { 'category':'C/C++', 'severity':severity.MEDIUM, 'members':[], 'option':'', |
| 1694 | 'description':'Result of malloc type incompatible with sizeof operand type', |
| 1695 | 'patterns':[r".*: warning: Result of '.+' is converted to .+ incompatible with sizeof operand type"] }, |
Chih-Hung Hsieh | 8d14543 | 2016-07-01 15:48:06 -0700 | [diff] [blame] | 1696 | { 'category':'C/C++', 'severity':severity.MEDIUM, 'members':[], 'option':'-Wsizeof-array-argument', |
| 1697 | 'description':'Sizeof on array argument', |
| 1698 | 'patterns':[r".*: warning: sizeof on array function parameter will return"] }, |
| 1699 | { 'category':'C/C++', 'severity':severity.MEDIUM, 'members':[], 'option':'-Wsizeof-pointer-memacces', |
| 1700 | 'description':'Bad argument size of memory access functions', |
| 1701 | 'patterns':[r".*: warning: .+\[-Wsizeof-pointer-memaccess\]"] }, |
Chih-Hung Hsieh | f8aaf60 | 2016-03-16 12:18:16 -0700 | [diff] [blame] | 1702 | { 'category':'C/C++', 'severity':severity.MEDIUM, 'members':[], 'option':'', |
| 1703 | 'description':'Return value not checked', |
| 1704 | 'patterns':[r".*: warning: The return value from .+ is not checked"] }, |
| 1705 | { 'category':'C/C++', 'severity':severity.MEDIUM, 'members':[], 'option':'', |
| 1706 | 'description':'Possible heap pollution', |
| 1707 | 'patterns':[r".*: warning: .*Possible heap pollution from .+ type .+"] }, |
| 1708 | { 'category':'C/C++', 'severity':severity.MEDIUM, 'members':[], 'option':'', |
| 1709 | 'description':'Allocation size of 0 byte', |
| 1710 | 'patterns':[r".*: warning: Call to .+ has an allocation size of 0 byte"] }, |
| 1711 | { 'category':'C/C++', 'severity':severity.MEDIUM, 'members':[], 'option':'', |
| 1712 | 'description':'Result of malloc type incompatible with sizeof operand type', |
| 1713 | 'patterns':[r".*: warning: Result of '.+' is converted to .+ incompatible with sizeof operand type"] }, |
| 1714 | |
| 1715 | { 'category':'C/C++', 'severity':severity.HARMLESS, 'members':[], 'option':'', |
| 1716 | 'description':'Discarded qualifier from pointer target type', |
| 1717 | 'patterns':[r".*: warning: .+ discards '.+' qualifier from pointer target type"] }, |
| 1718 | { 'category':'C/C++', 'severity':severity.HARMLESS, 'members':[], 'option':'', |
| 1719 | 'description':'Use snprintf instead of sprintf', |
| 1720 | 'patterns':[r".*: warning: .*sprintf is often misused; please use snprintf"] }, |
| 1721 | { 'category':'C/C++', 'severity':severity.HARMLESS, 'members':[], 'option':'', |
| 1722 | 'description':'Unsupported optimizaton flag', |
| 1723 | 'patterns':[r".*: warning: optimization flag '.+' is not supported"] }, |
| 1724 | { 'category':'C/C++', 'severity':severity.HARMLESS, 'members':[], 'option':'', |
| 1725 | 'description':'Extra or missing parentheses', |
| 1726 | 'patterns':[r".*: warning: equality comparison with extraneous parentheses", |
| 1727 | r".*: warning: .+ within .+Wlogical-op-parentheses"] }, |
| 1728 | { 'category':'C/C++', 'severity':severity.HARMLESS, 'members':[], 'option':'mismatched-tags', |
| 1729 | 'description':'Mismatched class vs struct tags', |
| 1730 | 'patterns':[r".*: warning: '.+' defined as a .+ here but previously declared as a .+mismatched-tags", |
| 1731 | r".*: warning: .+ was previously declared as a .+mismatched-tags"] }, |
Marco Nelissen | 594375d | 2009-07-14 09:04:04 -0700 | [diff] [blame] | 1732 | |
| 1733 | # these next ones are to deal with formatting problems resulting from the log being mixed up by 'make -j' |
| 1734 | { 'category':'C/C++', 'severity':severity.SKIP, 'members':[], 'option':'', |
| 1735 | 'description':'', |
| 1736 | 'patterns':[r".*: warning: ,$"] }, |
| 1737 | { 'category':'C/C++', 'severity':severity.SKIP, 'members':[], 'option':'', |
| 1738 | 'description':'', |
| 1739 | 'patterns':[r".*: warning: $"] }, |
| 1740 | { 'category':'C/C++', 'severity':severity.SKIP, 'members':[], 'option':'', |
| 1741 | 'description':'', |
| 1742 | 'patterns':[r".*: warning: In file included from .+,"] }, |
| 1743 | |
Chih-Hung Hsieh | 90d4619 | 2016-03-29 15:33:11 -0700 | [diff] [blame] | 1744 | # warnings from clang-tidy |
| 1745 | { 'category':'C/C++', 'severity':severity.TIDY, 'members':[], 'option':'', |
| 1746 | 'description':'clang-tidy readability', |
| 1747 | 'patterns':[r".*: .+\[readability-.+\]$"] }, |
| 1748 | { 'category':'C/C++', 'severity':severity.TIDY, 'members':[], 'option':'', |
| 1749 | 'description':'clang-tidy c++ core guidelines', |
| 1750 | 'patterns':[r".*: .+\[cppcoreguidelines-.+\]$"] }, |
| 1751 | { 'category':'C/C++', 'severity':severity.TIDY, 'members':[], 'option':'', |
Chih-Hung Hsieh | c21ddbd | 2016-07-20 10:08:51 -0700 | [diff] [blame] | 1752 | 'description':'clang-tidy google-default-arguments', |
| 1753 | 'patterns':[r".*: .+\[google-default-arguments\]$"] }, |
| 1754 | { 'category':'C/C++', 'severity':severity.TIDY, 'members':[], 'option':'', |
| 1755 | 'description':'clang-tidy google-runtime-int', |
| 1756 | 'patterns':[r".*: .+\[google-runtime-int\]$"] }, |
| 1757 | { 'category':'C/C++', 'severity':severity.TIDY, 'members':[], 'option':'', |
| 1758 | 'description':'clang-tidy google-runtime-operator', |
| 1759 | 'patterns':[r".*: .+\[google-runtime-operator\]$"] }, |
| 1760 | { 'category':'C/C++', 'severity':severity.TIDY, 'members':[], 'option':'', |
| 1761 | 'description':'clang-tidy google-runtime-references', |
| 1762 | 'patterns':[r".*: .+\[google-runtime-references\]$"] }, |
Chih-Hung Hsieh | 90d4619 | 2016-03-29 15:33:11 -0700 | [diff] [blame] | 1763 | { 'category':'C/C++', 'severity':severity.TIDY, 'members':[], 'option':'', |
| 1764 | 'description':'clang-tidy google-build', |
| 1765 | 'patterns':[r".*: .+\[google-build-.+\]$"] }, |
| 1766 | { 'category':'C/C++', 'severity':severity.TIDY, 'members':[], 'option':'', |
| 1767 | 'description':'clang-tidy google-explicit', |
| 1768 | 'patterns':[r".*: .+\[google-explicit-.+\]$"] }, |
| 1769 | { 'category':'C/C++', 'severity':severity.TIDY, 'members':[], 'option':'', |
Chih-Hung Hsieh | d742e90 | 2016-03-31 16:14:55 -0700 | [diff] [blame] | 1770 | 'description':'clang-tidy google-readability', |
| 1771 | 'patterns':[r".*: .+\[google-readability-.+\]$"] }, |
| 1772 | { 'category':'C/C++', 'severity':severity.TIDY, 'members':[], 'option':'', |
| 1773 | 'description':'clang-tidy google-global', |
| 1774 | 'patterns':[r".*: .+\[google-global-.+\]$"] }, |
| 1775 | { 'category':'C/C++', 'severity':severity.TIDY, 'members':[], 'option':'', |
Chih-Hung Hsieh | c21ddbd | 2016-07-20 10:08:51 -0700 | [diff] [blame] | 1776 | 'description':'clang-tidy google- other', |
| 1777 | 'patterns':[r".*: .+\[google-.+\]$"] }, |
| 1778 | { 'category':'C/C++', 'severity':severity.TIDY, 'members':[], 'option':'', |
Chih-Hung Hsieh | 90d4619 | 2016-03-29 15:33:11 -0700 | [diff] [blame] | 1779 | 'description':'clang-tidy modernize', |
| 1780 | 'patterns':[r".*: .+\[modernize-.+\]$"] }, |
| 1781 | { 'category':'C/C++', 'severity':severity.TIDY, 'members':[], 'option':'', |
| 1782 | 'description':'clang-tidy misc', |
| 1783 | 'patterns':[r".*: .+\[misc-.+\]$"] }, |
| 1784 | { 'category':'C/C++', 'severity':severity.TIDY, 'members':[], 'option':'', |
Chih-Hung Hsieh | c868293 | 2016-07-26 14:27:03 -0700 | [diff] [blame] | 1785 | 'description':'clang-tidy performance-faster-string-find', |
| 1786 | 'patterns':[r".*: .+\[performance-faster-string-find\]$"] }, |
| 1787 | { 'category':'C/C++', 'severity':severity.TIDY, 'members':[], 'option':'', |
| 1788 | 'description':'clang-tidy performance-for-range-copy', |
| 1789 | 'patterns':[r".*: .+\[performance-for-range-copy\]$"] }, |
| 1790 | { 'category':'C/C++', 'severity':severity.TIDY, 'members':[], 'option':'', |
| 1791 | 'description':'clang-tidy performance-implicit-cast-in-loop', |
| 1792 | 'patterns':[r".*: .+\[performance-implicit-cast-in-loop\]$"] }, |
| 1793 | { 'category':'C/C++', 'severity':severity.TIDY, 'members':[], 'option':'', |
| 1794 | 'description':'clang-tidy performance-unnecessary-copy-initialization', |
| 1795 | 'patterns':[r".*: .+\[performance-unnecessary-copy-initialization\]$"] }, |
| 1796 | { 'category':'C/C++', 'severity':severity.TIDY, 'members':[], 'option':'', |
| 1797 | 'description':'clang-tidy performance-unnecessary-value-param', |
| 1798 | 'patterns':[r".*: .+\[performance-unnecessary-value-param\]$"] }, |
| 1799 | { 'category':'C/C++', 'severity':severity.TIDY, 'members':[], 'option':'', |
Chih-Hung Hsieh | 90d4619 | 2016-03-29 15:33:11 -0700 | [diff] [blame] | 1800 | 'description':'clang-tidy CERT', |
| 1801 | 'patterns':[r".*: .+\[cert-.+\]$"] }, |
| 1802 | { 'category':'C/C++', 'severity':severity.TIDY, 'members':[], 'option':'', |
| 1803 | 'description':'clang-tidy llvm', |
| 1804 | 'patterns':[r".*: .+\[llvm-.+\]$"] }, |
| 1805 | { 'category':'C/C++', 'severity':severity.TIDY, 'members':[], 'option':'', |
| 1806 | 'description':'clang-tidy clang-diagnostic', |
| 1807 | 'patterns':[r".*: .+\[clang-diagnostic-.+\]$"] }, |
| 1808 | { 'category':'C/C++', 'severity':severity.TIDY, 'members':[], 'option':'', |
| 1809 | 'description':'clang-tidy clang-analyzer', |
| 1810 | 'patterns':[r".*: .+\[clang-analyzer-.+\]$", |
| 1811 | r".*: Call Path : .+$"] }, |
| 1812 | |
Marco Nelissen | 594375d | 2009-07-14 09:04:04 -0700 | [diff] [blame] | 1813 | # catch-all for warnings this script doesn't know about yet |
| 1814 | { 'category':'C/C++', 'severity':severity.UNKNOWN, 'members':[], 'option':'', |
| 1815 | 'description':'Unclassified/unrecognized warnings', |
| 1816 | 'patterns':[r".*: warning: .+"] }, |
| 1817 | ] |
| 1818 | |
Chih-Hung Hsieh | 48a16ba | 2016-07-21 14:22:53 -0700 | [diff] [blame] | 1819 | # A list of [project_name, file_path_pattern]. |
| 1820 | # project_name should not contain comma, to be used in CSV output. |
| 1821 | projectlist = [ |
Chih-Hung Hsieh | 4354a33 | 2016-07-22 14:09:31 -0700 | [diff] [blame] | 1822 | ['art', r"(^|.*/)art/.*: warning:"], |
| 1823 | ['bionic', r"(^|.*/)bionic/.*: warning:"], |
| 1824 | ['bootable', r"(^|.*/)bootable/.*: warning:"], |
| 1825 | ['build', r"(^|.*/)build/.*: warning:"], |
| 1826 | ['cts', r"(^|.*/)cts/.*: warning:"], |
| 1827 | ['dalvik', r"(^|.*/)dalvik/.*: warning:"], |
| 1828 | ['developers', r"(^|.*/)developers/.*: warning:"], |
| 1829 | ['development', r"(^|.*/)development/.*: warning:"], |
| 1830 | ['device', r"(^|.*/)device/.*: warning:"], |
| 1831 | ['doc', r"(^|.*/)doc/.*: warning:"], |
| 1832 | # match external/google* before external/ |
| 1833 | ['external/google', r"(^|.*/)external/google.*: warning:"], |
| 1834 | ['external/non-google', r"(^|.*/)external/.*: warning:"], |
| 1835 | ['frameworks', r"(^|.*/)frameworks/.*: warning:"], |
| 1836 | ['hardware', r"(^|.*/)hardware/.*: warning:"], |
| 1837 | ['kernel', r"(^|.*/)kernel/.*: warning:"], |
| 1838 | ['libcore', r"(^|.*/)libcore/.*: warning:"], |
| 1839 | ['libnativehelper', r"(^|.*/)libnativehelper/.*: warning:"], |
| 1840 | ['ndk', r"(^|.*/)ndk/.*: warning:"], |
| 1841 | ['packages', r"(^|.*/)packages/.*: warning:"], |
| 1842 | ['pdk', r"(^|.*/)pdk/.*: warning:"], |
| 1843 | ['prebuilts', r"(^|.*/)prebuilts/.*: warning:"], |
| 1844 | ['system', r"(^|.*/)system/.*: warning:"], |
| 1845 | ['toolchain', r"(^|.*/)toolchain/.*: warning:"], |
| 1846 | ['test', r"(^|.*/)test/.*: warning:"], |
| 1847 | ['tools', r"(^|.*/)tools/.*: warning:"], |
| 1848 | # match vendor/google* before vendor/ |
| 1849 | ['vendor/google', r"(^|.*/)vendor/google.*: warning:"], |
| 1850 | ['vendor/non-google', r"(^|.*/)vendor/.*: warning:"], |
| 1851 | # keep out/obj and other patterns at the end. |
| 1852 | ['out/obj', r".*/(gen|obj[^/]*)/(include|EXECUTABLES|SHARED_LIBRARIES|STATIC_LIBRARIES)/.*: warning:"], |
| 1853 | ['other', r".*: warning:"], |
Chih-Hung Hsieh | 48a16ba | 2016-07-21 14:22:53 -0700 | [diff] [blame] | 1854 | ] |
| 1855 | |
| 1856 | projectpatterns = [] |
| 1857 | for p in projectlist: |
| 1858 | projectpatterns.append({'description':p[0], 'members':[], 'pattern':re.compile(p[1])}) |
| 1859 | |
Chih-Hung Hsieh | 4354a33 | 2016-07-22 14:09:31 -0700 | [diff] [blame] | 1860 | # Each warning pattern has 3 dictionaries: |
| 1861 | # (1) 'projects' maps a project name to number of warnings in that project. |
| 1862 | # (2) 'projectanchor' maps a project name to its anchor number for HTML. |
| 1863 | # (3) 'projectwarning' maps a project name to a list of warning of that project. |
Chih-Hung Hsieh | 48a16ba | 2016-07-21 14:22:53 -0700 | [diff] [blame] | 1864 | for w in warnpatterns: |
| 1865 | w['projects'] = {} |
Chih-Hung Hsieh | 4354a33 | 2016-07-22 14:09:31 -0700 | [diff] [blame] | 1866 | w['projectanchor'] = {} |
| 1867 | w['projectwarning'] = {} |
Chih-Hung Hsieh | 48a16ba | 2016-07-21 14:22:53 -0700 | [diff] [blame] | 1868 | |
| 1869 | platformversion = 'unknown' |
| 1870 | targetproduct = 'unknown' |
| 1871 | targetvariant = 'unknown' |
| 1872 | |
| 1873 | |
| 1874 | ##### Data and functions to dump html file. ################################## |
| 1875 | |
Marco Nelissen | 594375d | 2009-07-14 09:04:04 -0700 | [diff] [blame] | 1876 | anchor = 0 |
Chih-Hung Hsieh | 465b610 | 2016-06-22 19:15:12 -0700 | [diff] [blame] | 1877 | cur_row_class = 0 |
| 1878 | |
| 1879 | html_script_style = """\ |
| 1880 | <script type="text/javascript"> |
| 1881 | function expand(id) { |
| 1882 | var e = document.getElementById(id); |
| 1883 | var f = document.getElementById(id + "_mark"); |
| 1884 | if (e.style.display == 'block') { |
| 1885 | e.style.display = 'none'; |
| 1886 | f.innerHTML = '⊕'; |
| 1887 | } |
| 1888 | else { |
| 1889 | e.style.display = 'block'; |
| 1890 | f.innerHTML = '⊖'; |
| 1891 | } |
| 1892 | }; |
| 1893 | function expand_collapse(show) { |
| 1894 | for (var id = 1; ; id++) { |
| 1895 | var e = document.getElementById(id + ""); |
| 1896 | var f = document.getElementById(id + "_mark"); |
| 1897 | if (!e || !f) break; |
| 1898 | e.style.display = (show ? 'block' : 'none'); |
| 1899 | f.innerHTML = (show ? '⊖' : '⊕'); |
| 1900 | } |
| 1901 | }; |
| 1902 | </script> |
| 1903 | <style type="text/css"> |
| 1904 | table,th,td{border-collapse:collapse; width:100%;} |
| 1905 | .button{color:blue;font-size:110%;font-weight:bolder;} |
| 1906 | .bt{color:black;background-color:transparent;border:none;outline:none; |
| 1907 | font-size:140%;font-weight:bolder;} |
| 1908 | .c0{background-color:#e0e0e0;} |
| 1909 | .c1{background-color:#d0d0d0;} |
| 1910 | </style>\n""" |
| 1911 | |
Marco Nelissen | 594375d | 2009-07-14 09:04:04 -0700 | [diff] [blame] | 1912 | |
| 1913 | def output(text): |
| 1914 | print text, |
| 1915 | |
| 1916 | def htmlbig(param): |
| 1917 | return '<font size="+2">' + param + '</font>' |
| 1918 | |
| 1919 | def dumphtmlprologue(title): |
Chih-Hung Hsieh | 465b610 | 2016-06-22 19:15:12 -0700 | [diff] [blame] | 1920 | output('<html>\n<head>\n') |
| 1921 | output('<title>' + title + '</title>\n') |
| 1922 | output(html_script_style) |
| 1923 | output('</head>\n<body>\n') |
Marco Nelissen | 594375d | 2009-07-14 09:04:04 -0700 | [diff] [blame] | 1924 | output(htmlbig(title)) |
| 1925 | output('<p>\n') |
| 1926 | |
Chih-Hung Hsieh | 465b610 | 2016-06-22 19:15:12 -0700 | [diff] [blame] | 1927 | def dumphtmlepilogue(): |
| 1928 | output('</body>\n</head>\n</html>\n') |
| 1929 | |
Marco Nelissen | 594375d | 2009-07-14 09:04:04 -0700 | [diff] [blame] | 1930 | def tablerow(text): |
Chih-Hung Hsieh | 465b610 | 2016-06-22 19:15:12 -0700 | [diff] [blame] | 1931 | global cur_row_class |
| 1932 | output('<tr><td class="c' + str(cur_row_class) + '">') |
| 1933 | cur_row_class = 1 - cur_row_class |
| 1934 | output(text) |
| 1935 | output('</td></tr>') |
Marco Nelissen | 594375d | 2009-07-14 09:04:04 -0700 | [diff] [blame] | 1936 | |
Chih-Hung Hsieh | 48a16ba | 2016-07-21 14:22:53 -0700 | [diff] [blame] | 1937 | def sortwarnings(): |
| 1938 | for i in warnpatterns: |
| 1939 | i['members'] = sorted(set(i['members'])) |
| 1940 | |
Marco Nelissen | 594375d | 2009-07-14 09:04:04 -0700 | [diff] [blame] | 1941 | # dump some stats about total number of warnings and such |
| 1942 | def dumpstats(): |
| 1943 | known = 0 |
| 1944 | unknown = 0 |
Chih-Hung Hsieh | 48a16ba | 2016-07-21 14:22:53 -0700 | [diff] [blame] | 1945 | sortwarnings() |
Marco Nelissen | 594375d | 2009-07-14 09:04:04 -0700 | [diff] [blame] | 1946 | for i in warnpatterns: |
| 1947 | if i['severity'] == severity.UNKNOWN: |
| 1948 | unknown += len(i['members']) |
| 1949 | elif i['severity'] != severity.SKIP: |
| 1950 | known += len(i['members']) |
Chih-Hung Hsieh | a9be47e | 2016-03-21 14:11:03 -0700 | [diff] [blame] | 1951 | output('\nNumber of classified warnings: <b>' + str(known) + '</b><br>' ) |
| 1952 | output('\nNumber of unclassified warnings: <b>' + str(unknown) + '</b><br>') |
Marco Nelissen | 594375d | 2009-07-14 09:04:04 -0700 | [diff] [blame] | 1953 | total = unknown + known |
Chih-Hung Hsieh | a9be47e | 2016-03-21 14:11:03 -0700 | [diff] [blame] | 1954 | output('\nTotal number of warnings: <b>' + str(total) + '</b>') |
Marco Nelissen | 594375d | 2009-07-14 09:04:04 -0700 | [diff] [blame] | 1955 | if total < 1000: |
| 1956 | output('(low count may indicate incremental build)') |
Chih-Hung Hsieh | 465b610 | 2016-06-22 19:15:12 -0700 | [diff] [blame] | 1957 | output('<br><br>\n') |
| 1958 | output('<button class="button" onclick="expand_collapse(1);">' + |
| 1959 | 'Expand all warnings</button> ' + |
| 1960 | '<button class="button" onclick="expand_collapse(0);">' + |
| 1961 | 'Collapse all warnings</button>') |
| 1962 | output('<br>\n') |
Chih-Hung Hsieh | a9be47e | 2016-03-21 14:11:03 -0700 | [diff] [blame] | 1963 | |
Chih-Hung Hsieh | 465b610 | 2016-06-22 19:15:12 -0700 | [diff] [blame] | 1964 | # dump everything for a given severity |
| 1965 | def dumpseverity(sev): |
| 1966 | global anchor |
| 1967 | output('\n<br><span style="background-color:' + colorforseverity(sev) + '"><b>' + |
| 1968 | headerforseverity(sev) + ':</b></span>\n') |
Chih-Hung Hsieh | 90d4619 | 2016-03-29 15:33:11 -0700 | [diff] [blame] | 1969 | output('<blockquote>\n') |
Chih-Hung Hsieh | a9be47e | 2016-03-21 14:11:03 -0700 | [diff] [blame] | 1970 | for i in warnpatterns: |
Chih-Hung Hsieh | 465b610 | 2016-06-22 19:15:12 -0700 | [diff] [blame] | 1971 | if i['severity'] == sev and len(i['members']) > 0: |
Chih-Hung Hsieh | 465b610 | 2016-06-22 19:15:12 -0700 | [diff] [blame] | 1972 | anchor += 1 |
| 1973 | i['anchor'] = str(anchor) |
Chih-Hung Hsieh | 4354a33 | 2016-07-22 14:09:31 -0700 | [diff] [blame] | 1974 | if args.byproject: |
| 1975 | dumpcategorybyproject(sev, i) |
| 1976 | else: |
| 1977 | dumpcategory(sev, i) |
Chih-Hung Hsieh | 465b610 | 2016-06-22 19:15:12 -0700 | [diff] [blame] | 1978 | output('</blockquote>\n') |
Marco Nelissen | 594375d | 2009-07-14 09:04:04 -0700 | [diff] [blame] | 1979 | |
| 1980 | def allpatterns(cat): |
| 1981 | pats = '' |
| 1982 | for i in cat['patterns']: |
| 1983 | pats += i |
| 1984 | pats += ' / ' |
| 1985 | return pats |
| 1986 | |
| 1987 | def descriptionfor(cat): |
| 1988 | if cat['description'] != '': |
| 1989 | return cat['description'] |
| 1990 | return allpatterns(cat) |
| 1991 | |
| 1992 | |
| 1993 | # show which warnings no longer occur |
| 1994 | def dumpfixed(): |
Chih-Hung Hsieh | 465b610 | 2016-06-22 19:15:12 -0700 | [diff] [blame] | 1995 | global anchor |
| 1996 | anchor += 1 |
| 1997 | mark = str(anchor) + '_mark' |
| 1998 | output('\n<br><p style="background-color:lightblue"><b>' + |
| 1999 | '<button id="' + mark + '" ' + |
| 2000 | 'class="bt" onclick="expand(' + str(anchor) + ');">' + |
| 2001 | '⊕</button> Fixed warnings. ' + |
| 2002 | 'No more occurences. Please consider turning these into ' + |
| 2003 | 'errors if possible, before they are reintroduced in to the build' + |
| 2004 | ':</b></p>\n') |
| 2005 | output('<blockquote>\n') |
| 2006 | fixed_patterns = [] |
Marco Nelissen | 594375d | 2009-07-14 09:04:04 -0700 | [diff] [blame] | 2007 | for i in warnpatterns: |
| 2008 | if len(i['members']) == 0 and i['severity'] != severity.SKIP: |
Chih-Hung Hsieh | 465b610 | 2016-06-22 19:15:12 -0700 | [diff] [blame] | 2009 | fixed_patterns.append(i['description'] + ' (' + |
| 2010 | allpatterns(i) + ') ' + i['option']) |
| 2011 | fixed_patterns.sort() |
| 2012 | output('<div id="' + str(anchor) + '" style="display:none;"><table>\n') |
| 2013 | for i in fixed_patterns: |
| 2014 | tablerow(i) |
| 2015 | output('</table></div>\n') |
| 2016 | output('</blockquote>\n') |
Marco Nelissen | 594375d | 2009-07-14 09:04:04 -0700 | [diff] [blame] | 2017 | |
Ian Rogers | f382973 | 2016-05-10 12:06:01 -0700 | [diff] [blame] | 2018 | def warningwithurl(line): |
| 2019 | if not args.url: |
| 2020 | return line |
| 2021 | m = re.search( r'^([^ :]+):(\d+):(.+)', line, re.M|re.I) |
| 2022 | if not m: |
| 2023 | return line |
| 2024 | filepath = m.group(1) |
| 2025 | linenumber = m.group(2) |
| 2026 | warning = m.group(3) |
| 2027 | if args.separator: |
| 2028 | return '<a href="' + args.url + '/' + filepath + args.separator + linenumber + '">' + filepath + ':' + linenumber + '</a>:' + warning |
| 2029 | else: |
| 2030 | return '<a href="' + args.url + '/' + filepath + '">' + filepath + '</a>:' + linenumber + ':' + warning |
Marco Nelissen | 594375d | 2009-07-14 09:04:04 -0700 | [diff] [blame] | 2031 | |
Chih-Hung Hsieh | 4354a33 | 2016-07-22 14:09:31 -0700 | [diff] [blame] | 2032 | def dumpgroup(sev, anchor, description, warnings): |
| 2033 | mark = anchor + '_mark' |
| 2034 | output('\n<table frame="box">\n') |
| 2035 | output('<tr bgcolor="' + colorforseverity(sev) + '">' + |
| 2036 | '<td><button class="bt" id="' + mark + |
| 2037 | '" onclick="expand(\'' + anchor + '\');">' + |
| 2038 | '⊕</button> ' + description + '</td></tr>\n') |
| 2039 | output('</table>\n') |
| 2040 | output('<div id="' + anchor + '" style="display:none;">') |
| 2041 | output('<table>\n') |
| 2042 | for i in warnings: |
| 2043 | tablerow(warningwithurl(i)) |
| 2044 | output('</table></div>\n') |
Chih-Hung Hsieh | 465b610 | 2016-06-22 19:15:12 -0700 | [diff] [blame] | 2045 | |
Chih-Hung Hsieh | 4354a33 | 2016-07-22 14:09:31 -0700 | [diff] [blame] | 2046 | # dump warnings in a category |
| 2047 | def dumpcategory(sev, cat): |
| 2048 | description = descriptionfor(cat) + ' (' + str(len(cat['members'])) + ')' |
| 2049 | dumpgroup(sev, cat['anchor'], description, cat['members']) |
Marco Nelissen | 594375d | 2009-07-14 09:04:04 -0700 | [diff] [blame] | 2050 | |
Chih-Hung Hsieh | 4354a33 | 2016-07-22 14:09:31 -0700 | [diff] [blame] | 2051 | # similar to dumpcategory but output one table per project. |
| 2052 | def dumpcategorybyproject(sev, cat): |
| 2053 | warning = descriptionfor(cat) |
| 2054 | projects = cat['projectwarning'].keys() |
| 2055 | projects.sort() |
| 2056 | for p in projects: |
| 2057 | anchor = cat['projectanchor'][p] |
| 2058 | projectwarnings = cat['projectwarning'][p] |
| 2059 | description = '{}, in {} ({})'.format(warning, p, len(projectwarnings)) |
| 2060 | dumpgroup(sev, anchor, description, projectwarnings) |
Marco Nelissen | 594375d | 2009-07-14 09:04:04 -0700 | [diff] [blame] | 2061 | |
Chih-Hung Hsieh | 48a16ba | 2016-07-21 14:22:53 -0700 | [diff] [blame] | 2062 | def findproject(line): |
| 2063 | for p in projectpatterns: |
| 2064 | if p['pattern'].match(line): |
| 2065 | return p['description'] |
| 2066 | return '???' |
| 2067 | |
Marco Nelissen | 594375d | 2009-07-14 09:04:04 -0700 | [diff] [blame] | 2068 | def classifywarning(line): |
Chih-Hung Hsieh | 4354a33 | 2016-07-22 14:09:31 -0700 | [diff] [blame] | 2069 | global anchor |
Marco Nelissen | 594375d | 2009-07-14 09:04:04 -0700 | [diff] [blame] | 2070 | for i in warnpatterns: |
Marco Nelissen | 2bdc7ec | 2009-09-29 10:19:29 -0700 | [diff] [blame] | 2071 | for cpat in i['compiledpatterns']: |
| 2072 | if cpat.match(line): |
Marco Nelissen | 594375d | 2009-07-14 09:04:04 -0700 | [diff] [blame] | 2073 | i['members'].append(line) |
Chih-Hung Hsieh | 48a16ba | 2016-07-21 14:22:53 -0700 | [diff] [blame] | 2074 | pname = findproject(line) |
Chih-Hung Hsieh | 4354a33 | 2016-07-22 14:09:31 -0700 | [diff] [blame] | 2075 | # Count warnings by project. |
Chih-Hung Hsieh | 48a16ba | 2016-07-21 14:22:53 -0700 | [diff] [blame] | 2076 | if pname in i['projects']: |
Chih-Hung Hsieh | 4354a33 | 2016-07-22 14:09:31 -0700 | [diff] [blame] | 2077 | i['projects'][pname] += 1 |
Chih-Hung Hsieh | 48a16ba | 2016-07-21 14:22:53 -0700 | [diff] [blame] | 2078 | else: |
Chih-Hung Hsieh | 4354a33 | 2016-07-22 14:09:31 -0700 | [diff] [blame] | 2079 | i['projects'][pname] = 1 |
| 2080 | # Collect warnings by project. |
| 2081 | if args.byproject: |
| 2082 | if pname in i['projectwarning']: |
| 2083 | i['projectwarning'][pname].append(line) |
| 2084 | else: |
| 2085 | i['projectwarning'][pname] = [line] |
| 2086 | if pname not in i['projectanchor']: |
| 2087 | anchor += 1 |
| 2088 | i['projectanchor'][pname] = str(anchor) |
Marco Nelissen | 594375d | 2009-07-14 09:04:04 -0700 | [diff] [blame] | 2089 | return |
Chih-Hung Hsieh | 48a16ba | 2016-07-21 14:22:53 -0700 | [diff] [blame] | 2090 | else: |
| 2091 | # If we end up here, there was a problem parsing the log |
| 2092 | # probably caused by 'make -j' mixing the output from |
| 2093 | # 2 or more concurrent compiles |
| 2094 | pass |
Marco Nelissen | 594375d | 2009-07-14 09:04:04 -0700 | [diff] [blame] | 2095 | |
Marco Nelissen | 2bdc7ec | 2009-09-29 10:19:29 -0700 | [diff] [blame] | 2096 | # precompiling every pattern speeds up parsing by about 30x |
| 2097 | def compilepatterns(): |
| 2098 | for i in warnpatterns: |
| 2099 | i['compiledpatterns'] = [] |
| 2100 | for pat in i['patterns']: |
| 2101 | i['compiledpatterns'].append(re.compile(pat)) |
Marco Nelissen | 594375d | 2009-07-14 09:04:04 -0700 | [diff] [blame] | 2102 | |
Chih-Hung Hsieh | 48a16ba | 2016-07-21 14:22:53 -0700 | [diff] [blame] | 2103 | def parseinputfile(): |
| 2104 | global platformversion |
| 2105 | global targetproduct |
| 2106 | global targetvariant |
| 2107 | infile = open(args.buildlog, 'r') |
| 2108 | linecounter = 0 |
Marco Nelissen | 594375d | 2009-07-14 09:04:04 -0700 | [diff] [blame] | 2109 | |
Chih-Hung Hsieh | 48a16ba | 2016-07-21 14:22:53 -0700 | [diff] [blame] | 2110 | warningpattern = re.compile('.* warning:.*') |
| 2111 | compilepatterns() |
Marco Nelissen | 594375d | 2009-07-14 09:04:04 -0700 | [diff] [blame] | 2112 | |
Chih-Hung Hsieh | 48a16ba | 2016-07-21 14:22:53 -0700 | [diff] [blame] | 2113 | # read the log file and classify all the warnings |
| 2114 | warninglines = set() |
| 2115 | for line in infile: |
| 2116 | # replace fancy quotes with plain ol' quotes |
| 2117 | line = line.replace("‘", "'"); |
| 2118 | line = line.replace("’", "'"); |
| 2119 | if warningpattern.match(line): |
| 2120 | if line not in warninglines: |
| 2121 | classifywarning(line) |
| 2122 | warninglines.add(line) |
| 2123 | else: |
| 2124 | # save a little bit of time by only doing this for the first few lines |
| 2125 | if linecounter < 50: |
| 2126 | linecounter +=1 |
| 2127 | m = re.search('(?<=^PLATFORM_VERSION=).*', line) |
| 2128 | if m != None: |
| 2129 | platformversion = m.group(0) |
| 2130 | m = re.search('(?<=^TARGET_PRODUCT=).*', line) |
| 2131 | if m != None: |
| 2132 | targetproduct = m.group(0) |
| 2133 | m = re.search('(?<=^TARGET_BUILD_VARIANT=).*', line) |
| 2134 | if m != None: |
| 2135 | targetvariant = m.group(0) |
Marco Nelissen | 594375d | 2009-07-14 09:04:04 -0700 | [diff] [blame] | 2136 | |
| 2137 | |
| 2138 | # dump the html output to stdout |
Chih-Hung Hsieh | 48a16ba | 2016-07-21 14:22:53 -0700 | [diff] [blame] | 2139 | def dumphtml(): |
| 2140 | dumphtmlprologue('Warnings for ' + platformversion + ' - ' + targetproduct + ' - ' + targetvariant) |
| 2141 | dumpstats() |
| 2142 | # sort table based on number of members once dumpstats has deduplicated the |
| 2143 | # members. |
| 2144 | warnpatterns.sort(reverse=True, key=lambda i: len(i['members'])) |
| 2145 | dumpseverity(severity.FIXMENOW) |
| 2146 | dumpseverity(severity.HIGH) |
| 2147 | dumpseverity(severity.MEDIUM) |
| 2148 | dumpseverity(severity.LOW) |
| 2149 | dumpseverity(severity.TIDY) |
| 2150 | dumpseverity(severity.HARMLESS) |
| 2151 | dumpseverity(severity.UNKNOWN) |
| 2152 | dumpfixed() |
| 2153 | dumphtmlepilogue() |
| 2154 | |
| 2155 | |
| 2156 | ##### Functions to count warnings and dump csv file. ######################### |
| 2157 | |
| 2158 | def descriptionforcsv(cat): |
| 2159 | if cat['description'] == '': |
| 2160 | return '?' |
| 2161 | return cat['description'] |
| 2162 | |
| 2163 | def stringforcsv(s): |
| 2164 | if ',' in s: |
| 2165 | return '"{}"'.format(s) |
| 2166 | return s |
| 2167 | |
| 2168 | def countseverity(sev, kind): |
| 2169 | sum = 0 |
| 2170 | for i in warnpatterns: |
| 2171 | if i['severity'] == sev and len(i['members']) > 0: |
| 2172 | n = len(i['members']) |
| 2173 | sum += n |
| 2174 | warning = stringforcsv(kind + ': ' + descriptionforcsv(i)) |
| 2175 | print '{},,{}'.format(n, warning) |
| 2176 | # print number of warnings for each project, ordered by project name. |
| 2177 | projects = i['projects'].keys() |
| 2178 | projects.sort() |
| 2179 | for p in projects: |
| 2180 | print '{},{},{}'.format(i['projects'][p], p, warning) |
| 2181 | print '{},,{}'.format(sum, kind + ' warnings') |
| 2182 | return sum |
| 2183 | |
| 2184 | # dump number of warnings in csv format to stdout |
| 2185 | def dumpcsv(): |
| 2186 | sortwarnings() |
| 2187 | total = 0 |
| 2188 | total += countseverity(severity.FIXMENOW, 'FixNow') |
| 2189 | total += countseverity(severity.HIGH, 'High') |
| 2190 | total += countseverity(severity.MEDIUM, 'Medium') |
| 2191 | total += countseverity(severity.LOW, 'Low') |
| 2192 | total += countseverity(severity.TIDY, 'Tidy') |
| 2193 | total += countseverity(severity.HARMLESS, 'Harmless') |
| 2194 | total += countseverity(severity.UNKNOWN, 'Unknown') |
| 2195 | print '{},,{}'.format(total, 'All warnings') |
| 2196 | |
| 2197 | |
| 2198 | parseinputfile() |
| 2199 | if args.gencsv: |
| 2200 | dumpcsv() |
| 2201 | else: |
| 2202 | dumphtml() |