mirror of
https://github.com/KevinMidboe/linguist.git
synced 2026-01-22 09:15:35 +00:00
Support for C++ files generated by protobuf/grpc (#3640)
* Support for C++ files generated by protobuf/grpc This changeset includes a sample generated file. [grpc](http://grpc.io) is a high performance, open-source universal RPC framework. * Account for older gRPC protobuf plugin message
This commit is contained in:
committed by
Colin Seymour
parent
329f80d245
commit
4dcf223c8e
@@ -81,7 +81,8 @@ module Linguist
|
||||
generated_grammarkit? ||
|
||||
generated_roxygen2? ||
|
||||
generated_jison? ||
|
||||
generated_yarn_lock?
|
||||
generated_yarn_lock? ||
|
||||
generated_grpc_cpp?
|
||||
end
|
||||
|
||||
# Internal: Is the blob an Xcode file?
|
||||
@@ -489,5 +490,18 @@ module Linguist
|
||||
return false unless lines.count > 0
|
||||
return lines[0].include?("# THIS IS AN AUTOGENERATED FILE")
|
||||
end
|
||||
|
||||
# Internal: Is this a protobuf/grpc-generated C++ file?
|
||||
#
|
||||
# A generated file contains:
|
||||
# // Generated by the gRPC C++ plugin.
|
||||
# on the first line.
|
||||
#
|
||||
# Return true or false
|
||||
def generated_grpc_cpp?
|
||||
return false unless %w{.cpp .hpp .h .cc}.include? extname
|
||||
return false unless lines.count > 1
|
||||
return lines[0].start_with?("// Generated by the gRPC")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user