File tree Expand file tree Collapse file tree 2 files changed +19
-1
lines changed
rust/ql/src/queries/telemetry Expand file tree Collapse file tree 2 files changed +19
-1
lines changed Original file line number Diff line number Diff line change 66
77import rust
88import codeql.util.ReportStats
9+ import codeql.rust.internal.TypeInference as TypeInference
910
1011module CallTargetStats implements StatsSig {
1112 int getNumberOfOk ( ) { result = count ( CallExprBase c | exists ( c .getStaticTarget ( ) ) ) }
@@ -41,6 +42,20 @@ module MacroCallTargetStats implements StatsSig {
4142 string getNotOkText ( ) { result = "macro calls with missing call target" }
4243}
4344
45+ private predicate hasGoodType ( Expr e ) { exists ( TypeInference:: inferType ( e , _) ) }
46+
47+ module ExprTypeStats implements StatsSig {
48+ int getNumberOfOk ( ) { result = count ( Expr e | e .fromSource ( ) and hasGoodType ( e ) ) }
49+
50+ int getNumberOfNotOk ( ) { result = count ( Expr e | e .fromSource ( ) and not hasGoodType ( e ) ) }
51+
52+ string getOkText ( ) { result = "expressions with known type" }
53+
54+ string getNotOkText ( ) { result = "expressions with unknown type" }
55+ }
56+
4457module CallTargetStatsReport = ReportStats< CallTargetStats > ;
4558
4659module MacroCallTargetStatsReport = ReportStats< MacroCallTargetStats > ;
60+
61+ module ExprTypeStatsReport = ReportStats< ExprTypeStats > ;
Original file line number Diff line number Diff line change 5454 CallTargetStatsReport:: percentageOfOk ( key , value ) or
5555 MacroCallTargetStatsReport:: numberOfOk ( key , value ) or
5656 MacroCallTargetStatsReport:: numberOfNotOk ( key , value ) or
57- MacroCallTargetStatsReport:: percentageOfOk ( key , value )
57+ MacroCallTargetStatsReport:: percentageOfOk ( key , value ) or
58+ ExprTypeStatsReport:: numberOfOk ( key , value ) or
59+ ExprTypeStatsReport:: numberOfNotOk ( key , value ) or
60+ ExprTypeStatsReport:: percentageOfOk ( key , value )
5861 ) and
5962 /* Infinity */
6063 value != 1.0 / 0.0 and
You can’t perform that action at this time.
0 commit comments