mirror of
https://github.com/KevinMidboe/linguist.git
synced 2025-10-29 17:50:22 +00:00
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:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user