Skip to content

Commit 847ecd1

Browse files
committed
Java/Kotlin: Small refactoring of ExtractorInformation
1 parent b20f8fc commit 847ecd1

File tree

1 file changed

+4
-9
lines changed

1 file changed

+4
-9
lines changed

java/ql/src/Telemetry/ExtractorInformation.ql

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -62,21 +62,16 @@ predicate extractorDiagnostics(string key, int value) {
6262
*/
6363

6464
predicate extractorTotalDiagnostics(string key, int value) {
65-
exists(string extractor |
65+
exists(string extractor, string limitRegex |
66+
limitRegex = "Total of ([0-9]+) diagnostics \\(reached limit of ([0-9]+)\\).*" and
6667
key = "Total number of diagnostics from " + extractor and
6768
value =
6869
strictcount(Diagnostic d | d.getGeneratedBy() = extractor) +
6970
sum(Diagnostic d |
7071
d.getGeneratedBy() = extractor
7172
|
72-
d.getMessage()
73-
.regexpCapture("Total of ([0-9]+) diagnostics \\(reached limit of ([0-9]+)\\).*",
74-
1)
75-
.toInt() -
76-
d.getMessage()
77-
.regexpCapture("Total of ([0-9]+) diagnostics \\(reached limit of ([0-9]+)\\).*",
78-
2)
79-
.toInt() - 1
73+
d.getMessage().regexpCapture(limitRegex, 1).toInt() -
74+
d.getMessage().regexpCapture(limitRegex, 2).toInt() - 1
8075
)
8176
)
8277
}

0 commit comments

Comments
 (0)