mirror of
https://github.com/github/codeql.git
synced 2026-04-28 18:25:24 +02:00
JS: support <meta name="generator"/> classification
This commit is contained in:
@@ -114,6 +114,17 @@ private predicate isData(File f) {
|
||||
)
|
||||
}
|
||||
|
||||
/**
|
||||
* Holds if `f` is a generated HTML file.
|
||||
*/
|
||||
private predicate isGeneratedHtml(File f) {
|
||||
exists(HTML::Element e |
|
||||
e.getFile() = f and
|
||||
e.getName() = "meta" and
|
||||
e.getAttributeByName("name").getValue() = "generator"
|
||||
)
|
||||
}
|
||||
|
||||
/**
|
||||
* Holds if `tl` looks like it contains generated code.
|
||||
*/
|
||||
@@ -124,12 +135,14 @@ predicate isGenerated(TopLevel tl) {
|
||||
tl instanceof DartGeneratedTopLevel or
|
||||
exists (GeneratedCodeMarkerComment gcmc | tl = gcmc.getTopLevel()) or
|
||||
hasManyInvocations(tl) or
|
||||
isData(tl.getFile())
|
||||
isData(tl.getFile()) or
|
||||
isGeneratedHtml(tl.getFile())
|
||||
}
|
||||
|
||||
/**
|
||||
* Holds if `file` look like it contains generated code.
|
||||
*/
|
||||
predicate isGeneratedCode(File file) {
|
||||
isGenerated(file.getATopLevel())
|
||||
isGenerated(file.getATopLevel()) or
|
||||
isGeneratedHtml(file)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user