Exclude documentation files from language statistics

Documentation is an important part of a software project but is not
generally thought of as part of the code for that project. Repository
language statistics are used to quantify the project's code, so it makes
sense to exclude documentation from those computations.

Documentation files are recognized similarly to vendored files.
lib/linguist/documentation.yml contains regular expressions to match
common names for documentation files. A new linguist-documentation Git
attribute can be used to override those conventions.
This commit is contained in:
Adam Roben
2015-02-12 10:04:44 -05:00
parent e0c1107a25
commit 066052ddd2
7 changed files with 98 additions and 3 deletions

View File

@@ -99,4 +99,16 @@ class TestRepository < Minitest::Test
# overridden .gitattributes
assert !override_unvendored.vendored?
end
def test_linguist_override_documentation?
attr_commit = "d4c8fb8a28e91f97a7e53428a365c0abbac36d3d"
repo = linguist_repo(attr_commit).read_index
readme = Linguist::LazyBlob.new(rugged_repository, attr_commit, "README.md")
arduino = Linguist::LazyBlob.new(rugged_repository, attr_commit, "samples/Arduino/hello.ino")
# overridden by .gitattributes
refute_predicate readme, :documentation?
assert_predicate arduino, :documentation?
end
end