mirror of
https://github.com/github/codeql.git
synced 2025-12-24 04:36:35 +01:00
Swift: Add lines of code to SummaryStats.ql.
This commit is contained in:
@@ -12,6 +12,15 @@ import codeql.swift.security.SensitiveExprs
|
||||
import codeql.swift.dataflow.DataFlow
|
||||
import codeql.swift.dataflow.TaintTracking
|
||||
|
||||
int linesOfCode() {
|
||||
// approximate number of lines of code in the database
|
||||
result = count(File f, int line |
|
||||
exists(Location loc |
|
||||
not loc instanceof UnknownLocation and loc.getFile() = f and loc.getStartLine() = line
|
||||
)
|
||||
)
|
||||
}
|
||||
|
||||
/**
|
||||
* A taint configuration for tainted data reaching any node.
|
||||
*/
|
||||
@@ -37,6 +46,8 @@ float taintReach() { result = (taintedNodesCount() * 1000000.0) / count(DataFlow
|
||||
predicate statistic(string what, string value) {
|
||||
what = "Files" and value = count(File f).toString()
|
||||
or
|
||||
what = "Lines of code" and value = linesOfCode().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()
|
||||
|
||||
Reference in New Issue
Block a user