Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
| Extraction errors | 0 |
| Extraction warnings | 0 |
| Files extracted - total | 4 |
| Files extracted - total user | 4 |
| Files extracted - with errors | 0 |
| Files extracted - without errors | 4 |
| Files extracted - without errors % | 100 |
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
| Extraction errors | 0 |
| Extraction warnings | 0 |
| Files extracted - total | 4 |
| Files extracted - total user | 4 |
| Files extracted - with errors | 0 |
| Files extracted - without errors | 4 |
| Files extracted - without errors % | 100 |
Expand Down
24 changes: 23 additions & 1 deletion rust/ql/src/queries/summary/Stats.qll
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,17 @@ int getTaintEdgesCount() {
*/
int getQuerySinksCount() { result = count(QuerySink s) }

/**
* Holds if there are at least 10 data flow nodes in the same location
* as `n`.
*/
private predicate isColocated10(DataFlow::Node n) {
exists(Location l |
l = n.getLocation() and
strictcount(DataFlow::Node other | other.getLocation() = l) >= 10
)
}

class CrateElement extends Element {
CrateElement() {
this instanceof Crate or
Expand Down Expand Up @@ -131,7 +142,8 @@ predicate extractionStats(string key, int value) {
key = "Extraction warnings" and
value = count(ExtractionWarning w | not exists(w.getLocation()) or w.getLocation().fromSource())
or
key = "Files extracted - total" and value = count(ExtractedFile f | exists(f.getRelativePath()))
key = "Files extracted - total user" and
value = count(ExtractedFile f | exists(f.getRelativePath()))
or
key = "Files extracted - with errors" and
value =
Expand Down Expand Up @@ -160,6 +172,13 @@ predicate extractionStats(string key, int value) {
value = count(MacroCall mc | mc.fromSource() and not mc.hasMacroCallExpansion())
}

/**
* Gets further summary statistics about extraction.
*/
predicate extractionStatsExtra(string key, int value) {
key = "Files extracted - total" and value = count(File f)
}

/**
* Gets summary statistics about inconsistencies.
*/
Expand Down Expand Up @@ -201,6 +220,9 @@ predicate taintStats(string key, int value) {
or
key = "Taint reach - per million nodes" and value = getTaintReach().floor()
or
key = "Taint nodes - highly colocated nodes" and
value = count(DataFlow::Node n | isColocated10(n))
or
key = "Taint sinks - query sinks" and value = getQuerySinksCount()
or
key = "Taint sinks - cryptographic operations" and
Expand Down
2 changes: 2 additions & 0 deletions rust/ql/src/queries/summary/SummaryStats.ql
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ where
or
extractionStats(key, value)
or
extractionStatsExtra(key, value)
or
inconsistencyStats(key, value)
or
typeInferenceInconsistencyStats(key, value)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
| Extraction errors | 0 |
| Extraction warnings | 7 |
| Files extracted - total | 7 |
| Files extracted - total user | 7 |
| Files extracted - with errors | 3 |
| Files extracted - without errors | 4 |
| Files extracted - without errors % | 57 |
Expand Down
Loading