mirror of
https://github.com/github/codeql.git
synced 2026-06-10 23:41:09 +02:00
32 lines
704 B
Plaintext
32 lines
704 B
Plaintext
private import rust
|
|
|
|
predicate toBeTested(Element e) {
|
|
not e instanceof CrateElement and
|
|
not e instanceof Builtin and
|
|
(
|
|
not e instanceof Locatable
|
|
or
|
|
exists(e.(Locatable).getFile().getRelativePath())
|
|
)
|
|
}
|
|
|
|
class CrateElement extends Element {
|
|
CrateElement() {
|
|
this instanceof Crate or
|
|
this instanceof NamedCrate
|
|
}
|
|
}
|
|
|
|
class Builtin extends AstNode {
|
|
Builtin() { this.getFile().getAbsolutePath().matches("%/builtins/%.rs") }
|
|
}
|
|
|
|
predicate commentAt(string text, string filepath, int line) {
|
|
exists(Comment c |
|
|
c.getLocation().hasLocationInfo(filepath, line, _, _, _) and
|
|
c.getCommentText().trim() = text and
|
|
c.fromSource() and
|
|
not text.matches("$%")
|
|
)
|
|
}
|