mirror of
https://github.com/github/codeql.git
synced 2026-04-25 00:35:20 +02:00
C#: Exclude jump-to-def information for elements with too many locations
In databases which include multiple duplicated files, we can get an explosion of definition locations that can cause this query to produce too many results for the CodeQL toolchain. This commit restricts the definitions.ql query to producing definition/uses for definitions with fewer than 10 locations. This replicates the logic used in the C++ definitions.qll library which faces similar problems.
This commit is contained in:
@@ -187,5 +187,11 @@ cached
|
||||
Declaration definitionOf(Use use, string kind) {
|
||||
result = use.getDefinition() and
|
||||
result.fromSource() and
|
||||
kind = use.getUseType()
|
||||
kind = use.getUseType() and
|
||||
// Some entities have many locations. This can arise for files that
|
||||
// are duplicated multiple times in the database at different
|
||||
// locations. Rather than letting the result set explode, we just
|
||||
// exclude results that are "too ambiguous" -- we could also arbitrarily
|
||||
// pick one location later on.
|
||||
strictcount(result.getLocation()) < 10
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user