mirror of
https://github.com/KevinMidboe/linguist.git
synced 2025-12-29 13:21:01 +00:00
Merge pull request #59 from github/suppress-net-docfiles
Suppress .NET XML Intellisense generated files
This commit is contained in:
@@ -181,7 +181,7 @@ module Linguist
|
|||||||
def generated?
|
def generated?
|
||||||
if xcode_project_file? || visual_studio_project_file?
|
if xcode_project_file? || visual_studio_project_file?
|
||||||
true
|
true
|
||||||
elsif generated_coffeescript? || minified_javascript?
|
elsif generated_coffeescript? || minified_javascript? || generated_net_docfile?
|
||||||
true
|
true
|
||||||
else
|
else
|
||||||
false
|
false
|
||||||
@@ -255,6 +255,27 @@ module Linguist
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# Internal: Is this a generated documentation file for a .NET assembly?
|
||||||
|
#
|
||||||
|
# Requires Blob#data
|
||||||
|
#
|
||||||
|
# .NET developers often check in the XML Intellisense file along with an
|
||||||
|
# assembly - however, these don't have a special extension, so we have to
|
||||||
|
# dig into the contents to determine if it's a docfile. Luckily, these files
|
||||||
|
# are extremely structured, so recognizing them is easy.
|
||||||
|
#
|
||||||
|
# Returns true or false
|
||||||
|
def generated_net_docfile?
|
||||||
|
return false unless extname == ".xml"
|
||||||
|
return false unless lines.count > 3
|
||||||
|
|
||||||
|
# .NET Docfiles always open with <doc> and their first tag is an
|
||||||
|
# <assembly> tag
|
||||||
|
return lines[1].include?("<doc>") &&
|
||||||
|
lines[2].include?("<assembly>") &&
|
||||||
|
lines[-2].include?("</doc>")
|
||||||
|
end
|
||||||
|
|
||||||
# Public: Should the blob be indexed for searching?
|
# Public: Should the blob be indexed for searching?
|
||||||
#
|
#
|
||||||
# Excluded:
|
# Excluded:
|
||||||
|
|||||||
1121
test/fixtures/net_docfile.xml
vendored
Normal file
1121
test/fixtures/net_docfile.xml
vendored
Normal file
File diff suppressed because it is too large
Load Diff
@@ -136,6 +136,9 @@ class TestBlob < Test::Unit::TestCase
|
|||||||
assert blob("project.resx").generated?
|
assert blob("project.resx").generated?
|
||||||
assert blob("project.sln").generated?
|
assert blob("project.sln").generated?
|
||||||
|
|
||||||
|
# Generated .NET Docfiles
|
||||||
|
assert blob("net_docfile.xml").generated?
|
||||||
|
|
||||||
# Long line
|
# Long line
|
||||||
assert !blob("uglify.js").generated?
|
assert !blob("uglify.js").generated?
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user