1

I have a personal repository on GitHub that is completely written in C#, with a few XML configuration files, and some PowerShell files from included NuGet packages. On the main repository page, GitHub shows a colored bar to display the breakdown of different languages used in the repository.
enter image description here

If you click this bar, it shows the language names and actual percents. enter image description here

This particular language breakdown seems a bit odd to me, since I am the only contributor, and I have never used Smalltalk.

If you click a language name, it will show you a list of the files using that language. enter image description here

In this last image, you can see on the left side that the repository really only contains C#, XML, PowerShell, text and markdown files.

So why does GitHub think I'm using Smalltalk? And why doesn't the color bar mention that I'm using XML?

4

3 回答 3

2

GitHub 使用启发式方法来识别存储库的语言。底层库是linguist。错误分类很常见,它是最重要的故障排除部分:我的存储库被检测为错误的语言

于 2016-12-12T21:28:51.777 回答
1

由于 GitHub 使用linguist检测语言,您可以打开 PR 报告一些错误标记为“Smalltalk”的文件。

例如,问题 2012仍然有效(即使它已关闭)。

于 2016-12-12T21:28:38.557 回答
1

正如 Philip 和 VonC 所指出的,GitHub 使用Linguist来计算语言统计数据。

那么为什么 GitHub 认为我在使用 Smalltalk?

语言学家首先依靠文件扩展名来确定文件的语言。然后,它使用一组优化策略来解决冲突的扩展(例如,.csSmalltalk 和 C# 都使用)。这些细化策略并不是 100% 准确的(对于小文件甚至会变得非常糟糕)。因此,具有冲突扩展名的文件可能会被错误地分类。

我该如何解决?

您可以使用Linguist 覆盖来告诉 Linguist.cs您的存储库中的所有文件都是 C#gitattributes文件:

*.cs linguist-language=C#

为什么彩条没有提到我正在使用 XML?

Linguist 在统计中只计算编程标记语言。XML 被归类为一种数据语言

为什么 Smalltalk 没有出现在搜索结果中?

搜索结果被缓存以避免每次访问页面时计算它们。当您截取屏幕截图时,它们可能不是最新的。

于 2017-08-13T09:26:55.163 回答