Skip to content

Commit c8c747a

Browse files
committed
Rust: Add total data flow inconsistencies to rust/summary/summary-statistics.
1 parent 30cc550 commit c8c747a

File tree

3 files changed

+20
-1
lines changed

3 files changed

+20
-1
lines changed

rust/ql/src/queries/summary/Stats.qll

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,11 @@
33
*/
44

55
import rust
6-
import codeql.rust.AstConsistency as AstConsistency
6+
private import codeql.rust.dataflow.internal.DataFlowImpl
7+
private import codeql.rust.dataflow.internal.TaintTrackingImpl
8+
private import codeql.rust.AstConsistency as AstConsistency
79
private import codeql.rust.controlflow.internal.CfgConsistency as CfgConsistency
10+
private import codeql.dataflow.internal.DataFlowImplConsistency as DataFlowImplConsistency
811

912
/**
1013
* Gets a count of the total number of lines of code in the database.
@@ -31,3 +34,16 @@ int getTotalAstInconsistencies() {
3134
int getTotalCfgInconsistencies() {
3235
result = sum(string type | | CfgConsistency::getCfgInconsistencyCounts(type))
3336
}
37+
38+
private module Input implements DataFlowImplConsistency::InputSig<Location, RustDataFlow> { }
39+
40+
/**
41+
* Gets a count of the total number of data flow inconsistencies in the database.
42+
*/
43+
int getTotalDataFlowInconsistencies() {
44+
result =
45+
sum(string type |
46+
|
47+
DataFlowImplConsistency::MakeConsistency<Location, RustDataFlow, RustTaintTracking, Input>::getInconsistencyCounts(type)
48+
)
49+
}

rust/ql/src/queries/summary/SummaryStats.ql

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,4 +35,6 @@ where
3535
key = "Inconsistencies - AST" and value = getTotalAstInconsistencies()
3636
or
3737
key = "Inconsistencies - CFG" and value = getTotalCfgInconsistencies()
38+
or
39+
key = "Inconsistencies - data flow" and value = getTotalDataFlowInconsistencies()
3840
select key, value

rust/ql/test/query-tests/diagnostics/SummaryStats.expected

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,6 @@
77
| Files extracted - without errors | 5 |
88
| Inconsistencies - AST | 0 |
99
| Inconsistencies - CFG | 0 |
10+
| Inconsistencies - data flow | 7 |
1011
| Lines of code extracted | 59 |
1112
| Lines of user code extracted | 59 |

0 commit comments

Comments
 (0)