Skip to content

Commit 8e9ca7b

Browse files
committed
Swift: Improve RegexEvals.ql and summary regex reporting.
1 parent e4e4c5b commit 8e9ca7b

File tree

2 files changed

+10
-5
lines changed

2 files changed

+10
-5
lines changed

swift/ql/src/queries/Summary/RegexEvals.ql

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,11 @@
1010
import swift
1111
import codeql.swift.regex.Regex
1212

13-
from RegexEval e
14-
select e,
15-
"Regular expression evaluation with " + count(e.getARegex()).toString() + " associated regex(s)."
13+
from RegexEval e, string message, Expr regex
14+
where
15+
message = "Regular expression evaluation with source $@." and regex = e.getARegex()
16+
or
17+
message = "Regular expression evaluation with no identified source." and
18+
not exists(e.getARegex()) and
19+
regex = e
20+
select e, message, regex, regex.toString()

swift/ql/src/queries/Summary/SummaryStats.ql

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,8 @@ predicate statistic(string what, string value) {
3030
or
3131
what = "Regular expression evals" and value = count(RegexEval e).toString()
3232
or
33-
what = "Regular expression evals with associated regex" and
34-
value = count(RegexEval e | exists(e.getARegex())).toString()
33+
what = "Regular expressions evaluated" and
34+
value = count(RegexEval e | | e.getARegex()).toString()
3535
}
3636

3737
from string what, string value

0 commit comments

Comments
 (0)