diff --git a/data/generated.go b/data/generated.go index 4052eec..93d286c 100644 --- a/data/generated.go +++ b/data/generated.go @@ -74,7 +74,7 @@ var GeneratedCodeNameMatchers = []GeneratedCodeNameMatcher{ nameEndsWith("package-lock.json"), // Yarn plugnplay - nameMatches(`(^|\/)\.pnp\.(c|m)?js$`), + nameMatches(`(^|\/)\.pnp\..*$`), // Godeps nameContains("Godeps/"), @@ -113,6 +113,7 @@ var GeneratedCodeMatchers = []GeneratedCodeMatcher{ isGeneratedJavaScriptPEGParser, isGeneratedPostScript, isGeneratedGo, + isGeneratedProtobufFromGo, isGeneratedProtobuf, isGeneratedJavaScriptProtocolBuffer, isGeneratedApacheThrift, @@ -339,6 +340,24 @@ func isGeneratedGo(_, ext string, content []byte) bool { return false } +func isGeneratedProtobufFromGo(_, ext string, content []byte) bool { + if ext != ".proto" { + return false + } + lines := getLines(content, 20) + if len(lines) <= 1 { + return false + } + + for _, line := range lines { + if bytes.Contains(line, []byte("This file was autogenerated by go-to-protobuf")) { + return true + } + } + + return false +} + var protoExtensions = map[string]struct{}{ ".py": {}, ".java": {},