mirror of
https://github.com/ralsina/tartrazine.git
synced 2024-12-05 00:00:34 +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"),
|
nameEndsWith("package-lock.json"),
|
||||||
|
|
||||||
// Yarn plugnplay
|
// Yarn plugnplay
|
||||||
nameMatches(`(^|\/)\.pnp\.(c|m)?js$`),
|
nameMatches(`(^|\/)\.pnp\..*$`),
|
||||||
|
|
||||||
// Godeps
|
// Godeps
|
||||||
nameContains("Godeps/"),
|
nameContains("Godeps/"),
|
||||||
@ -113,6 +113,7 @@ var GeneratedCodeMatchers = []GeneratedCodeMatcher{
|
|||||||
isGeneratedJavaScriptPEGParser,
|
isGeneratedJavaScriptPEGParser,
|
||||||
isGeneratedPostScript,
|
isGeneratedPostScript,
|
||||||
isGeneratedGo,
|
isGeneratedGo,
|
||||||
|
isGeneratedProtobufFromGo,
|
||||||
isGeneratedProtobuf,
|
isGeneratedProtobuf,
|
||||||
isGeneratedJavaScriptProtocolBuffer,
|
isGeneratedJavaScriptProtocolBuffer,
|
||||||
isGeneratedApacheThrift,
|
isGeneratedApacheThrift,
|
||||||
@ -339,6 +340,24 @@ func isGeneratedGo(_, ext string, content []byte) bool {
|
|||||||
return false
|
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{}{
|
var protoExtensions = map[string]struct{}{
|
||||||
".py": {},
|
".py": {},
|
||||||
".java": {},
|
".java": {},
|
||||||
|
Loading…
Reference in New Issue
Block a user