mirror of
https://github.com/github/codeql.git
synced 2026-02-08 03:01:10 +01:00
resolve imports across qlpacks
This commit is contained in:
@@ -2143,7 +2143,7 @@ module YAML {
|
||||
exists(YAMLEntry entry |
|
||||
entry.isRoot() and
|
||||
entry.getKey().getQualifiedName() = name and
|
||||
result = entry.getValue().getValue() and
|
||||
result = entry.getValue().getValue().trim() and
|
||||
entry.getLocation().getFile() = file
|
||||
)
|
||||
}
|
||||
@@ -2190,6 +2190,13 @@ module YAML {
|
||||
)
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets a QLPack that this QLPack depends on.
|
||||
*/
|
||||
QLPack getADependency() {
|
||||
exists(string name | hasDependency(name, _) | result.getName().replaceAll("-", "/") = name)
|
||||
}
|
||||
|
||||
Location getLocation() {
|
||||
// hacky, just pick the first node in the file.
|
||||
result =
|
||||
|
||||
@@ -100,8 +100,10 @@ private predicate resolveQualifiedName(Import imp, ContainerOrModule m, int i) {
|
||||
exists(Container c, Container parent |
|
||||
// should ideally look at `qlpack.yml` files
|
||||
parent = imp.getLocation().getFile().getParentContainer+() and
|
||||
exists(parent.getFile("qlpack.yml")) and
|
||||
c.getParentContainer() = parent and
|
||||
exists(YAML::QLPack pack |
|
||||
pack.getFile().getParentContainer() = parent and
|
||||
c.getParentContainer() = pack.getADependency*().getFile().getParentContainer()
|
||||
) and
|
||||
q = m.getName()
|
||||
|
|
||||
m = TFile(c)
|
||||
|
||||
Reference in New Issue
Block a user