lib/linguist/generated.rb in github-linguist-7.8.0 vs lib/linguist/generated.rb in github-linguist-7.9.0
- old
+ new
@@ -92,11 +92,12 @@
generated_grpc_cpp? ||
generated_dart? ||
generated_perl_ppport_header? ||
generated_gamemakerstudio? ||
generated_gimp? ||
- generated_visualstudio6?
+ generated_visualstudio6? ||
+ generated_haxe?
end
# Internal: Is the blob an Xcode file?
#
# Generated if the file extension is an Xcode
@@ -298,11 +299,11 @@
def generated_go?
return false unless extname == '.go'
return false unless lines.count > 1
- return lines[0].include?("Code generated by")
+ return lines.first(10).any? { |l| l.include? "Code generated by" }
end
PROTOBUF_EXTENSIONS = ['.py', '.java', '.h', '.cc', '.cpp', '.m', '.rb']
# Internal: Is the blob a C++, Java or Python source file generated by the
@@ -602,11 +603,11 @@
return false unless ['.yy', '.yyp'].include? extname
return false unless lines.count > 3
return lines[2].match(/\"modelName\"\:\s*\"GM/) ||
lines[0] =~ /^\d\.\d\.\d.+\|\{/
end
-
+
# Internal: Is this a generated GIMP C image file?
#
# GIMP saves C sources with one of two comment forms:
# * `/* GIMP RGB C-Source image dump (<filename>.c) */` (C source export)
# * `/* GIMP header image file format (RGB): <filename>.h */` (Header export)
@@ -623,9 +624,19 @@
#
# Return true or false
def generated_visualstudio6?
return false unless extname.downcase == '.dsp'
lines.first(3).any? { |l| l.include? '# Microsoft Developer Studio Generated Build File' }
+ end
+
+ HAXE_EXTENSIONS = ['.js', '.py', '.lua', '.cpp', '.h', '.java', '.cs', '.php']
+
+ # Internal: Is this a generated Haxe-generated source file?
+ #
+ # Return true or false
+ def generated_haxe?
+ return false unless HAXE_EXTENSIONS.include?(extname)
+ return lines.first(3).any? { |l| l.include?("Generated by Haxe") }
end
# Internal: Is this a generated HTML file?
#
# HTML documents generated by authoring tools often include a