Skip to content

Commit

Permalink
Merge pull request #2426 from tamird/generated-go-bindata
Browse files Browse the repository at this point in the history
Detect Go files generated by go-bindata
  • Loading branch information
arfon committed May 31, 2015
2 parents a2ce197 + d17222e commit f380aa2
Show file tree
Hide file tree
Showing 4 changed files with 860 additions and 8 deletions.
12 changes: 6 additions & 6 deletions lib/linguist/generated.rb
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ def generated?
generated_net_docfile? ||
generated_postscript? ||
compiled_cython_file? ||
generated_protocol_buffer_go? ||
generated_go? ||
generated_protocol_buffer? ||
generated_apache_thrift? ||
generated_jni_header? ||
Expand Down Expand Up @@ -181,11 +181,11 @@ def generated_net_docfile?
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
Expand Down Expand Up @@ -233,11 +233,11 @@ def generated_postscript?
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
Expand All @@ -250,7 +250,7 @@ def generated_protocol_buffer?

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
Expand Down
Loading

0 comments on commit f380aa2

Please sign in to comment.