ignore roxygen2-generated files (#3373)

This commit is contained in:
yutannihilation
2017-01-04 06:31:04 +09:00
committed by Brandon Black
parent 8f2820e9cc
commit 1c4baf6dc2
3 changed files with 91 additions and 1 deletions

View File

@@ -77,7 +77,8 @@ module Linguist
generated_unity3d_meta? ||
generated_racc? ||
generated_jflex? ||
generated_grammarkit?
generated_grammarkit? ||
generated_roxygen2?
end
# Internal: Is the blob an Xcode file?
@@ -433,5 +434,19 @@ module Linguist
return false unless lines.count > 1
return lines[0].start_with?("// This is a generated file. Not intended for manual editing.")
end
# Internal: Is this a roxygen2-generated file?
#
# A roxygen2-generated file typically contain:
# % Generated by roxygen2: do not edit by hand
# on the first line.
#
# Return true or false
def generated_roxygen2?
return false unless extname == '.Rd'
return false unless lines.count > 1
return lines[0].include?("% Generated by roxygen2: do not edit by hand")
end
end
end