Merge pull request #712 from markshannon/python-fix-odasa-7307

Python: Detect a wider range of generated files.
This commit is contained in:
Taus
2019-01-18 14:38:08 +01:00
committed by GitHub
4 changed files with 28 additions and 3 deletions

View File

@@ -24,6 +24,8 @@ library class GenericGeneratedFile extends GeneratedFile {
(lax_generated_by(this, _) or lax_generated_from(this, _)) and dont_modify(this)
or
strict_generated_by(this, _) or strict_generated_from(this, _)
or
auto_generated(this)
)
}
@@ -78,8 +80,15 @@ private predicate dont_modify(File f) {
comment_or_docstring(f, _).regexpMatch("(?is).*\\b(Do not|Don't) (edit|modify|make changes)\\b.*")
}
private predicate auto_generated(File f) {
exists(Comment c |
c.getLocation().getFile() = f and
c.getText().regexpMatch("(?is)# *this +(code|file) +is +(auto(matically)?[ -]?generated|created automatically).*")
)
}
/**
/**
* A file generated by a template engine
*/
abstract library class SpecificGeneratedFile extends GeneratedFile {