mirror of
https://github.com/github/codeql.git
synced 2026-04-30 03:05:15 +02:00
JS: classify HTML files with > 20 elements on a line as generated
This commit is contained in:
@@ -121,6 +121,23 @@ private predicate isGeneratedHtml(File f) {
|
||||
e.getName() = "meta" and
|
||||
e.getAttributeByName("name").getValue() = "generator"
|
||||
)
|
||||
or
|
||||
20 < countStartingHtmlElements(f, _)
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets an element that starts at line `l` in file `f`.
|
||||
*/
|
||||
private HTML::Element getAStartingElement(File f, int l) {
|
||||
result.getFile() = f and result.getLocation().getStartLine() = l
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Gets the number of HTML elements that starts at line `l` in file `f`.
|
||||
*/
|
||||
private int countStartingHtmlElements(File f, int l) {
|
||||
result = strictcount(getAStartingElement(f, l))
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
| AutoRest.js:0:0:0:0 | AutoRest.js | generated |
|
||||
| ManyElementsOnLine.html:0:0:0:0 | ManyElementsOnLine.html | generated |
|
||||
| ai.1.2.3-build0123.js:0:0:0:0 | ai.1.2.3-build0123.js | library |
|
||||
| bundle-directive.js:0:0:0:0 | bundle-directive.js | generated |
|
||||
| data.js:0:0:0:0 | data.js | generated |
|
||||
|
||||
Reference in New Issue
Block a user