|
1 | 1 | bool isIgnored(String message,
|
2 | 2 | {bool? defaultIgnores, Iterable<String>? ignores}) {
|
3 |
| - final base = defaultIgnores == false ? [] : wildcards; |
4 |
| - return [...base, ...?ignores?.map(ignore)].any((mathcer) => mathcer(message)); |
| 3 | + return [if (defaultIgnores != false) ..._wildcards, ...?ignores] |
| 4 | + .any((pattern) => RegExp(pattern).hasMatch(message)); |
5 | 5 | }
|
6 | 6 |
|
7 |
| -final wildcards = [ |
8 |
| - ignore( |
9 |
| - r'((Merge pull request)|(Merge (.*?) into (.*?)|(Merge branch (.*?)))(?:\r?\n)*$)'), |
10 |
| - ignore(r'(Merge tag (.*?))(?:\r?\n)*$'), |
11 |
| - ignore(r'(R|r)evert (.*)'), |
12 |
| - ignore(r'(fixup|squash)!'), |
13 |
| - ignore(r'(Merged (.*?)(in|into) (.*)|Merged PR (.*): (.*))'), |
14 |
| - ignore(r'Merge remote-tracking branch(\s*)(.*)'), |
15 |
| - ignore(r'Automatic merge(.*)'), |
16 |
| - ignore(r'Auto-merged (.*?) into (.*)'), |
| 7 | +final _wildcards = [ |
| 8 | + r'((Merge pull request)|(Merge (.*?) into (.*?)|(Merge branch (.*?)))(?:\r?\n)*)', |
| 9 | + r'(Merge tag (.*?))(?:\r?\n)*$', |
| 10 | + r'(R|r)evert (.*)', |
| 11 | + r'(fixup|squash)!', |
| 12 | + r'(Merged (.*?)(in|into) (.*)|Merged PR (.*): (.*))', |
| 13 | + r'Merge remote-tracking branch(\s*)(.*)', |
| 14 | + r'Automatic merge(.*)', |
| 15 | + r'Auto-merged (.*?) into (.*)', |
17 | 16 | ];
|
18 |
| - |
19 |
| -Matcher ignore(String pattern) => |
20 |
| - (String message) => RegExp(pattern).hasMatch(message); |
21 |
| - |
22 |
| -typedef Matcher = bool Function(String); |
0 commit comments