Exclude generated files from language statistics (#11653)

* Update go-enry to v2.5.2
This commit is contained in:
Lauris BH authored and GitHub committed 2020-05-29 09:20:01 +03:00
1 parent e8955173a9
commit bd2335671f
28 files changed
+1402 -1260

No files matched your search

+7 -3
View File
@@ -50,11 +50,15 @@ func (repo *Repository) GetLanguageStats(commitID string) (map[string]float32, e
return nil
}
// If content can not be read just do detection by filename
content, _ := readFile(f, fileSizeLimit)
if enry.IsGenerated(f.Name, content) {
return nil
}
// TODO: Use .gitattributes file for linguist overrides
language := analyze.GetCodeLanguageWithCallback(f.Name, func() ([]byte, error) {
return readFile(f, fileSizeLimit)
})
language := analyze.GetCodeLanguage(f.Name, content)
if language == enry.OtherLanguage || language == "" {
return nil
}