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