File tree Expand file tree Collapse file tree 4 files changed +28
-3
lines changed
src/semmle/python/filters
test/library-tests/filters/generated Expand file tree Collapse file tree 4 files changed +28
-3
lines changed Original file line number Diff line number Diff line change @@ -24,6 +24,8 @@ library class GenericGeneratedFile extends GeneratedFile {
2424 ( lax_generated_by ( this , _) or lax_generated_from ( this , _) ) and dont_modify ( this )
2525 or
2626 strict_generated_by ( this , _) or strict_generated_from ( this , _)
27+ or
28+ auto_generated ( this )
2729 )
2830 }
2931
@@ -78,8 +80,15 @@ private predicate dont_modify(File f) {
7880 comment_or_docstring ( f , _) .regexpMatch ( "(?is).*\\b(Do not|Don't) (edit|modify|make changes)\\b.*" )
7981}
8082
83+ private predicate auto_generated ( File f ) {
84+ exists ( Comment c |
85+ c .getLocation ( ) .getFile ( ) = f and
86+ c .getText ( ) .regexpMatch ( "(?is)# *this +(code|file) +is +(auto(matically)?[ -]?generated|created automatically).*" )
87+ )
88+ }
89+
8190
82- /**
91+ /**
8392 * A file generated by a template engine
8493 */
8594abstract library class SpecificGeneratedFile extends GeneratedFile {
Original file line number Diff line number Diff line change 1+ | antlr.py | none |
12| generic.py | tools/idna-data |
23| sphinx.py | Sphinx |
34| swig.py | SWIG |
Original file line number Diff line number Diff line change 22import python
33import semmle.python.filters.GeneratedCode
44
5- from GeneratedFile f
6- select f .toString ( ) , f .getTool ( )
5+ from GeneratedFile f , string tool
6+ where
7+ tool = f .getTool ( )
8+ or
9+ not exists ( f .getTool ( ) ) and tool = "none"
10+ select f .toString ( ) , tool
Original file line number Diff line number Diff line change 1+ # $ANTLR 3.0.1 C.g 2010-02-23 09:58:53
2+
3+ from antlr3 import *
4+ from antlr3 .compat import set , frozenset
5+
6+ ## @file
7+ # The file defines the parser for C source files.
8+ #
9+ # THIS FILE IS AUTO-GENERATED.
10+ #
11+ ##
You can’t perform that action at this time.
0 commit comments