mirror of
https://github.com/ralsina/tartrazine.git
synced 2024-12-04 15:50:35 +00:00
Merge pull request #133 from lafriks-fork/feat/generated_files_proto_go_sum
Generated proto file and PNP detection
This commit is contained in:
commit
9b19067edc
@ -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": {},
|
||||
|
Loading…
Reference in New Issue
Block a user