mirror of
https://github.com/KevinMidboe/linguist.git
synced 2025-10-29 09:40:21 +00:00
Merge pull request #2426 from tamird/generated-go-bindata
Detect Go files generated by go-bindata
This commit is contained in:
@@ -65,7 +65,7 @@ module Linguist
|
||||
generated_net_docfile? ||
|
||||
generated_postscript? ||
|
||||
compiled_cython_file? ||
|
||||
generated_protocol_buffer_go? ||
|
||||
generated_go? ||
|
||||
generated_protocol_buffer? ||
|
||||
generated_apache_thrift? ||
|
||||
generated_jni_header? ||
|
||||
@@ -181,11 +181,11 @@ module Linguist
|
||||
def generated_net_designer_file?
|
||||
name.downcase =~ /\.designer\.cs$/
|
||||
end
|
||||
|
||||
|
||||
# Internal: Is this a codegen file for Specflow feature file?
|
||||
#
|
||||
# Visual Studio's SpecFlow extension generates *.feature.cs files
|
||||
# from *.feature files, they are not meant to be consumed by humans.
|
||||
# from *.feature files, they are not meant to be consumed by humans.
|
||||
# Let's hide them.
|
||||
#
|
||||
# Returns true or false
|
||||
@@ -233,11 +233,11 @@ module Linguist
|
||||
creator.include?("ImageMagick")
|
||||
end
|
||||
|
||||
def generated_protocol_buffer_go?
|
||||
def generated_go?
|
||||
return false unless extname == '.go'
|
||||
return false unless lines.count > 1
|
||||
|
||||
return lines[0].include?("Code generated by protoc-gen-go")
|
||||
return lines[0].include?("Code generated by")
|
||||
end
|
||||
|
||||
# Internal: Is the blob a C++, Java or Python source file generated by the
|
||||
@@ -250,7 +250,7 @@ module Linguist
|
||||
|
||||
return lines[0].include?("Generated by the protocol buffer compiler. DO NOT EDIT!")
|
||||
end
|
||||
|
||||
|
||||
# Internal: Is the blob generated by Apache Thrift compiler?
|
||||
#
|
||||
# Returns true or false
|
||||
|
||||
852
samples/Go/embedded.go
Normal file
852
samples/Go/embedded.go
Normal file
File diff suppressed because one or more lines are too long
@@ -217,6 +217,7 @@ class TestBlob < Minitest::Test
|
||||
assert sample_blob("Java/ProtocolBuffer.java").generated?
|
||||
assert sample_blob("Python/protocol_buffer_pb2.py").generated?
|
||||
assert sample_blob("Go/api.pb.go").generated?
|
||||
assert sample_blob("Go/embedded.go").generated?
|
||||
|
||||
# Apache Thrift generated code
|
||||
assert sample_blob("Python/gen-py-linguist-thrift.py").generated?
|
||||
|
||||
@@ -48,8 +48,7 @@ class TestHeuristcs < Minitest::Test
|
||||
def test_pl_prolog_perl_by_heuristics
|
||||
assert_heuristics({
|
||||
"Prolog" => all_fixtures("Prolog/*.pl"),
|
||||
"Perl" => all_fixtures("Perl/*.pl"),
|
||||
"Perl" => ["Perl/perl-test.t"],
|
||||
"Perl" => all_fixtures("Perl/*.pl") + ["Perl/perl-test.t"],
|
||||
"Perl6" => all_fixtures("Perl6/*.pl")
|
||||
})
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user