Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

C#: Adjust known type telemetry query #16247

Merged
merged 1 commit into from
Apr 18, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading