Add BlobHelper#include_in_language_stats?

This just extracts some logic from Repository#compute_stats and makes it
testable.
This commit is contained in:
Adam Roben
2015-02-13 14:26:36 -05:00
parent a817d95d6c
commit 6a86e8ea97
3 changed files with 37 additions and 8 deletions

View File

@@ -332,5 +332,15 @@ module Linguist
def tm_scope
language && language.tm_scope
end
DETECTABLE_TYPES = [:programming, :markup].freeze
# Internal: Should this blob be included in repository language statistics?
def include_in_language_stats?
!vendored? &&
!documentation? &&
!generated? &&
language && DETECTABLE_TYPES.include?(language.type)
end
end
end