diff --git a/rust/ql/integration-tests/hello-workspace/summary.cargo.expected b/rust/ql/integration-tests/hello-workspace/summary.cargo.expected index 11fba34f9019..85d2b9971712 100644 --- a/rust/ql/integration-tests/hello-workspace/summary.cargo.expected +++ b/rust/ql/integration-tests/hello-workspace/summary.cargo.expected @@ -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 | diff --git a/rust/ql/integration-tests/hello-workspace/summary.rust-project.expected b/rust/ql/integration-tests/hello-workspace/summary.rust-project.expected index 11fba34f9019..85d2b9971712 100644 --- a/rust/ql/integration-tests/hello-workspace/summary.rust-project.expected +++ b/rust/ql/integration-tests/hello-workspace/summary.rust-project.expected @@ -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 | diff --git a/rust/ql/src/queries/summary/Stats.qll b/rust/ql/src/queries/summary/Stats.qll index 36eeb0df4ef4..5e0169254486 100644 --- a/rust/ql/src/queries/summary/Stats.qll +++ b/rust/ql/src/queries/summary/Stats.qll @@ -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 @@ -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 = @@ -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. */ @@ -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 diff --git a/rust/ql/src/queries/summary/SummaryStats.ql b/rust/ql/src/queries/summary/SummaryStats.ql index 47a2c91a9eda..adfd302d0f8b 100644 --- a/rust/ql/src/queries/summary/SummaryStats.ql +++ b/rust/ql/src/queries/summary/SummaryStats.ql @@ -15,6 +15,8 @@ where or extractionStats(key, value) or + extractionStatsExtra(key, value) + or inconsistencyStats(key, value) or typeInferenceInconsistencyStats(key, value) diff --git a/rust/ql/test/query-tests/diagnostics/SummaryStatsReduced.expected b/rust/ql/test/query-tests/diagnostics/SummaryStatsReduced.expected index ed21d9772fce..7756215d1023 100644 --- a/rust/ql/test/query-tests/diagnostics/SummaryStatsReduced.expected +++ b/rust/ql/test/query-tests/diagnostics/SummaryStatsReduced.expected @@ -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 |