Skip to content

Commit

Permalink
Merge pull request #16247 from tamasvajk/feature/adjust-known-types
Browse files Browse the repository at this point in the history
C#: Adjust known type telemetry query
  • Loading branch information
tamasvajk authored Apr 18, 2024
2 parents a1267d7 + c11adc8 commit 77d0df4
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions csharp/ql/src/Telemetry/ExtractorInformation.ql
Original file line number Diff line number Diff line change
Expand Up @@ -134,10 +134,18 @@ module CallTargetStats implements StatsSig {
string getNotOkText() { result = "calls with missing call target" }
}

private class SourceExpr extends Expr {
SourceExpr() { this.getFile().fromSource() }
}

private predicate hasGoodType(Expr e) {
exists(e.getType()) and not e.getType() instanceof UnknownType
}

module ExprTypeStats implements StatsSig {
int getNumberOfOk() { result = count(Expr e | not e.getType() instanceof UnknownType) }
int getNumberOfOk() { result = count(SourceExpr e | hasGoodType(e)) }

int getNumberOfNotOk() { result = count(Expr e | e.getType() instanceof UnknownType) }
int getNumberOfNotOk() { result = count(SourceExpr e | not hasGoodType(e)) }

string getOkText() { result = "expressions with known type" }

Expand Down

0 comments on commit 77d0df4

Please sign in to comment.