|
9 | 9 | # -d debug |
10 | 10 | # -i REGEX include matches for the grep basic regex |
11 | 11 | # -x REGEX exclude matches for the grep basic regex |
| 12 | +# -y REGEX exclude matches for the grep basic regex |
12 | 13 | # The -i argument (if any) is processed before the -x argument (if any). |
13 | 14 |
|
14 | 15 | # The "reason" for a warning suppression is the Java line comment after it: |
|
24 | 25 | # "interning:type.incompatible" // reason for interning suppression |
25 | 26 | # }) |
26 | 27 |
|
| 28 | +# Inclusions (-i) are processed before exclusions (-x, -y). |
| 29 | + |
27 | 30 | # Some reasons are ignored, notably "true positive" and |
28 | 31 | # "count-suppression-reasons-ignore"; see below for the full list. |
29 | 32 |
|
|
33 | 36 | # to count the total number of warning suppressions (for example, to report |
34 | 37 | # in a paper), because this script gives only an approximate count. |
35 | 38 |
|
| 39 | +# The -y command-line argument is exactly like -x, but avoids the need |
| 40 | +# for the user to write a complex regex. |
| 41 | + |
36 | 42 | # To debug, pass the -d command-line argument. |
37 | 43 | debug=0 |
38 | 44 |
|
39 | | -while getopts dx:i: flag |
| 45 | +while getopts di:x:y: flag |
40 | 46 | do |
41 | 47 | case "${flag}" in |
42 | 48 | d) debug=1;; |
43 | | - x) exclude=${OPTARG};; |
44 | 49 | i) include=${OPTARG};; |
| 50 | + x) exclude=${OPTARG};; |
| 51 | + y) excludey=${OPTARG};; |
45 | 52 | \?) echo "Invalid option -$OPTARG"; exit 1;; |
46 | 53 | esac |
47 | 54 | done |
@@ -100,6 +107,10 @@ if [ -n "$exclude" ] ; then |
100 | 107 | mv "${greplines}" "${greplines}-x" |
101 | 108 | grep -v -- "$exclude" "${greplines}-x" > "${greplines}" |
102 | 109 | fi |
| 110 | +if [ -n "$excludey" ] ; then |
| 111 | + mv "${greplines}" "${greplines}-y" |
| 112 | + grep -v -- "$excludey" "${greplines}-y" > "${greplines}" |
| 113 | +fi |
103 | 114 |
|
104 | 115 |
|
105 | 116 | total=$(wc -l < "${greplines}") |
|
0 commit comments