mirror of
https://github.com/github/codeql.git
synced 2026-04-28 18:25:24 +02:00
JS: classify numeric file names as generated
This commit is contained in:
@@ -154,6 +154,13 @@ private int countStartingHtmlElements(File f, int l) {
|
||||
result = strictcount(getAStartingElement(f, l))
|
||||
}
|
||||
|
||||
/**
|
||||
* Holds if the base name of `f` is a number followed by a single extension.
|
||||
*/
|
||||
predicate isGenerateFileName(File f) {
|
||||
f.getStem().regexpMatch("[0-9]+")
|
||||
}
|
||||
|
||||
/**
|
||||
* Holds if `tl` looks like it contains generated code.
|
||||
*/
|
||||
@@ -166,7 +173,8 @@ predicate isGenerated(TopLevel tl) {
|
||||
hasManyInvocations(tl) or
|
||||
isData(tl.getFile()) or
|
||||
isJsonLine(tl.getFile()) or
|
||||
isGeneratedHtml(tl.getFile())
|
||||
isGeneratedHtml(tl.getFile()) or
|
||||
isGenerateFileName(tl.getFile())
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
var x = 42;
|
||||
@@ -0,0 +1 @@
|
||||
var x = 42;
|
||||
@@ -1,3 +1,4 @@
|
||||
| 1.js:0:0:0:0 | 1.js | generated |
|
||||
| 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 |
|
||||
|
||||
Reference in New Issue
Block a user