JS: classify numeric file names as generated

This commit is contained in:
Esben Sparre Andreasen
2019-07-01 09:44:05 +02:00
parent 927d72414b
commit 5ebcef41fa
4 changed files with 12 additions and 1 deletions

View File

@@ -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())
}
/**

View File

@@ -0,0 +1 @@
var x = 42;

View File

@@ -0,0 +1 @@
var x = 42;

View File

@@ -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 |