99import rust
1010import codeql.rust.Concepts
1111import codeql.rust.security.SensitiveData
12- import codeql.rust.security.WeakSensitiveDataHashingExtensions
1312import codeql.rust.Diagnostics
1413import Stats
1514import TaintReach
@@ -22,13 +21,14 @@ class CrateElement extends Element {
2221 }
2322}
2423
25- from string key , int value
26- where
24+ predicate elementStats ( string key , int value ) {
2725 key = "Elements extracted" and
2826 value = count ( Element e | not e instanceof Unextracted and not e instanceof CrateElement )
2927 or
3028 key = "Elements unextracted" and value = count ( Unextracted e )
31- or
29+ }
30+
31+ predicate extractionStats ( string key , int value ) {
3232 key = "Extraction errors" and value = count ( ExtractionError e )
3333 or
3434 key = "Extraction warnings" and value = count ( ExtractionWarning w )
@@ -53,20 +53,24 @@ where
5353 or
5454 key = "Lines of user code extracted" and value = getLinesOfUserCode ( )
5555 or
56+ key = "Macro calls - total" and value = count ( MacroCall mc )
57+ or
58+ key = "Macro calls - resolved" and value = count ( MacroCall mc | mc .hasExpanded ( ) )
59+ or
60+ key = "Macro calls - unresolved" and value = count ( MacroCall mc | not mc .hasExpanded ( ) )
61+ }
62+
63+ predicate inconsistencyStats ( string key , int value ) {
5664 key = "Inconsistencies - AST" and value = getTotalAstInconsistencies ( )
5765 or
5866 key = "Inconsistencies - Path resolution" and value = getTotalPathResolutionInconsistencies ( )
5967 or
6068 key = "Inconsistencies - CFG" and value = getTotalCfgInconsistencies ( )
6169 or
6270 key = "Inconsistencies - data flow" and value = getTotalDataFlowInconsistencies ( )
63- or
64- key = "Macro calls - total" and value = count ( MacroCall mc )
65- or
66- key = "Macro calls - resolved" and value = count ( MacroCall mc | mc .hasExpanded ( ) )
67- or
68- key = "Macro calls - unresolved" and value = count ( MacroCall mc | not mc .hasExpanded ( ) )
69- or
71+ }
72+
73+ predicate taintStats ( string key , int value ) {
7074 key = "Taint sources - active" and value = count ( ActiveThreatModelSource s )
7175 or
7276 key = "Taint sources - disabled" and
8488 or
8589 key = "Taint sinks - cryptographic operations" and
8690 value = count ( Cryptography:: CryptographicOperation o )
91+ }
92+
93+ from string key , int value
94+ where
95+ elementStats ( key , value )
96+ or
97+ extractionStats ( key , value )
98+ or
99+ inconsistencyStats ( key , value )
100+ or
101+ taintStats ( key , value )
87102select key , value order by key
0 commit comments