-
Notifications
You must be signed in to change notification settings - Fork 1.7k
/
Copy pathSummaryStats.ql
39 lines (36 loc) · 1.26 KB
/
SummaryStats.ql
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
/**
* @name Summary Statistics
* @description A table of summary statistics about a database.
* @kind table
* @id swift/summary/summary-statistics
* @tags summary
*/
import swift
import codeql.swift.dataflow.FlowSources
import codeql.swift.security.SensitiveExprs
import codeql.swift.regex.Regex
predicate statistic(string what, string value) {
what = "Files" and value = count(File f).toString()
or
what = "Lines of code" and value = sum(File f | | f.getNumberOfLinesOfCode()).toString()
or
what = "Compiler errors" and value = count(CompilerError d).toString()
or
what = "Compiler warnings" and value = count(CompilerWarning d).toString()
or
what = "Expressions" and value = count(Expr e | not e.getFile() instanceof UnknownFile).toString()
or
what = "Local flow sources" and value = count(LocalFlowSource s).toString()
or
what = "Remote flow sources" and value = count(RemoteFlowSource s).toString()
or
what = "Sensitive expressions" and value = count(SensitiveExpr e).toString()
or
what = "Regular expression evals" and value = count(RegexEval e).toString()
or
what = "Regular expressions evaluated" and
value = count(RegexEval e | | e.getARegex()).toString()
}
from string what, string value
where statistic(what, value)
select what, value