-
-
Notifications
You must be signed in to change notification settings - Fork 11
Ignore generated code #33
Comments
I'm partial to looking for "DO NOT EDIT" as opposed to "Code generated by". This ties into golang/go#13560. @petermattis, would "DO NOT EDIT" still match all your generated files? |
According to https://github.com/shurcooL/go/blob/master/analysis/generated_detection.go, which is the best current implementation I could come up with before golang/go#13560 is resolved, just "DO NOT EDIT" on its own is not enough to signal that a file is generated. It should also contain the word "GENERATED" or "generated". Although just "Code generated by" on its own is also enough. |
But maybe it should be? |
|
We'll match on |
Are you just going to check in the header comment? (Or first N bytes / lines?) |
We're checking the very first comment block in the file. If it turns out that people are putting their copyright notice before that comment (I haven't found anybody do that yet), we'll adjust it to check the first two comment blocks. |
Generated code frequently has unused code/variables/constants/etc. For example:
The above files were generated by
protoc
,stringer
andyacc
respectively. All of the generated code has a header comment that says// Code generated by
. Currently, I just grep to ignore warnings in generated code, but it seems preferable to have this logic builtin to the tool.The text was updated successfully, but these errors were encountered: