Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

false positives in protobuf generated code #17

Open
mdempsky opened this issue Aug 3, 2016 · 5 comments
Open

false positives in protobuf generated code #17

mdempsky opened this issue Aug 3, 2016 · 5 comments

Comments

@mdempsky
Copy link
Owner

mdempsky commented Aug 3, 2016

After fixing #16, all of the remaining issues in github.com/cockroachdb/cockroach/... are now in machine generate protobuf files.

I'm thinking unconvert should just ignore files ending with ".pb.go", but I'm open to suggestions for alternative heuristics. E.g., are there any strings like "DO NOT EDIT" that are conventionally recognized by other linter tools?

@dmitshur
Copy link
Collaborator

dmitshur commented Aug 3, 2016

E.g., are there any strings like "DO NOT EDIT" that are conventionally recognized by other linter tools?

If you're interested in detecting generated files, please be aware of golang/go#13560 and https://godoc.org/github.com/shurcooL/go/analysis#IsFileGenerated.

I'm not sure if linters usually try to detect or skip generated files. Perhaps it's a valid option to offer (maybe even turn on by default).

@mdempsky
Copy link
Owner Author

mdempsky commented Aug 3, 2016

Thanks for the issue reference. I figured I couldn't have been the first person to run into this.

Yeah, I have mixed feelings skipping over machine generated code. The protobuf case at least seems simple enough, since all of the code is machine generated. Other cases (e.g., the Go compiler's old yacc-based parser) seem trickier, since they mix hand-written and machine-generated code.

@mdempsky
Copy link
Owner Author

mdempsky commented Aug 5, 2016

@tamird Do you have any thoughts here for cockroachdb? I'm fine skipping .pb.go files and already wrote the code for it, but want to make sure there's user interest before committing. (I'm not using protobufs and unconvert together in any projects currently.)

@tamird
Copy link
Contributor

tamird commented Aug 5, 2016

I don't feel that strongly about this - we're easily ignoring those files with a simple grep. Perhaps a flag that ignored files based on regex would be useful, but again not important IMO.

@mdempsky
Copy link
Owner Author

mdempsky commented Aug 5, 2016

Okay. If filtering the results with grep is satisfactory, I'll leave it as is for now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants