C#: WIP: Fix calls with no target in DB quality query

This commit is contained in:
Tamas Vajk
2024-11-29 15:08:33 +01:00
parent 5f41b6d3f2
commit 5d79ed6a9e
4 changed files with 40 additions and 2 deletions

View File

@@ -77,6 +77,12 @@ module CallTargetStats implements StatsSig {
)
}
private predicate isEventFieldAccess(EventCall c) {
exists(Event e | c.getEvent() = e |
forall(Accessor a | e.getAnAccessor() = a | a.isCompilerGenerated())
)
}
additional predicate isNotOkCall(Call c) {
not exists(c.getTarget()) and
not c instanceof DelegateCall and
@@ -85,7 +91,8 @@ module CallTargetStats implements StatsSig {
not isNoSetterPropertyInitialization(c) and
not isAnonymousObjectMemberDeclaration(c) and
not isInitializedWithCollectionInitializer(c) and
not c.getParent+() instanceof NameOfExpr
not c.getParent+() instanceof NameOfExpr and
not isEventFieldAccess(c)
}
int getNumberOfNotOk() { result = count(Call c | isNotOkCall(c)) }