Merge pull request #10723 from tamasvajk/kotlin-generated-files

Kotlin: Recognize generated files
This commit is contained in:
Tamás Vajk
2022-10-10 16:24:42 +02:00
committed by GitHub
5 changed files with 13 additions and 2 deletions

View File

@@ -51,9 +51,9 @@ library class MarkerCommentGeneratedFile extends GeneratedFile {
/**
* A marker comment that indicates that it is in a generated file.
*/
private class GeneratedFileMarker extends Top instanceof JavadocElement {
private class GeneratedFileMarker extends Top {
GeneratedFileMarker() {
exists(string msg | msg = this.getText() |
exists(string msg | msg = this.(JavadocElement).getText() or msg = this.(KtComment).getText() |
msg.regexpMatch("(?i).*\\bGenerated By\\b.*\\bDo not edit\\b.*") or
msg.regexpMatch("(?i).*\\bThis (file|class|interface|art[ei]fact) (was|is|(has been)) (?:auto[ -]?)?gener(e?)ated.*") or
msg.regexpMatch("(?i).*\\bAny modifications to this file will be lost\\b.*") or